tableName() public static method

public static tableName ( )
Example #1
0
 /**
  * Стандартный sitemap
  */
 public function actionSitemap()
 {
     ini_set("memory_limit", "512M");
     $trees = Tree::find()->where(['site_code' => \Yii::$app->cms->site->code])->orderBy(['level' => SORT_ASC, 'priority' => SORT_ASC])->all();
     if ($trees) {
         /**
          * @var Tree $tree
          */
         foreach ($trees as $tree) {
             if (!$tree->redirect) {
                 $result[] = ["loc" => $tree->url, "lastmod" => $this->_lastMod($tree), "priority" => $this->_calculatePriority($tree), "changefreq" => "daily"];
             }
         }
     }
     $elements = CmsContentElement::find()->joinWith('cmsTree')->andWhere([Tree::tableName() . '.site_code' => \Yii::$app->cms->site->code])->orderBy(['updated_at' => SORT_DESC, 'priority' => SORT_ASC])->all();
     //Добавление элементов в карту
     if ($elements) {
         /**
          * @var CmsContentElement $model
          */
         foreach ($elements as $model) {
             $result[] = ["loc" => $model->absoluteUrl, "lastmod" => $this->_lastMod($model), "priority" => "0.3", "changefreq" => "daily"];
         }
     }
     \Yii::$app->response->format = Response::FORMAT_XML;
     $this->layout = false;
     //Генерация sitemap вручную, не используем XmlResponseFormatter
     \Yii::$app->response->content = $this->render($this->action->id, ['data' => $result]);
     return;
     /*return $this->render($this->action->id, [
           'data' => $result
       ]);;*/
 }