本文整理匯總了PHP中common\models\Category::tableName方法的典型用法代碼示例。如果您正苦於以下問題:PHP Category::tableName方法的具體用法?PHP Category::tableName怎麽用?PHP Category::tableName使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類common\models\Category
的用法示例。
在下文中一共展示了Category::tableName方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: search
public function search($params)
{
$query = Category::find();
$dataProvider = new ActiveDataProvider(['query' => $query]);
$dataProvider->setSort(['defaultOrder' => ['updatedOn' => SORT_DESC]]);
$query->andFilterWhere([Category::tableName() . '.status' => '1']);
if (!($this->load($params) && $this->validate())) {
return $dataProvider;
}
$query->andFilterWhere(['Id' => $this->Id, 'createdBy' => $this->createdBy, 'updatedBy' => $this->updatedBy, 'createdOn' => $this->createdOn, 'updatedOn' => $this->updatedOn, 'status' => $this->status, 'parentId' => $this->parentId, 'is_fg' => $this->is_fg, 'is_event' => $this->is_event]);
$query->andFilterWhere(['like', 'name', $this->name])->andFilterWhere(['like', 'ip', $this->ip]);
return $dataProvider;
}
示例2: isShowInNav
/**
* 判斷顯示
* @param string $type
* @param integer $id
*/
public static function isShowInNav($type, $id)
{
if ($type == 'c') {
$tablename = Category::tableName();
} else {
$tablename = ArticleCat::tableName();
}
$conn = \Yii::$app->getDb();
return $conn->createCommand("SELECT show_in_nav FROM " . $tablename . " WHERE id={$id}")->queryScalar();
}
示例3: getCategoryCountTotalSql
public static function getCategoryCountTotalSql()
{
$param = self::CATEGOTY_COUNT_TOTAL;
$categoryTable = Category::tableName();
return $sql = <<<SQL
select '{$param}' as param, count(*) as value from {$categoryTable} where active = 1
SQL;
return null;
}