DQL のみに奇妙なバグがあり、リポジトリ クエリが機能します。prod 環境に移動すると、両方のクエリが localhost で機能します。
$entity = $em->getRepository('PanasonicTestEtAvisBundle:Review')->findAll();
これは機能します。
$entity = $em->createQuery('SELECT t.id FROM PanasonicTestEtAvisBundle:Review t')->getResult();
これは次のエラーで失敗します。
Parse error: syntax error, unexpected $end in /home/sites_web/client/xxx/vendor/doctrine/lib/Doctrine/ORM/Query/Parser.php on line 1660
行 1660 には次のものがあります。
if ($this->_isAggregateFunction($this->_lexer->lookahead['type'])) {
return $this->AggregateExpression();
} else {
return $this->FunctionDeclaration();
}
私のログ:
[2012-05-09 14:04:49] event.DEBUG: Notified event "kernel.request" to listener "Symfony\Component\HttpKernel\EventListener\ProfilerListener::onKernelRequest". [] []
[2012-05-09 14:04:49] event.DEBUG: Notified event "kernel.request" to listener "Symfony\Bundle\FrameworkBundle\EventListener\RouterListener::onEarlyKernelRequest". [] []
[2012-05-09 14:04:49] event.DEBUG: Notified event "kernel.request" to listener "Symfony\Bundle\FrameworkBundle\EventListener\SessionListener::onKernelRequest". [] []
[2012-05-09 14:04:49] event.DEBUG: Notified event "kernel.request" to listener "Symfony\Component\Security\Http\Firewall::onKernelRequest". [] []
[2012-05-09 14:04:49] security.DEBUG: Read SecurityContext from the session [] []
[2012-05-09 14:04:49] security.DEBUG: Reloading user from user provider. [] []
[2012-05-09 14:04:49] security.DEBUG: Username "user" was reloaded from user provider. [] []
[2012-05-09 14:04:49] event.DEBUG: Notified event "kernel.request" to listener "Symfony\Bundle\FrameworkBundle\EventListener\RouterListener::onKernelRequest". [] []
[2012-05-09 14:04:49] request.INFO: Matched route "review_edit" (parameters: "_controller": "Panasonic\TestEtAvisBundle\Controller\BOReviewController::editAction", "id": "1", "productid": "1", "_route": "review_edit") [] []
[2012-05-09 14:04:49] event.DEBUG: Notified event "kernel.request" to listener "Symfony\Bundle\AsseticBundle\EventListener\RequestListener::onKernelRequest". [] []
[2012-05-09 14:04:49] event.DEBUG: Notified event "kernel.request" to listener "Knp\Bundle\PaginatorBundle\Subscriber\SlidingPaginationSubscriber::onKernelRequest". [] []
[2012-05-09 14:04:49] event.DEBUG: Notified event "kernel.controller" to listener "Symfony\Bundle\FrameworkBundle\DataCollector\RequestDataCollector::onKernelController". [] []
[2012-05-09 14:04:49] event.DEBUG: Notified event "kernel.controller" to listener "Sensio\Bundle\FrameworkExtraBundle\EventListener\ControllerListener::onKernelController". [] []
[2012-05-09 14:04:49] event.DEBUG: Notified event "kernel.controller" to listener "Sensio\Bundle\FrameworkExtraBundle\EventListener\ParamConverterListener::onKernelController". [] []
[2012-05-09 14:04:49] event.DEBUG: Notified event "kernel.controller" to listener "Sensio\Bundle\FrameworkExtraBundle\EventListener\TemplateListener::onKernelController". [] []
[2012-05-09 14:04:49] event.DEBUG: Notified event "kernel.controller" to listener "Acme\DemoBundle\ControllerListener::onKernelController". [] []
[2012-05-09 14:04:49] event.DEBUG: Notified event "kernel.controller" to listener "JMS\SecurityExtraBundle\Controller\ControllerListener::onCoreController". [] []
knp ページネーション バンドルや結合などで使用するクエリを取得するには、最終的に DQL を使用する必要があります。