tableName() public static méthode

public static tableName ( )
 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;
 }
Exemple #2
0
 /**
  * 判断显示
  * @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();
 }
    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;
    }