本文整理汇总了PHP中app\models\Article::tableName方法的典型用法代码示例。如果您正苦于以下问题:PHP Article::tableName方法的具体用法?PHP Article::tableName怎么用?PHP Article::tableName使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类app\models\Article
的用法示例。
在下文中一共展示了Article::tableName方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: search
/**
* Creates data provider instance with search query applied
*
* @param array $params
*
* @return ActiveDataProvider
*/
public function search($params)
{
$query = ArticleSearch::find();
$query->joinWith(['category']);
$dataProvider = new ActiveDataProvider(['query' => $query]);
$this->load($params);
if (!$this->validate()) {
return $dataProvider;
}
$dataProvider->sort->attributes['category_title'] = ['asc' => [Category::tableName() . '.title' => SORT_ASC], 'desc' => [Category::tableName() . '.title' => SORT_DESC]];
$query->andFilterWhere(['id' => $this->id, Article::tableName() . '.is_active' => $this->is_active, 'is_comment_enabled' => $this->is_comment_enabled, 'category_id' => $this->category_id, 'timestamp' => $this->timestamp]);
$query->andFilterWhere(['like', 'title', $this->title])->andFilterWhere(['like', Category::tableName() . '.title', $this->category_title])->andFilterWhere(['like', 'html_title', $this->html_title])->andFilterWhere(['like', 'description', $this->description])->andFilterWhere(['like', 'content', $this->content])->andFilterWhere(['like', 'key_words', $this->key_words]);
return $dataProvider;
}