0
什么是Doctrine 2相当于MySQL函数的DQL函数st_within
?什么是相当于MySQL函数的Doctrine 2 DQL函数st_within
我确实需要此功能,因为我正在运行此DQL查询时,下面这个错误:
[Syntax Error] line 0, col 165: Error: Expected known function, got 'ST_Within'
我试图运行的DQL是:
public function getAdsInBounds($numberPerPage,$page){
$qb = $this->em->createQueryBuilder()
->select("m")
->from($this->getEntityClassName(), "m")
->where("ST_Within(point(m.lng, m.lat), envelope(linestring(point(10.090792984008772,36.83717099338201), point(10.310519546508772,36.749467295867646)))")
->orderBy("m.date", "DESC");
return new Paginator($qb->getQuery()->setFirstResult(($page-1) * $numberPerPage)
->setMaxResults($numberPerPage));
}
FYI MySQL的查询完美工作并返回预期结果。
感谢,
主义并不支持这种说法,也没有任何公开的存储库你可以使用它。你需要自己实现一个自定义函数:https://github.com/mapado/MysqlDoctrineFunctions这个包已经实现了mysql的自定义函数,你可以从那里开始。对于空间函数有一个bug的包我没有找到st_within语句:https://github.com/creof/doctrine2-spatial –
谢谢@CarlosDelgado我会检查他们两个;) –