我的数据库中只有1行,当我将此代码放到AnnouncementController上时,我有一个500错误页面。
public function search(AnnouncesRepository $announcesRepository){
$announces = $announcesRepository->findAll();
return $this->render('announces/search.html.twig', ['announces' => $announces]);
}
日志:
2019-01-22T12:47:53+00:00 [info] Matched route "announcement_search".
2019-01-22T12:47:53+00:00 [debug] Notified event "kernel.request" to listener "Symfony\Component\HttpKernel\EventListener\DebugHandlersListener::configure".
2019-01-22T12:47:53+00:00 [debug] Notified event "kernel.request" to listener "Symfony\Component\HttpKernel\EventListener\ValidateRequestListener::onKernelRequest".
2019-01-22T12:47:53+00:00 [debug] Notified event "kernel.request" to listener "Symfony\Component\HttpKernel\EventListener\SessionListener::onKernelRequest".
2019-01-22T12:47:53+00:00 [debug] Notified event "kernel.request" to listener "Symfony\Component\HttpKernel\EventListener\RouterListener::onKernelRequest".
2019-01-22T12:47:53+00:00 [debug] Notified event "kernel.request" to listener "Symfony\Bundle\FrameworkBundle\EventListener\ResolveControllerNameSubscriber::onKernelRequest".
2019-01-22T12:47:53+00:00 [debug] Notified event "kernel.request" to listener "Symfony\Component\HttpKernel\EventListener\LocaleListener::onKernelRequest".
2019-01-22T12:47:53+00:00 [debug] Notified event "kernel.controller" to listener "Sensio\Bundle\FrameworkExtraBundle\EventListener\ControllerListener::onKernelController".
2019-01-22T12:47:53+00:00 [debug] Notified event "kernel.controller" to listener "Sensio\Bundle\FrameworkExtraBundle\EventListener\ParamConverterListener::onKernelController".
2019-01-22T12:47:53+00:00 [debug] Notified event "kernel.controller" to listener "Sensio\Bundle\FrameworkExtraBundle\EventListener\HttpCacheListener::onKernelController".
2019-01-22T12:47:53+00:00 [debug] Notified event "kernel.controller" to listener "Sensio\Bundle\FrameworkExtraBundle\EventListener\TemplateListener::onKernelController".
2019-01-22T12:47:53+00:00 [debug] Notified event "kernel.controller_arguments" to listener "Sensio\Bundle\FrameworkExtraBundle\EventListener\IsGrantedListener::onKernelControllerArguments".
2019-01-22T12:47:53+00:00 [debug] SELECT t0.id AS id_1, t0.society_id AS society_id_2, t0.job AS job_3, t0.city AS city_4, t0.desired_city AS desired_city_5, t0.slug AS slug_6, t0.user_id AS user_id_7, t0.created AS created_8, t0.description AS description_9, t
0.user_id AS user_id_10 FROM announces t0
[Tue Jan 22 13:47:54 2019] 127.0.0.1:56133 [500]: /rechercher - Allowed memory size of 134217728 bytes exhausted (tried to allocate 65028096 bytes) in C:\wamp64\www\permutation\permutation\vendor\twig\twig\lib\Twig\Extension\Debug.php on line 50
2019-01-22T12:47:54+00:00 [critical] Fatal Error: Allowed memory size of 134217728 bytes exhausted (tried to allocate 65028096 bytes)
它仅在我使用find($ id)或findOne时有效。
感谢帮助!
编辑:
{% for announce in announces %} {{ dump(announce) }} {% endfor %}
我清除了缓存,是的,增加内存并不是一个好主意,我只有1行!在我的模板中,我也尝试了转储宣布,但我有同样的错误。如果删除转储,则有任何错误。
答案 0 :(得分:0)
公共功能搜索(AnnouncesRepository $ announcesRepository){
$ npm install --global mup
}
或php.ini-> memory_limit = 1024M