I have a problem with Symfony 2.
I get the CSS in the head section like this:
<?php foreach ($view['assetic']->stylesheets(
array(
'../web/assets/css/bootstrap.min.css',
'../web/assets/css/main.css',
),array('cssrewrite')
) as $url): ?>
<link rel="stylesheet" href="<?php echo $view->escape($url) ?>" />
<?php endforeach ?>
In the dev environment, everything works. In the prod environment, the CSS files are generated but the HTML rendering fails with an exception before printing the <link>
tag.
In my log I see this, but I don't understand the error.
[Sun Jul 19 21:21:55.615090 2015] [:error] [pid ] [client X:61902] PHP Fatal error: Uncaught exception 'Symfony\Component\Debug\Exception\ContextErrorException' with message 'Catchable Fatal Error: Argument 1 passed to Symfony\Bundle\AsseticBundle\Templating\StaticAsseticHelper::__construct() must be an instance of Symfony\Component\Templating\Helper\CoreAssetsHelper, instance of Symfony\Bundle\FrameworkBundle\Templating\Helper\AssetsHelper given, called in /home/web/public_html/web/app/cache/prod/appProdProjectContainer.php on line 296 and defined' in /home/web/public_html/web/vendor/symfony/assetic-bundle/Templating/StaticAsseticHelper.php:33\nStack trace:\n#0 /home/web/public_html/web/vendor/symfony/assetic-bundle/Templating/StaticAsseticHelper.php(33): Symfony\Component\Debug\ErrorHandler->handleError(4096, 'Argument 1 pass...', '/home/web/....', 33, Array)\n#1 /home/web/public_html/web/app/cache/prod/appProdProjectContainer.php(296): Symfony\Bundle\AsseticBundle\Templating\StaticAsseticHelper->__construct(Object(Symfony\Bundle\FrameworkBundle\Templating\ in /home/web/public_html/web/vendor/twig/twig/lib/Twig/Parser.php on line 370
I've tried clearing the cache, but that doesn't change anything.
app/console cache:clear --env=prod
? – user2268997