当路由具有查询字符串时,Symfony中的ResourceNotFoundException

时间:2015-11-18 01:45:32

标签: php symfony symfony-forms symfony-routing

奇怪的问题

所以在我的管理包中,我有这样的路线:

/**
 * @Route("/media")
 *
 * Class MediaController
 * @package AdminBundle\Controller
 */
class MediaController extends Controller
{

    /**
     * @Route("", name="media_home")
     */
    public function indexAction()
    { 
        // cool stuff happens here
    }
}  

这在访问/media

页面时效果很好

除了向路径添加查询字符串外。像这样:/media?q=searchTest。事实上,当我在管理包中的任何路线上执行此操作时,它总是返回ResourceNotFoundException

这是纯文本堆栈跟踪

[1] Symfony\Component\Routing\Exception\ResourceNotFoundException: 
    at n/a
        in /var/www/myfunapp/app/cache/dev_admin/appDev_adminUrlMatcher.php line 378

    at appDev_adminUrlMatcher->match('/media?q=searchText')
        in /var/www/myfunapp/app/cache/dev_admin/classes.php line 3378

    at Symfony\Component\Routing\Router->match('/media?q=searchText')
        in /var/www/myfunapp/src/AdminBundle/Listeners/AuthListener.php line 28

    at AdminBundle\Listeners\AuthListener->onKernelRequest(object(GetResponseEvent), 'kernel.request', object(TraceableEventDispatcher))
        in  line 

    at call_user_func(array(object(AuthListener), 'onKernelRequest'), object(GetResponseEvent), 'kernel.request', object(TraceableEventDispatcher))
        in /var/www/myfunapp/vendor/symfony/symfony/src/Symfony/Component/EventDispatcher/Debug/WrappedListener.php line 61

    at Symfony\Component\EventDispatcher\Debug\WrappedListener->__invoke(object(GetResponseEvent), 'kernel.request', object(ContainerAwareEventDispatcher))
        in  line 

    at call_user_func(object(WrappedListener), object(GetResponseEvent), 'kernel.request', object(ContainerAwareEventDispatcher))
        in /var/www/myfunapp/app/cache/dev_admin/classes.php line 4001

    at Symfony\Component\EventDispatcher\EventDispatcher->doDispatch(array(object(WrappedListener), object(WrappedListener), object(WrappedListener), object(WrappedListener), object(WrappedListener), object(WrappedListener), object(WrappedListener), object(WrappedListener), object(WrappedListener), object(WrappedListener), object(WrappedListener), object(WrappedListener)), 'kernel.request', object(GetResponseEvent))
        in /var/www/myfunapp/app/cache/dev_admin/classes.php line 3934

    at Symfony\Component\EventDispatcher\EventDispatcher->dispatch('kernel.request', object(GetResponseEvent))
        in /var/www/myfunapp/app/cache/dev_admin/classes.php line 4095

    at Symfony\Component\EventDispatcher\ContainerAwareEventDispatcher->dispatch('kernel.request', object(GetResponseEvent))
        in /var/www/myfunapp/vendor/symfony/symfony/src/Symfony/Component/EventDispatcher/Debug/TraceableEventDispatcher.php line 124

    at Symfony\Component\EventDispatcher\Debug\TraceableEventDispatcher->dispatch('kernel.request', object(GetResponseEvent))
        in /var/www/myfunapp/app/bootstrap.php.cache line 3098

    at Symfony\Component\HttpKernel\HttpKernel->handleRaw(object(Request), '1')
        in /var/www/myfunapp/app/bootstrap.php.cache line 3071

    at Symfony\Component\HttpKernel\HttpKernel->handle(object(Request), '1', true)
        in /var/www/myfunapp/app/bootstrap.php.cache line 3222

    at Symfony\Component\HttpKernel\DependencyInjection\ContainerAwareHttpKernel->handle(object(Request), '1', true)
        in /var/www/myfunapp/app/bootstrap.php.cache line 2444

    at Symfony\Component\HttpKernel\Kernel->handle(object(Request))
        in /var/www/myfunapp/web/app_dev_admin.php line 30

POST工作正常,但查询字符串根本不会出于任何原因。

有什么想法吗?

0 个答案:

没有答案