我有一个曾经在symfony 2.8下工作的项目但是当我升级到symfony 3.2时我得到了这个错误
Unknown argument "absolute" for function "asset_version(path, package_name)".
这是堆栈跟踪
Twig_Error_Syntax: Unknown argument "absolute" for function "asset_version(path, package_name)".
at n/a
in C:\wamp\www\Syslife_upgrade\src\MamdaIT\ComptabiliteBundle/Resources/views/Comptabilite/individuel/editionDetailCotisation.html.twig line 5
at Twig_Node_Expression_Call->getArguments(array(object(AssetExtension), 'getAssetVersion'), object(Twig_Node))
in C:\wamp\www\Syslife_upgrade\vendor\twig\twig\lib\Twig\Node\Expression\Call.php line 88
at Twig_Node_Expression_Call->compileArguments(object(Twig_Compiler))
in C:\wamp\www\Syslife_upgrade\vendor\twig\twig\lib\Twig\Node\Expression\Call.php line 41
at Twig_Node_Expression_Call->compileCallable(object(Twig_Compiler))
in C:\wamp\www\Syslife_upgrade\vendor\twig\twig\lib\Twig\Node\Expression\Function.php line 41
at Twig_Node_Expression_Function->compile(object(Twig_Compiler))
in C:\wamp\www\Syslife_upgrade\vendor\twig\twig\lib\Twig\Compiler.php line 98
at Twig_Compiler->subcompile(object(Twig_Node_Expression_Function))
in C:\wamp\www\Syslife_upgrade\vendor\twig\twig\lib\Twig\Node\Expression\Binary.php line 29
at Twig_Node_Expression_Binary->compile(object(Twig_Compiler))
in C:\wamp\www\Syslife_upgrade\vendor\twig\twig\lib\Twig\Compiler.php line 98
at Twig_Compiler->subcompile(object(Twig_Node_Expression_Binary_Concat))
in C:\wamp\www\Syslife_upgrade\vendor\twig\twig\lib\Twig\Node\Expression\Call.php line 81
at Twig_Node_Expression_Call->compileArguments(object(Twig_Compiler))
in C:\wamp\www\Syslife_upgrade\vendor\twig\twig\lib\Twig\Node\Expression\Call.php line 41
at Twig_Node_Expression_Call->compileCallable(object(Twig_Compiler))
in C:\wamp\www\Syslife_upgrade\vendor\twig\twig\lib\Twig\Node\Expression\Filter.php line 37
at Twig_Node_Expression_Filter->compile(object(Twig_Compiler))
in C:\wamp\www\Syslife_upgrade\vendor\twig\twig\lib\Twig\Compiler.php line 98
at Twig_Compiler->subcompile(object(Twig_Node_Expression_Filter))
in C:\wamp\www\Syslife_upgrade\vendor\twig\twig\lib\Twig\Node\Print.php line 30
at Twig_Node_Print->compile(object(Twig_Compiler))
in C:\wamp\www\Syslife_upgrade\vendor\twig\twig\lib\Twig\Node.php line 117
at Twig_Node->compile(object(Twig_Compiler))
in C:\wamp\www\Syslife_upgrade\vendor\twig\twig\lib\Twig\Node.php line 117
at Twig_Node->compile(object(Twig_Compiler))
in C:\wamp\www\Syslife_upgrade\vendor\twig\twig\lib\Twig\Compiler.php line 98
at Twig_Compiler->subcompile(object(Twig_Node_Body))
in C:\wamp\www\Syslife_upgrade\vendor\twig\twig\lib\Twig\Node\Module.php line 301
at Twig_Node_Module->compileDisplay(object(Twig_Compiler))
in C:\wamp\www\Syslife_upgrade\vendor\twig\twig\lib\Twig\Node\Module.php line 99
at Twig_Node_Module->compileTemplate(object(Twig_Compiler))
in C:\wamp\www\Syslife_upgrade\vendor\twig\twig\lib\Twig\Node\Module.php line 71
at Twig_Node_Module->compile(object(Twig_Compiler))
in C:\wamp\www\Syslife_upgrade\vendor\twig\twig\lib\Twig\Compiler.php line 87
at Twig_Compiler->compile(object(Twig_Node_Module))
in C:\wamp\www\Syslife_upgrade\var\cache\dev\classes.php line 5432
at Twig_Environment->compile(object(Twig_Node_Module))
in C:\wamp\www\Syslife_upgrade\var\cache\dev\classes.php line 5441
at Twig_Environment->compileSource(object(Twig_Source))
in C:\wamp\www\Syslife_upgrade\var\cache\dev\classes.php line 5286
at Twig_Environment->loadTemplate('ComptabiliteBundle:Comptabilite:individuel/editionDetailCotisation.html.twig')
in C:\wamp\www\Syslife_upgrade\vendor\symfony\symfony\src\Symfony\Bridge\Twig\TwigEngine.php line 126
at Symfony\Bridge\Twig\TwigEngine->load('ComptabiliteBundle:Comptabilite:individuel/editionDetailCotisation.html.twig')
in C:\wamp\www\Syslife_upgrade\vendor\symfony\symfony\src\Symfony\Bridge\Twig\TwigEngine.php line 50
at Symfony\Bridge\Twig\TwigEngine->render('ComptabiliteBundle:Comptabilite:individuel/editionDetailCotisation.html.twig', array('exercices' => array('2014', 2015, 2016, 2017), 'cotisations' => array(object(CotisationIndividuelle), object(CotisationIndividuelle), object(CotisationIndividuelle), object(CotisationIndividuelle), object(CotisationIndividuelle), object(CotisationIndividuelle), object(CotisationIndividuelle)), 'contrat' => object(RetraiteContrat)))
in C:\wamp\www\Syslife_upgrade\vendor\symfony\symfony\src\Symfony\Bundle\TwigBundle\TwigEngine.php line 50
at Symfony\Bundle\TwigBundle\TwigEngine->render('ComptabiliteBundle:Comptabilite:individuel/editionDetailCotisation.html.twig', array('exercices' => array('2014', 2015, 2016, 2017), 'cotisations' => array(object(CotisationIndividuelle), object(CotisationIndividuelle), object(CotisationIndividuelle), object(CotisationIndividuelle), object(CotisationIndividuelle), object(CotisationIndividuelle), object(CotisationIndividuelle)), 'contrat' => object(RetraiteContrat)))
in C:\wamp\www\Syslife_upgrade\vendor\symfony\symfony\src\Symfony\Bundle\FrameworkBundle\Controller\Controller.php line 213
at Symfony\Bundle\FrameworkBundle\Controller\Controller->renderView('ComptabiliteBundle:Comptabilite:individuel/editionDetailCotisation.html.twig', array('exercices' => array('2014', 2015, 2016, 2017), 'cotisations' => array(object(CotisationIndividuelle), object(CotisationIndividuelle), object(CotisationIndividuelle), object(CotisationIndividuelle), object(CotisationIndividuelle), object(CotisationIndividuelle), object(CotisationIndividuelle)), 'contrat' => object(RetraiteContrat)))
in C:\wamp\www\Syslife_upgrade\src\MamdaIT\ComptabiliteBundle\Controller\ComptabiliteController.php line 706
at MamdaIT\ComptabiliteBundle\Controller\ComptabiliteController->editionDetailCotisation(object(Request), '1194')
in line
at call_user_func_array(array(object(ComptabiliteController), 'editionDetailCotisation'), array(object(Request), '1194'))
in C:\wamp\www\Syslife_upgrade\var\cache\dev\classes.php line 4229
at Symfony\Component\HttpKernel\HttpKernel->handleRaw(object(Request), 1)
in C:\wamp\www\Syslife_upgrade\var\cache\dev\classes.php line 4184
at Symfony\Component\HttpKernel\HttpKernel->handle(object(Request), 1, true)
in C:\wamp\www\Syslife_upgrade\vendor\symfony\symfony\src\Symfony\Component\HttpKernel\Kernel.php line 168
at Symfony\Component\HttpKernel\Kernel->handle(object(Request))
in C:\wamp\www\Syslife_upgrade\web\app_dev.php line 29
最后,我的代码中的行会抛出此异常
<link rel="stylesheet" type="text/css"
href="{{ app.request.schemeAndHttpHost ~ asset('bootstrap/css/bootstrap.css', absolute=true) }}">
<link rel="stylesheet" type="text/css"
href="{{ app.request.schemeAndHttpHost ~ asset('assets/css/style.css' , absolute=true) }}">
<link rel="stylesheet" type="text/css"
href="{{ app.request.schemeAndHttpHost ~ asset('assets/css/bootstrap.min.css', absolute=true) }}"/>
<link rel="stylesheet" type="text/css"
href="{{ app.request.schemeAndHttpHost ~ asset('assets/css/AdminLTE.min.css', absolute=true) }}"/>
有谁知道如何解决这个问题?