【发布时间】:2013-12-03 14:32:30
【问题描述】:
实体:
class Pharmacie{
public $distance;
public function getDistance() {
// calculate distance here
return $distance;
}
}
在控制器中:
public function listePharmsGeoAction()
{
$em = $this->getDoctrine()->getEntityManager();
$pharmas = $em->getRepository('CentraleFrontBundle:Pharmacie')
->createQueryBuilder('o')
->orderBy('o.distance','ASC')
->getQuery()
->getResult();
return $this->render('CentraleFrontBundle:SiteFront:listePharms.html.twig', array(
'pharmas' => $pharmas));
}
错误:[语义错误] line 0, col 65 near 'distance ASC':错误:Class Centrale\FrontBundle\Entity\Pharmacie 没有名为 distance 的字段或关联
【问题讨论】:
-
您的 Pharmacie 实体中没有距离属性...问题是什么?
标签: symfony doctrine-orm entitymanager