我想使用使用'as'子句的本机查询来设置类属性:
public function findIntersects($id,$pontos){
$em = $this->getEntityManager();
$sql = "SELECT p.imovel,p.id,ST_Area(ST_Intersection(p.location,'POLYGON((".$pontos."))')) as area_int, ST_Area(p.location) as area from propriedades p where ST_Intersects(p.location,'POLYGON((".$pontos."))') and id !=:id";
$rsm = new ResultSetMapping;
$rsm->addEntityResult('Incra\PropriedadesBundle\Entity\Propriedades', 'o');
$rsm->addFieldResult('o', 'id', 'id');
$rsm->addFieldResult('o', 'imovel', 'imovel');
$rsm->addFieldResult('o', 'area_int', 'area_int');
$rsm->addFieldResult('o', 'area', 'area');
$qns = $this->_em->createNativeQuery($sql, $rsm);
$qns->setParameter("id", $id);
$qns->setParameter("pontos", $pontos);
return $qns->getResult();
}
我在我的班级中有这个属性,但没有 orm 的注释
我得到一个错误:
注意:未定义索引:/var/www/incra/vendor/doctrine/lib/Doctrine/ORM/Internal/Hydration/AbstractHydrator.php 第 205 行中的 area_int
我的课: http: //pastebin.com/jd3gcr93