예제 #1
0
 /**
  * Добавим ссылку на нашего специфического владельца
  * @return \yii\db\ActiveQuery
  */
 public function getMaterial()
 {
     return $this->hasOne(Post::className(), ['id' => 'material_id']);
 }
예제 #2
0
 /**
  * @return \yii\db\ActiveQuery
  */
 public function getPost()
 {
     return $this->hasOne(Post::className(), ['id' => 'post_id']);
 }
예제 #3
0
파일: Tags.php 프로젝트: Dominus77/blog
 /**
  * Возвращает посты по тегу
  * @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);
 }