[英]Is there a way to get assembled query by Phalcon\Mvc\Model\Criteria?
I've not found here how we can get builded query by Phalcon\\Mvc\\Model\\Criteria in docs: http://docs.phalconphp.com/en/latest/api/Phalcon_Mvc_Model_Criteria.html 我在这里找不到如何通过文档中的Phalcon \\ Mvc \\ Model \\ Criteria来构建查询: http : //docs.phalconphp.com/en/latest/api/Phalcon_Mvc_Model_Criteria.html
Is it possible? 可能吗?
Phalcon\\Mvc\\Model\\Criteria builds an array of valid parameters for SomeModel::find, or SomeModel::findFirst, this class does not build a real query. Phalcon \\ Mvc \\ Model \\ Criteria为SomeModel :: find或SomeModel :: findFirst构建一个有效参数数组,此类不构建实际查询。
Furthermore, we have Phalcon\\Mvc\\Query\\Builder this class has the ability to build PHQL queries: 此外,我们有Phalcon \\ Mvc \\ Query \\ Builder这个类有能力构建PHQL查询:
<?php
//Get the PHQL to be generated
$phql = $this->modelsManager->createBuilder()
->from('Robots')
->limit(20);
->order('Robots.name')
->getPhql();
//Execute the query
$robots = $this->modelsManager->createBuilder()
->from('Robots')
->limit(20);
->order('Robots.name')
->getQuery()
->execute();
More info: http://docs.phalconphp.com/en/latest/reference/phql.html#creating-queries-using-the-query-builder 更多信息: http : //docs.phalconphp.com/en/latest/reference/phql.html#creating-queries-using-the-query-builder
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.