コード例 #1
0
ファイル: PostComment.php プロジェクト: Dominus77/blog
 /**
  * Добавим ссылку на нашего специфического владельца
  * @return \yii\db\ActiveQuery
  */
 public function getMaterial()
 {
     return $this->hasOne(Post::className(), ['id' => 'material_id']);
 }
コード例 #2
0
ファイル: CategoryPosts.php プロジェクト: bysobi/blog
 /**
  * @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);
 }