Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

'templating.helper.router' service is not found in symfony 2.7

i upgarde my project from 2.6 to 2.7, i get this error in end of work:

[Symfony\Component\DependencyInjection\Exception\ServiceNotFoundException]                                           
The service "knp_paginator.helper.processor" has a dependency on a non-existent service "templating.helper.router". 

i search service container but i could not found service in service list(container:debug), i found service definition for "templating.helper.router" in this file

/vendor/symfony/symfony/src/Symfony/Bundle/FrameworkBundle/Resources/config/templating_php.xml

why this service is not created by service container?


     /usr/bin/php /var/www/ghanbari/anar/app/console debug:container --tag=templating.helper -v

Deprecated: The Symfony\Component\DependencyInjection\Definition::setFactoryMethod method is deprecated since version 2.6 and will be removed in 3.0. Use Definition::setFactory() instead. in /var/www/ghanbari/anar/vendor/symfony/symfony/src/Symfony/Component/DependencyInjection/Definition.php on line 137

Call Stack:
    0.0004     227656   1. {main}() /var/www/ghanbari/anar/app/console:0
    0.0161    2719288   2. Symfony\Component\Console\Application->run() /var/www/ghanbari/anar/app/console:27
    0.0178    2896416   3. Symfony\Bundle\FrameworkBundle\Console\Application->doRun() /var/www/ghanbari/anar/vendor/symfony/symfony/src/Symfony/Component/Console/Application.php:126
    0.0178    2896640   4. Symfony\Component\HttpKernel\Kernel->boot() /var/www/ghanbari/anar/vendor/symfony/symfony/src/Symfony/Bundle/FrameworkBundle/Console/Application.php:70
    0.0210    3132184   5. Symfony\Component\HttpKernel\Kernel->initializeContainer() /var/www/ghanbari/anar/app/bootstrap.php.cache:2387
    0.0801    6683560   6. Symfony\Component\DependencyInjection\ContainerBuilder->compile() /var/www/ghanbari/anar/app/bootstrap.php.cache:2609
    0.0806    6716880   7. Symfony\Component\DependencyInjection\Compiler\Compiler->compile() /var/www/ghanbari/anar/vendor/symfony/symfony/src/Symfony/Component/DependencyInjection/ContainerBuilder.php:614
    0.0806    6725096   8. Symfony\Component\HttpKernel\DependencyInjection\MergeExtensionConfigurationPass->process() /var/www/ghanbari/anar/vendor/symfony/symfony/src/Symfony/Component/DependencyInjection/Compiler/Compiler.php:117
    0.0808    6730560   9. Symfony\Component\DependencyInjection\Compiler\MergeExtensionConfigurationPass->process() /var/www/ghanbari/anar/vendor/symfony/symfony/src/Symfony/Component/HttpKernel/DependencyInjection/MergeExtensionConfigurationPass.php:39
    0.2364   13801624  10. FOS\UserBundle\DependencyInjection\FOSUserExtension->load() /var/www/ghanbari/anar/vendor/symfony/symfony/src/Symfony/Component/DependencyInjection/Compiler/MergeExtensionConfigurationPass.php:55
    0.2388   14110096  11. Symfony\Component\DependencyInjection\Loader\XmlFileLoader->load() /var/www/ghanbari/anar/vendor/friendsofsymfony/user-bundle/DependencyInjection/FOSUserExtension.php:32
    0.2397   14111016  12. Symfony\Component\DependencyInjection\Loader\XmlFileLoader->parseDefinitions() /var/www/ghanbari/anar/vendor/symfony/symfony/src/Symfony/Component/DependencyInjection/Loader/XmlFileLoader.php:58
    0.2399   14115360  13. Symfony\Component\DependencyInjection\Loader\XmlFileLoader->parseDefinition() /var/www/ghanbari/anar/vendor/symfony/symfony/src/Symfony/Component/DependencyInjection/Loader/XmlFileLoader.php:119
    0.2399   14118016  14. Symfony\Component\DependencyInjection\Definition->setFactoryMethod() /var/www/ghanbari/anar/vendor/symfony/symfony/src/Symfony/Component/DependencyInjection/Loader/XmlFileLoader.php:153
    0.2399   14118352  15. trigger_error() /var/www/ghanbari/anar/vendor/symfony/symfony/src/Symfony/Component/DependencyInjection/Definition.php:137


Deprecated: The Symfony\Component\DependencyInjection\Definition::setFactoryService method is deprecated since version 2.6 and will be removed in 3.0. Use Definition::setFactory() instead. in /var/www/ghanbari/anar/vendor/symfony/symfony/src/Symfony/Component/DependencyInjection/Definition.php on line 208

Call Stack:
    0.0004     227656   1. {main}() /var/www/ghanbari/anar/app/console:0
    0.0161    2719288   2. Symfony\Component\Console\Application->run() /var/www/ghanbari/anar/app/console:27
    0.0178    2896416   3. Symfony\Bundle\FrameworkBundle\Console\Application->doRun() /var/www/ghanbari/anar/vendor/symfony/symfony/src/Symfony/Component/Console/Application.php:126
    0.0178    2896640   4. Symfony\Component\HttpKernel\Kernel->boot() /var/www/ghanbari/anar/vendor/symfony/symfony/src/Symfony/Bundle/FrameworkBundle/Console/Application.php:70
    0.0210    3132184   5. Symfony\Component\HttpKernel\Kernel->initializeContainer() /var/www/ghanbari/anar/app/bootstrap.php.cache:2387
    0.0801    6683560   6. Symfony\Component\DependencyInjection\ContainerBuilder->compile() /var/www/ghanbari/anar/app/bootstrap.php.cache:2609
    0.0806    6716880   7. Symfony\Component\DependencyInjection\Compiler\Compiler->compile() /var/www/ghanbari/anar/vendor/symfony/symfony/src/Symfony/Component/DependencyInjection/ContainerBuilder.php:614
    0.0806    6725096   8. Symfony\Component\HttpKernel\DependencyInjection\MergeExtensionConfigurationPass->process() /var/www/ghanbari/anar/vendor/symfony/symfony/src/Symfony/Component/DependencyInjection/Compiler/Compiler.php:117
    0.0808    6730560   9. Symfony\Component\DependencyInjection\Compiler\MergeExtensionConfigurationPass->process() /var/www/ghanbari/anar/vendor/symfony/symfony/src/Symfony/Component/HttpKernel/DependencyInjection/MergeExtensionConfigurationPass.php:39
    0.2364   13801624  10. FOS\UserBundle\DependencyInjection\FOSUserExtension->load() /var/www/ghanbari/anar/vendor/symfony/symfony/src/Symfony/Component/DependencyInjection/Compiler/MergeExtensionConfigurationPass.php:55
    0.2388   14110096  11. Symfony\Component\DependencyInjection\Loader\XmlFileLoader->load() /var/www/ghanbari/anar/vendor/friendsofsymfony/user-bundle/DependencyInjection/FOSUserExtension.php:32
    0.2397   14111016  12. Symfony\Component\DependencyInjection\Loader\XmlFileLoader->parseDefinitions() /var/www/ghanbari/anar/vendor/symfony/symfony/src/Symfony/Component/DependencyInjection/Loader/XmlFileLoader.php:58
    0.2399   14115360  13. Symfony\Component\DependencyInjection\Loader\XmlFileLoader->parseDefinition() /var/www/ghanbari/anar/vendor/symfony/symfony/src/Symfony/Component/DependencyInjection/Loader/XmlFileLoader.php:119
    0.2404   14118448  14. Symfony\Component\DependencyInjection\Definition->setFactoryService() /var/www/ghanbari/anar/vendor/symfony/symfony/src/Symfony/Component/DependencyInjection/Loader/XmlFileLoader.php:153
    0.2404   14118792  15. trigger_error() /var/www/ghanbari/anar/vendor/symfony/symfony/src/Symfony/Component/DependencyInjection/Definition.php:208

[2015-04-13 20:34:41] php.INFO: The Symfony\Component\DependencyInjection\Definition::setFactoryMethod method is deprecated since version 2.6 and will be removed in 3.0. Use Definition::setFactory() instead. {"type":16384,"file":"/var/www/ghanbari/anar/vendor/symfony/symfony/src/Symfony/Component/DependencyInjection/Definition.php","line":137,"level":-1,"stack":[{"function":"handleError","class":"Symfony\\Component\\Debug\\ErrorHandler","type":"->"},{"file":"/var/www/ghanbari/anar/vendor/symfony/symfony/src/Symfony/Component/DependencyInjection/Definition.php","line":137,"function":"trigger_error"},{"file":"/var/www/ghanbari/anar/vendor/symfony/symfony/src/Symfony/Component/DependencyInjection/Loader/XmlFileLoader.php","line":153,"function":"setFactoryMethod","class":"Symfony\\Component\\DependencyInjection\\Definition","type":"->"},{"file":"/var/www/ghanbari/anar/vendor/symfony/symfony/src/Symfony/Component/DependencyInjection/Loader/XmlFileLoader.php","line":119,"function":"parseDefinition","class":"Symfony\\Component\\DependencyInjection\\Loader\\XmlFileLoader","type":"->"},{"file":"/var/www/ghanbari/anar/vendor/symfony/symfony/src/Symfony/Component/DependencyInjection/Loader/XmlFileLoader.php","line":58,"function":"parseDefinitions","class":"Symfony\\Component\\DependencyInjection\\Loader\\XmlFileLoader","type":"->"},{"file":"/var/www/ghanbari/anar/vendor/symfony/symfony/src/Symfony/Bundle/FrameworkBundle/Command/ContainerDebugCommand.php","line":184,"function":"load","class":"Symfony\\Component\\DependencyInjection\\Loader\\XmlFileLoader","type":"->"},{"file":"/var/www/ghanbari/anar/vendor/symfony/symfony/src/Symfony/Bundle/FrameworkBundle/Command/ContainerDebugCommand.php","line":113,"function":"getContainerBuilder","class":"Symfony\\Bundle\\FrameworkBundle\\Command\\ContainerDebugCommand","type":"->"},{"file":"/var/www/ghanbari/anar/vendor/symfony/symfony/src/Symfony/Component/Console/Command/Command.php","line":259,"function":"execute","class":"Symfony\\Bundle\\FrameworkBundle\\Command\\ContainerDebugCommand","type":"->"},{"file":"/var/www/ghanbari/anar/vendor/symfony/symfony/src/Symfony/Component/Console/Application.php","line":886,"function":"run","class":"Symfony\\Component\\Console\\Command\\Command","type":"->"},{"file":"/var/www/ghanbari/anar/vendor/symfony/symfony/src/Symfony/Component/Console/Application.php","line":195,"function":"doRunCommand","class":"Symfony\\Component\\Console\\Application","type":"->"},{"file":"/var/www/ghanbari/anar/vendor/symfony/symfony/src/Symfony/Bundle/FrameworkBundle/Console/Application.php","line":96,"function":"doRun","class":"Symfony\\Component\\Console\\Application","type":"->"},{"file":"/var/www/ghanbari/anar/vendor/symfony/symfony/src/Symfony/Component/Console/Application.php","line":126,"function":"doRun","class":"Symfony\\Bundle\\FrameworkBundle\\Console\\Application","type":"->"},{"file":"/var/www/ghanbari/anar/app/console","line":27,"function":"run","class":"Symfony\\Component\\Console\\Application","type":"->"}]} 
[2015-04-13 20:34:41] php.INFO: The Symfony\Component\DependencyInjection\Definition::setFactoryService method is deprecated since version 2.6 and will be removed in 3.0. Use Definition::setFactory() instead. {"type":16384,"file":"/var/www/ghanbari/anar/vendor/symfony/symfony/src/Symfony/Component/DependencyInjection/Definition.php","line":208,"level":-1,"stack":[{"function":"handleError","class":"Symfony\\Component\\Debug\\ErrorHandler","type":"->"},{"file":"/var/www/ghanbari/anar/vendor/symfony/symfony/src/Symfony/Component/DependencyInjection/Definition.php","line":208,"function":"trigger_error"},{"file":"/var/www/ghanbari/anar/vendor/symfony/symfony/src/Symfony/Component/DependencyInjection/Loader/XmlFileLoader.php","line":153,"function":"setFactoryService","class":"Symfony\\Component\\DependencyInjection\\Definition","type":"->"},{"file":"/var/www/ghanbari/anar/vendor/symfony/symfony/src/Symfony/Component/DependencyInjection/Loader/XmlFileLoader.php","line":119,"function":"parseDefinition","class":"Symfony\\Component\\DependencyInjection\\Loader\\XmlFileLoader","type":"->"},{"file":"/var/www/ghanbari/anar/vendor/symfony/symfony/src/Symfony/Component/DependencyInjection/Loader/XmlFileLoader.php","line":58,"function":"parseDefinitions","class":"Symfony\\Component\\DependencyInjection\\Loader\\XmlFileLoader","type":"->"},{"file":"/var/www/ghanbari/anar/vendor/symfony/symfony/src/Symfony/Bundle/FrameworkBundle/Command/ContainerDebugCommand.php","line":184,"function":"load","class":"Symfony\\Component\\DependencyInjection\\Loader\\XmlFileLoader","type":"->"},{"file":"/var/www/ghanbari/anar/vendor/symfony/symfony/src/Symfony/Bundle/FrameworkBundle/Command/ContainerDebugCommand.php","line":113,"function":"getContainerBuilder","class":"Symfony\\Bundle\\FrameworkBundle\\Command\\ContainerDebugCommand","type":"->"},{"file":"/var/www/ghanbari/anar/vendor/symfony/symfony/src/Symfony/Component/Console/Command/Command.php","line":259,"function":"execute","class":"Symfony\\Bundle\\FrameworkBundle\\Command\\ContainerDebugCommand","type":"->"},{"file":"/var/www/ghanbari/anar/vendor/symfony/symfony/src/Symfony/Component/Console/Application.php","line":886,"function":"run","class":"Symfony\\Component\\Console\\Command\\Command","type":"->"},{"file":"/var/www/ghanbari/anar/vendor/symfony/symfony/src/Symfony/Component/Console/Application.php","line":195,"function":"doRunCommand","class":"Symfony\\Component\\Console\\Application","type":"->"},{"file":"/var/www/ghanbari/anar/vendor/symfony/symfony/src/Symfony/Bundle/FrameworkBundle/Console/Application.php","line":96,"function":"doRun","class":"Symfony\\Component\\Console\\Application","type":"->"},{"file":"/var/www/ghanbari/anar/vendor/symfony/symfony/src/Symfony/Component/Console/Application.php","line":126,"function":"doRun","class":"Symfony\\Bundle\\FrameworkBundle\\Console\\Application","type":"->"},{"file":"/var/www/ghanbari/anar/app/console","line":27,"function":"run","class":"Symfony\\Component\\Console\\Application","type":"->"}]} 
[container] Public services with tag templating.helper
 Service ID                   alias      Class name                                                      
 templating.helper.assets     assets     Symfony\Bundle\FrameworkBundle\Templating\Helper\AssetsHelper   
 templating.helper.logout_url logout_url Symfony\Bundle\SecurityBundle\Templating\Helper\LogoutUrlHelper 
 templating.helper.security   security   Symfony\Bundle\SecurityBundle\Templating\Helper\SecurityHelper  
like image 489
ghanbari Avatar asked Apr 13 '15 12:04

ghanbari


1 Answers

Update

The new 2.4.2 release for KnpPaginator will solve this issue. Your composer.json file should look like this:

"knplabs/knp-paginator-bundle": "~2.4"

Previous answer

If you're going to use the bleeding edge versions of Symfony, make sure you're using the latest versions of the required bundles in your project and run composer update. You may even need to use the dev-master versions.

This problem was fixed in January as per this commit.

For this particular issue, update your composer.json file to have this line:

"knplabs/knp-paginator-bundle": "2.4.*@dev"

and run composer update.

For future readers, you can pick any version later than 2.4.1. Currently, Knplabs has not yet released a version to track Symfony 2.7.

An alternative solution as outlined here is to add php to your framework templating engines configuration:

framework:
    templating:
        engines: ['twig', 'php']
like image 90
sjagr Avatar answered Oct 13 '22 20:10

sjagr