KnpLabs / KnpLastTweetsBundle

Symfony2 bundle to easily add a widget with the latest tweets of a Twitter user to a page.
http://knplabs.com/
MIT License
32 stars 15 forks source link

Not working: [Unexpected token "name" of value "with"] in template and one other problem #27

Closed christinloehner closed 9 years ago

christinloehner commented 9 years ago

I've followed the installation instruction and also managed to install the dependencies with "dev-master", so I'm up to date also with symfony 2.6.6.

I've also correctly added a new oauth app in twitter and configured in config.yml.

When adding the

{% render "KnpLastTweetsBundle:Twitter:lastTweets" with {'username': 'NewLinuxCounter'} %}

to the template, then I get this:

Unexpected token "name" of value "with" ("end of statement block" expected) in  src/Syw/Front/MainBundle/Resources/views/Common/_footer.html.twig at line 64
500 Internal Server Error - Twig_Error_Syntax

When using

php app/console knp-last-tweets:force-fetch knplabs

I get this:

PHP Warning:  Uncaught exception 'Symfony\Component\Debug\Exception\ContextErrorException'  with message 'Warning:   require_once(/daten/srv/test.linuxcounter.net/app/../vendor/twitteroauth/twitteroauth/twitteroauth.php):  failed to open stream: No such file or directory' in  /daten/srv/test.linuxcounter.net/app/cache/dev/appDevDebugProjectContainer.php:2725
weaverryan commented 9 years ago

Hey @alexloehner!

Try this instead and let me know if it works:

{{ render("KnpLastTweetsBundle:Twitter:lastTweets", {
    'username': 'NewLinuxCounter'
}) }}
christinloehner commented 9 years ago

Hey @weaverryan !

this results in:

An exception has been thrown during the rendering of a template ("No route found for "GET Twitter:lastTweets" (from "http://dev.test.linuxcounter.net/")") in src/Syw/Front/MainBundle/Resources/views/Common/_footer.html.twig at line 63.
500 Internal Server Error - Twig_Error_Runtime
2 linked Exceptions: NotFoundHttpException » ResourceNotFoundException »
christinloehner commented 9 years ago
$ php app/console router:debug | grep -i twitter

returns nothing... same for:

$ php app/console router:debug | grep -i tweet
weaverryan commented 9 years ago

@alexloehner That's my fault, try this instead (my code above was just plain wrong):

{{ render(controller("KnpLastTweetsBundle:Twitter:lastTweets", {
    'username': 'NewLinuxCounter'
})) }}
christinloehner commented 9 years ago

@weaverryan

Now the page renders, but in the box in the footer where the tweets should appear, this appears instead:

Compile Error: appDevDebugProjectContainer::getInoriTwitterApp_ApiService(): Failed opening required '/daten/srv/test.linuxcounter.net/app/../vendor/twitteroauth/twitteroauth/twitteroauth.php' (include_path='.:/usr/share/php:/usr/share/pear')
500 Internal Server Error - FatalErrorException

And after some seconds of waiting, then a _profiler error appears:

OutOfMemoryException in FileProfilerStorage.php line 123:
Error: Allowed memory size of 2147483648 bytes exhausted (tried to allocate 16133868 bytes)

:-P

christinloehner commented 9 years ago

by the way: vendor/twitteroauth doesn't exist... but I have all dependencies installed successfully... o.O

christinloehner commented 9 years ago

This is my composer.json:

{
  "name": "alex/symfony",
  "license": "proprietary",
  "type": "project",
  "autoload": {
    "psr-0": {
      "": "src/",
      "SymfonyStandard": "app/"
    }
  },
  "require": {
    "php": ">=5.4.0",
    "vitre/php-console-bundle": "dev-master",
    "symfony/symfony": "2.6.*",
    "doctrine/orm": "~2.2,>=2.2.3,<2.5",
    "doctrine/dbal": "<2.5",
    "doctrine/doctrine-bundle": "dev-master",
    "doctrine/migrations": "dev-master",
    "doctrine/doctrine-migrations-bundle": "dev-master",
    "twig/extensions": "dev-master",
    "symfony/assetic-bundle": "dev-master",
    "symfony/swiftmailer-bundle": "dev-master",
    "symfony/monolog-bundle": "dev-master",
    "sensio/distribution-bundle": "dev-master",
    "sensio/framework-extra-bundle": "dev-master",
    "incenteev/composer-parameter-handler": "dev-master",
    "knplabs/knp-menu-bundle": "dev-master",
    "knplabs/knp-paginator-bundle": "dev-master",
    "knplabs/knp-menu": "dev-master",
    "friendsofsymfony/user-bundle": "dev-master",
    "asm/translation-loader-bundle": "dev-master",
    "javiereguiluz/easyadmin-bundle": "dev-master",
    "ornicar/gravatar-bundle": "dev-master",
    "mopa/bootstrap-bundle": "dev-master",
    "twbs/bootstrap": "dev-master",
    "shtumi/useful-bundle": "dev-master",
    "propaganistas/twig-emailobfuscator": "dev-master",
    "friendsofsymfony/rest-bundle": "dev-master",
    "jms/serializer-bundle": "dev-master",
    "mktcode/caitcha-bundle": "dev-master",
    "ob/highcharts-bundle": "dev-master",
    "whisller/irc-bot-bundle": "dev-master",
    "carlescliment/light-news-bundle": "dev-master",
    "redmonster/announcement-bundle": "dev-master",
    "nostalgiaz/bootstrap-switch": "dev-master",
    "knplabs/knp-last-tweets-bundle": "*",
    "inori/twitter-app-bundle": "dev-master",
    "abraham/twitteroauth": "dev-master"
  },
  "require-dev": {
    "sensio/generator-bundle": "dev-master",
    "satooshi/php-coveralls": "dev-master"
  },
  "scripts": {
    "post-root-package-install": [
      "SymfonyStandard\\Composer::hookRootPackageInstall"
    ],
    "post-install-cmd": [
      "Incenteev\\ParameterHandler\\ScriptHandler::buildParameters",
      "Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::buildBootstrap",
      "Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::clearCache",
      "Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::installAssets",
      "Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::installRequirementsFile",
      "Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::removeSymfonyStandardFiles",
      "Mopa\\Bundle\\BootstrapBundle\\Composer\\ScriptHandler::postInstallSymlinkTwitterBootstrap"
    ],
    "post-update-cmd": [
      "Incenteev\\ParameterHandler\\ScriptHandler::buildParameters",
      "Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::buildBootstrap",
      "Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::clearCache",
      "Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::installAssets",
      "Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::installRequirementsFile",
      "Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::removeSymfonyStandardFiles",
      "Mopa\\Bundle\\BootstrapBundle\\Composer\\ScriptHandler::postInstallSymlinkTwitterBootstrap"
    ]
  },
  "config": {
    "bin-dir": "bin"
  },
  "extra": {
    "symfony-app-dir": "app",
    "symfony-web-dir": "web",
    "symfony-assets-install": "relative",
    "incenteev-parameters": {
      "file": "app/config/parameters.yml"
    }
  },
  "repositories": [
    {
      "type": "git",
      "url": "https://github.com/nostalgiaz/bootstrap-switch"
    },
    {
      "type": "git",
      "url": "https://github.com/Inoryy/InoriTwitterAppBundle"
    },
    {
      "type": "package",
      "package": {
        "name": "abraham/twitteroauth",
        "version": "dev-master",
        "dist": {
          "url": "https://github.com/abraham/twitteroauth/zipball/master",
          "type": "zip"
        },
        "source": {
          "url": "git://github.com/abraham/twitteroauth.git",
          "type": "git",
          "reference": "master"
        }
      }
    }
  ]
}
christinloehner commented 9 years ago

The bundle "abraham/twitteroauth" has been installed to:

twitteroauth

weaverryan commented 9 years ago

@alexloehner I'm sorry - I can't help - I see the problem, but I think it might be because the abraham library has had massive updates (good updates), but the Inorry library is dead, and so no longer works with the new version

My best advice would be to try something else - like using the abraham library directly to fetch details from Twitter.

Good luck!

inoryy commented 9 years ago

@weaverryan @alexloehner InoriTwitterAppBundle was just filling the blanks in abraham's library back when it wasn't PSR-compliant and not up on packagist.

Assuming all that is settled, you can absolutely make use of it directly. In fact I'd go as far as to say that you should use it directly

christinloehner commented 9 years ago

@Inoryy @weaverryan thanks for your reply.

As you can see here: https://www.linuxcounter.net/ at the bottom of the page... I've already implemented the abrahams/twitteroauth directly. ;-)

Thanks

weaverryan commented 9 years ago

Ah, great news! Nice work @alexloehner :)