Php ';错误:Class';搜索结果';未定义';在自定义查询中
我正在尝试从数据库中获取查询结果Php ';错误:Class';搜索结果';未定义';在自定义查询中,php,symfony,doctrine-orm,doctrine-query,Php,Symfony,Doctrine Orm,Doctrine Query,我正在尝试从数据库中获取查询结果 $em2 = $this->getDoctrine()->getManager(); $qb=$em2->createQuery('select count(DISTINCT hotel_id) FROM search_result where request_id=:searchId')->setParameter('searchId',$searchId); $result = $qb->getResult
$em2 = $this->getDoctrine()->getManager();
$qb=$em2->createQuery('select count(DISTINCT hotel_id) FROM search_result where request_id=:searchId')->setParameter('searchId',$searchId);
$result = $qb->getResult();
和获取错误:
第0行第37列“搜索结果”附近:错误:类“搜索结果”为
没有定义
DQL!==SQL
更改:
来自搜索结果
致:
来自AppBundle:SearchResult
不要查看表名,而是查看实体名。用您的真实实体名称替换AppBundle:SearchResult