我想用使用本機查詢「As」子句來設置類屬性:Doctrine2本地查詢水化錯誤「爲」
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的註釋
,我得到一個錯誤:
Notice: Undefined index: area_int in /var/www/incra/vendor/doctrine/lib/Doctrine/ORM/Internal/Hydration/AbstractHydrator.php line 205
我的課:http://pastebin.com/jd3gcr93
使用本機,但「area_int」不要在數據庫表中的列,是PSQL函數的返回,我不想讓這個一列。我知道$ pontos,但這個值直接獲得數據庫,並驗證插入 –
verifield插入* –