Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/245.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
需要了解CakePHP中finderQuery的用法_Php_Cakephp_Model Associations - Fatal编程技术网

需要了解CakePHP中finderQuery的用法

需要了解CakePHP中finderQuery的用法,php,cakephp,model-associations,Php,Cakephp,Model Associations,有人能解释一下finderQuery在这里做什么吗?我已经阅读了Cake的文档,但不知怎的,我无法将其与此联系起来。蒂亚 $this->Post->bindModel ( array ( 'belongsTo' => array ( 'Person' => array

有人能解释一下finderQuery在这里做什么吗?我已经阅读了Cake的文档,但不知怎的,我无法将其与此联系起来。蒂亚

$this->Post->bindModel
        (
          array
          (
            'belongsTo' => array
                           (
                             'Person' => array
                                          (
                                            'className' => 'Person',
                                            'foreignKey' => 'person_id'
                                          )
                           ),
            'hasMany' => array
                           (
                             'PostGroup' => array
                                            (
                                              'className' => 'PostGroup',
                                              'foreignKey' => 'post_id',

                                              'conditions' => array('PostGroup.status' => 'active'),

                                              'finderQuery' => 'SELECT count(PostGroup.id) as no_of_groups, PostGroup.post_id
                                                               from post_groups as PostGroup
                                                               WHERE PostGroup.post_id in ({$__cakeID__$})
                                                               GROUP BY PostGroup.post_id'
                                            )
                           )
          )
        );