common/models/search/PostComment.php
/**
     * Creates data provider instance with search query applied
     *
     * @param array $params
     *
     * @param int $posttype Post type ID
     * @param int|null $post Post ID
     * @return ActiveDataProvider
     */
Creates data provider instance with search query applied
@param array $params

@param int $posttype Post type ID
@param int|null $post Post ID
@return ActiveDataProvider
Creates data provider instance with search query applied @param array $params @param int $posttype Post type ID @param int|null $post Post ID @return ActiveDataProvider
public function search($params, $posttype, $post = null)
    {
        $query = PostCommentModel::find();
        $query->innerJoinWith([
            'commentPost' => function ($query) {
                return $query->from(['post' => Post::tableName()]);
            },
        ])->from(['postComment' => PostComment::tableName()]);
        $query->andWhere(['post.type' => $posttype]);
        if ($post) {
            $query->andWhere(['post.id' => $post]);
        }
        $dataProvider = new ActiveDataProvider([
            'query' => $query,
            'sort' => [
                'defaultOrder' => [
                    'id' => SORT_DESC,
                ],
            ],
        ]);
        $this->load($params);
        if (!$this->validate()) {
            return $dataProvider;
        }
        $query->andFilterWhere([
            'id' => $this->id,
            'post_id' => $this->post_id,
            'parent' => $this->parent,
            'user_id' => $this->user_id,
        ]);
        $query->andFilterWhere(['like', 'postComment.author', $this->author])
            ->andFilterWhere(['like', 'email', $this->email])
            ->andFilterWhere(['like', 'url', $this->url])
            ->andFilterWhere(['like', 'ip', $this->ip])
            ->andFilterWhere(['like', 'postComment.content', $this->content])
            ->andFilterWhere(['like', 'postComment.status', $this->status])
            ->andFilterWhere(['like', 'agent', $this->agent])
            ->andFilterWhere(['like', 'postComment.date', $this->date])
            ->andFilterWhere(['like', 'post.title', $this->post_title]);
        return $dataProvider;
    }
public function search ( $ params , $ posttype , $ post = null ) { $ query = PostCommentModel :: find ( ) ; $ query -> innerJoinWith ( [ 'commentPost' => function ( $ query ) { return $ query -> from ( [ 'post' => Post :: tableName ( ) ] ) ; } , ] ) -> from ( [ 'postComment' => PostComment :: tableName ( ) ] ) ; $ query -> andWhere ( [ 'post.type' => $ posttype ] ) ; if ( $ post ) { $ query -> andWhere ( [ 'post.id' => $ post ] ) ; } $ dataProvider = new ActiveDataProvider ( [ 'query' => $ query , 'sort' => [ 'defaultOrder' => [ 'id' => SORT_DESC , ] , ] , ] ) ; $ this -> load ( $ params ) ; if ( ! $ this -> validate ( ) ) { return $ dataProvider ; } $ query -> andFilterWhere ( [ 'id' => $ this -> id , 'post_id' => $ this -> post_id , 'parent' => $ this -> parent , 'user_id' => $ this -> user_id , ] ) ; $ query -> andFilterWhere ( [ 'like' , 'postComment.author' , $ this -> author ] ) -> andFilterWhere ( [ 'like' , 'email' , $ this -> email ] ) -> andFilterWhere ( [ 'like' , 'url' , $ this -> url ] ) -> andFilterWhere ( [ 'like' , 'ip' , $ this -> ip ] ) -> andFilterWhere ( [ 'like' , 'postComment.content' , $ this -> content ] ) -> andFilterWhere ( [ 'like' , 'postComment.status' , $ this -> status ] ) -> andFilterWhere ( [ 'like' , 'agent' , $ this -> agent ] ) -> andFilterWhere ( [ 'like' , 'postComment.date' , $ this -> date ] ) -> andFilterWhere ( [ 'like' , 'post.title' , $ this -> post_title ] ) ; return $ dataProvider ; }
Creates data provider instance with search query applied
 @param array $params
Creates data provider instance with search query applied @param array $params
/* @var $query \yii\db\ActiveQuery */