コード例 #1
0
ファイル: Post.php プロジェクト: grutabow/Yii2Blog
 /**
  * @return \yii\db\ActiveQuery
  */
 public function getComments()
 {
     return $this->hasMany(Comment::className(), ['post_id' => 'id'])->where('status = ' . Comment::STATUS_APPROVED)->orderBy('id');
 }
コード例 #2
0
ファイル: Topic.php プロジェクト: 0ps/simpleforum
 public function getComments()
 {
     return $this->hasMany(Comment::className(), ['topic_id' => 'id']);
 }
コード例 #3
0
ファイル: User.php プロジェクト: nicdnepr/skidos
 public function getAuthorComments()
 {
     return $this->hasMany(Comment::className(), ['author_id' => 'id']);
 }
コード例 #4
0
ファイル: User.php プロジェクト: 0ps/simpleforum
 public function getComments()
 {
     return $this->hasMany(Comment::className(), ['user_id' => 'id'])->select(['id', 'user_id', 'topic_id', 'created_at', 'invisible', 'content'])->limit(10)->orderBy(['id' => SORT_DESC]);
 }
コード例 #5
0
ファイル: Test.php プロジェクト: huangjiaozhu/OSup-
 public function getComments()
 {
     return $this->hasMany(Comment::className(), ['test_id' => 'id'])->orderBy('commentdate');
 }
コード例 #6
0
ファイル: Book.php プロジェクト: vagrant200192/traning
 public function getComments()
 {
     return $this->hasMany(Comment::className(), ['book_id' => 'id'])->orderBy('created_at DESC');
 }
コード例 #7
0
ファイル: Comment.php プロジェクト: Sywooch/notes
 public function getComments()
 {
     return $this->hasMany(Comment::className(), ['id' => 'child_id'])->via('commentClosures');
 }
コード例 #8
0
ファイル: CommentClosure.php プロジェクト: Sywooch/notes
 public function getComment()
 {
     return $this->hasOne(Comment::className(), ['id' => 'parent_id']);
 }
コード例 #9
0
ファイル: User.php プロジェクト: vagrant200192/traning
 public function getComments()
 {
     return $this->hasMany(Comment::className(), ['author' => 'email']);
 }
コード例 #10
0
ファイル: User.php プロジェクト: heartshare/yii2-crazydb-blog
 public function getAllComments()
 {
     return $this->hasMany(Comment::className(), ['uid' => 'id'])->orderBy(['is_top' => SORT_DESC, 'post_time' => SORT_DESC]);
 }
コード例 #11
0
ファイル: Topic.php プロジェクト: abzal1991/itblog
 public function getCommentCount()
 {
     return $this->hasMany(Comment::className(), ['target_id' => 'topic_id'])->where(['target_type' => 'topic'])->count();
 }
コード例 #12
0
ファイル: Post.php プロジェクト: heartshare/yii2-crazydb-blog
 public function getAllComments()
 {
     return $this->hasMany(Comment::className(), ['pid' => 'id'])->onCondition(['status' => Comment::STATUS_APPROVED])->orderBy(['create_time' => SORT_ASC]);
 }
コード例 #13
0
ファイル: Product.php プロジェクト: vetoni/toko
 /**
  * @return \yii\db\ActiveQuery
  */
 public function getComments()
 {
     return $this->hasMany(Comment::className(), ['product_id' => 'id'])->orderBy(['created_at' => SORT_DESC]);
 }