douzhantao2857 2015-11-18 01:45
浏览 114

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

Odd issue

So in my administration bundle, I have routes like this:

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

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

and this works great when accessing the page at /media

EXCEPT when I add a query string to the route. Like this: /media?q=searchTest. In fact when i do this to ANY route in my admin bundle, it always comes back with a ResourceNotFoundException

Here's the plain text stacktrace

[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 works, but Query strings simply will not for whatever reason.

Any ideas?

  • 写回答

0条回答 默认 最新

    报告相同问题?

    悬赏问题

    • ¥15 装 pytorch 的时候出了好多问题,遇到这种情况怎么处理?
    • ¥20 IOS游览器某宝手机网页版自动立即购买JavaScript脚本
    • ¥15 手机接入宽带网线,如何释放宽带全部速度
    • ¥30 关于#r语言#的问题:如何对R语言中mfgarch包中构建的garch-midas模型进行样本内长期波动率预测和样本外长期波动率预测
    • ¥15 ETLCloud 处理json多层级问题
    • ¥15 matlab中使用gurobi时报错
    • ¥15 这个主板怎么能扩出一两个sata口
    • ¥15 不是,这到底错哪儿了😭
    • ¥15 2020长安杯与连接网探
    • ¥15 关于#matlab#的问题:在模糊控制器中选出线路信息,在simulink中根据线路信息生成速度时间目标曲线(初速度为20m/s,15秒后减为0的速度时间图像)我想问线路信息是什么