skeeks\cms\models\CmsContentElementTree::tableName PHP Method

tableName() public static method

public static tableName ( )
    public static function tableName()
    {
        return '{{%cms_content_element_tree}}';
    }

Usage Example

 public function search($params)
 {
     $tableName = $this->tableName();
     $activeDataProvider = new ActiveDataProvider(['query' => static::find()]);
     if (!$this->load($params)) {
         return $activeDataProvider;
     }
     $query = $activeDataProvider->query;
     //Standart
     if ($columns = $this->getTableSchema()->columns) {
         /**
          * @var \yii\db\ColumnSchema $column
          */
         foreach ($columns as $column) {
             if ($column->phpType == "integer") {
                 $query->andFilterWhere([$this->tableName() . '.' . $column->name => $this->{$column->name}]);
             } else {
                 if ($column->phpType == "string") {
                     $query->andFilterWhere(['like', $this->tableName() . '.' . $column->name, $this->{$column->name}]);
                 }
             }
         }
     }
     if ($this->section) {
         $query->joinWith('cmsContentElementTrees');
         $query->andFilterWhere(['or', [$this->tableName() . '.tree_id' => $this->section], [CmsContentElementTree::tableName() . '.tree_id' => $this->section]]);
     }
     if ($this->created_at_from) {
         $query->andFilterWhere(['>=', $this->tableName() . '.created_at', \Yii::$app->formatter->asTimestamp(strtotime($this->created_at_from))]);
     }
     if ($this->created_at_to) {
         $query->andFilterWhere(['<=', $this->tableName() . '.created_at', \Yii::$app->formatter->asTimestamp(strtotime($this->created_at_to))]);
     }
     if ($this->updated_at_from) {
         $query->andFilterWhere(['>=', $this->tableName() . '.updated_at', \Yii::$app->formatter->asTimestamp(strtotime($this->updated_at_from))]);
     }
     if ($this->updated_at_to) {
         $query->andFilterWhere(['<=', $this->tableName() . '.created_at', \Yii::$app->formatter->asTimestamp(strtotime($this->updated_at_to))]);
     }
     if ($this->published_at_from) {
         $query->andFilterWhere(['>=', $this->tableName() . '.published_at', \Yii::$app->formatter->asTimestamp(strtotime($this->published_at_from))]);
     }
     if ($this->published_at_to) {
         $query->andFilterWhere(['<=', $this->tableName() . '.published_at', \Yii::$app->formatter->asTimestamp(strtotime($this->published_at_to))]);
     }
     if ($this->has_image) {
         $query->andFilterWhere(['>', $this->tableName() . '.image_id', 0]);
     }
     if ($this->has_full_image) {
         $query->andFilterWhere(['>', $this->tableName() . '.image_full_id', 0]);
     }
     if ($this->q) {
         $query->andFilterWhere(['or', ['like', $this->tableName() . '.name', $this->q], ['like', $this->tableName() . '.description_full', $this->q], ['like', $this->tableName() . '.description_short', $this->q]]);
     }
     return $activeDataProvider;
 }
All Usage Examples Of skeeks\cms\models\CmsContentElementTree::tableName