skeeks\cms\models\CmsContentElement::tableName PHP Méthode

tableName() public static méthode

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

Usage Example

 protected function _run()
 {
     $cacheKey = $this->getCacheKey() . 'run';
     $dependency = new TagDependency(['tags' => [$this->className() . (string) $this->namespace, (new CmsContentElement())->getTableCacheTag()]]);
     $result = \Yii::$app->cache->get($cacheKey);
     if ($result === false || $this->enabledRunCache == Cms::BOOL_N) {
         $this->initDataProvider();
         if ($this->createdBy) {
             $this->dataProvider->query->andWhere([CmsContentElement::tableName() . '.created_by' => $this->createdBy]);
         }
         if ($this->active) {
             $this->dataProvider->query->andWhere([CmsContentElement::tableName() . '.active' => $this->active]);
         }
         if ($this->content_ids) {
             $this->dataProvider->query->andWhere([CmsContentElement::tableName() . '.content_id' => $this->content_ids]);
         }
         if ($this->limit) {
             $this->dataProvider->query->limit($this->limit);
         }
         $treeIds = (array) $this->tree_ids;
         if ($this->enabledCurrentTree == Cms::BOOL_Y) {
             $tree = \Yii::$app->cms->getCurrentTree();
             if ($tree) {
                 $treeIds[] = $tree->id;
                 if ($tree->children && $this->enabledCurrentTreeChild == Cms::BOOL_Y) {
                     if ($this->enabledCurrentTreeChildAll) {
                         if ($childrens = $tree->children) {
                             foreach ($childrens as $chidren) {
                                 $treeIds[] = $chidren->id;
                             }
                         }
                     } else {
                         if ($childrens = $tree->children) {
                             foreach ($childrens as $chidren) {
                                 $treeIds[] = $chidren->id;
                             }
                         }
                     }
                 }
             }
         }
         if ($treeIds) {
             foreach ($treeIds as $key => $treeId) {
                 if (!$treeId) {
                     unset($treeIds[$key]);
                 }
             }
             if ($treeIds) {
                 /**
                  * @var $query ActiveQuery
                  */
                 $query = $this->dataProvider->query;
                 $query->joinWith('cmsContentElementTrees');
                 $query->andWhere(['or', [CmsContentElement::tableName() . '.tree_id' => $treeIds], [CmsContentElementTree::tableName() . '.tree_id' => $treeIds]]);
             }
         }
         if ($this->enabledActiveTime == Cms::BOOL_Y) {
             $this->dataProvider->query->andWhere(["<=", CmsContentElement::tableName() . '.published_at', \Yii::$app->formatter->asTimestamp(time())]);
             $this->dataProvider->query->andWhere(['or', [">=", CmsContentElement::tableName() . '.published_to', \Yii::$app->formatter->asTimestamp(time())], [CmsContentElement::tableName() . '.published_to' => null]]);
         }
         /**
          *
          */
         if ($this->with) {
             $this->dataProvider->query->with($this->with);
         }
         $this->dataProvider->query->groupBy([CmsContentElement::tableName() . '.id']);
         if ($this->activeQueryCallback && is_callable($this->activeQueryCallback)) {
             $callback = $this->activeQueryCallback;
             $callback($this->dataProvider->query);
         }
         if ($this->dataProviderCallback && is_callable($this->dataProviderCallback)) {
             $callback = $this->dataProviderCallback;
             $callback($this->dataProvider);
         }
         $result = parent::_run();
         \Yii::$app->cache->set($cacheKey, $result, (int) $this->runCacheDuration, $dependency);
     }
     return $result;
 }
All Usage Examples Of skeeks\cms\models\CmsContentElement::tableName