예제 #1
0
파일: Meta.php 프로젝트: Penton/MoBlog
 public function getPosts($isPublished = true)
 {
     $query = $this->hasMany(Post::className(), ['cid' => 'cid'])->with('categories')->with('tags')->with('author')->orderByCid();
     if ($isPublished) {
         $query = $query->published();
     }
     return $query->viaTable(Relationship::tableName(), ['mid' => 'mid']);
 }
예제 #2
0
 /**
  * @return \yii\db\ActiveQuery
  */
 public function getPosts()
 {
     return $this->hasMany(Post::className(), ['category_id' => 'id']);
 }
예제 #3
0
 /**
  * @return \yii\db\ActiveQuery
  */
 public function getCommentPost()
 {
     return $this->hasOne(Post::className(), ['id' => 'comment_post_id']);
 }
예제 #4
0
파일: Term.php 프로젝트: ochiem/app-cms
 /**
  * @return \yii\db\ActiveQuery
  */
 public function getPosts()
 {
     return $this->hasMany(Post::className(), ['id' => 'post_id'])->viaTable('{{%term_relationship}}', ['term_id' => 'id']);
 }
예제 #5
0
파일: User.php 프로젝트: ochiem/app-cms
 /**
  * @return \yii\db\ActiveQuery
  */
 public function getPosts()
 {
     return $this->hasMany(Post::className(), ['post_author' => 'id']);
 }
예제 #6
0
 /**
  * @return \yii\db\ActiveQuery
  */
 public function getMediaPost()
 {
     return $this->hasOne(Post::className(), ['id' => 'media_post_id']);
 }
예제 #7
0
 /**
  * @return \yii\db\ActiveQuery
  */
 public function getIdPost()
 {
     return $this->hasOne(Post::className(), ['id' => 'id_post']);
 }
예제 #8
0
 /**
  * @inheritdoc
  */
 public function rules()
 {
     return [[['content'], 'filter', 'filter' => function ($value) {
         return \Yii::$app->formatter->asHtml($value);
     }], [['content', 'post_id'], 'required'], [['content'], 'string', 'max' => 128], [['post_id'], 'exist', 'targetClass' => Post::className(), 'targetAttribute' => 'id']];
 }
예제 #9
0
 public function getPosts()
 {
     return $this->hasMany(Post::className(), ['cate_id' => 'id', 'status' => [Post::STATUS_ACTIVE]])->orderBy(['created_at' => SORT_DESC]);
 }
예제 #10
0
 public function getTopic()
 {
     return $this->hasOne(Post::className(), ['id' => 'post_id'])->where(['type' => 'topic']);
 }
예제 #11
0
파일: User.php 프로젝트: Penton/MoBlog
 public function getPosts($isPublished = true)
 {
     $query = $this->hasMany(Post::className(), ['authorId' => 'uid'])->with('categories')->with('tags')->with('author')->orderByCid();
     if ($isPublished) {
         return $query->published();
     }
     return $query;
 }
예제 #12
0
 public function getPost()
 {
     return $this->hasOne(Post::className(), ['cid' => 'parent']);
 }
예제 #13
0
 public function getPosts()
 {
     return $this->hasMany(Post::className(), ['id' => 'post_id'])->viaTable('category_post', ['category_id' => 'id']);
 }
예제 #14
0
 /**
  * @return \yii\db\ActiveQuery
  */
 public function getPosts()
 {
     return $this->hasMany(Post::className(), ['type' => 'id']);
 }
예제 #15
0
파일: Tag.php 프로젝트: VitaliyProdan/hr
 public function getPosts()
 {
     return $this->hasMany(Post::className(), ['id' => 'post_id'])->viaTable('posts_tags', ['tag_id' => 'id']);
 }