Exemple #1
0
 /**
  * Добавим ссылку на нашего специфического владельца
  * @return \yii\db\ActiveQuery
  */
 public function getMaterial()
 {
     return $this->hasOne(Post::className(), ['id' => 'material_id']);
 }
Exemple #2
0
 /**
  * @return \yii\db\ActiveQuery
  */
 public function getPost()
 {
     return $this->hasOne(Post::className(), ['id' => 'post_id']);
 }
Exemple #3
0
 /**
  * Возвращает посты по тегу
  * @return \yii\db\ActiveQuery
  */
 public function getPostsTag($offset = false, $limit = false)
 {
     return $this->hasMany(Post::className(), ['id' => 'post_id'])->viaTable('{{%blog_tag_post}}', ['tag_id' => 'id'])->where(['publish_status' => [Post::STATUS_PUBLISH, Post::STATUS_ARCHIVE]])->orderBy(['id' => SORT_DESC])->offset($offset)->limit($limit);
 }