douqiu1604 2012-12-18 04:18
浏览 62
已采纳

有没有办法通过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

Is it possible?

  • 写回答

1条回答 默认 最新

  • douliao5467 2012-12-18 05:52
    关注

    Phalcon\Mvc\Model\Criteria builds an array of valid parameters for SomeModel::find, or SomeModel::findFirst, this class does not build a real query.

    Furthermore, we have Phalcon\Mvc\Query\Builder this class has the ability to build PHQL queries:

    <?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

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 如何用Thoony写ESP32温湿度检测无源蜂鸣器报警代码?
  • ¥20 部件内部的CT图像数据集
  • ¥15 Visual studio调用动态库
  • ¥15 双目摄像头标定后的校准文件
  • ¥15 powerbi矩阵增加度量值后出现对应关系错乱
  • ¥30 频率分析法分析绘制奈奎斯特图、波特图
  • ¥15 弹出来一万个系统找不到指定的文件框框,怎么解决
  • ¥15 ADS生成的微带线为什么是蓝色空心的
  • ¥15 求一下解题思路,完全不懂
  • ¥15 tensorflow