Example #1
0
 /**
  * @return \yii\db\ActiveQuery
  */
 public function getComments()
 {
     return $this->hasMany(Comment::className(), ['section_id' => 'id']);
 }
Example #2
0
 public function getParent()
 {
     return $this->hasOne(Comment::className(), ['id' => 'parent_id']);
 }
Example #3
0
 /**
  * 关联关系,获取评论信息,按时间倒序排列
  * @return ActiveQuery
  */
 public function getComments()
 {
     return $this->hasMany(Comment::className(), ['post_id' => 'id'])->orderBy(Comment::tableName() . '.created_at DESC');
 }
Example #4
0
 /**
  * 获取所有子评论
  * @return \yii\db\ActiveQuery
  */
 public function getSons()
 {
     return $this->hasMany(Comment::className(), ['parent_id' => 'id']);
 }
Example #5
0
 public function getComment()
 {
     return $this->hasOne(Comment::className(), ['id' => 'commentID']);
 }
Example #6
0
 /**
  * @return \yii\db\ActiveQuery
  */
 public function getComments()
 {
     return $this->hasMany(Comment::className(), ['post_id' => 'id'])->where('status = ' . Comment::STATUS_ACTIVE)->orderBy('id');
 }
Example #7
0
 /**
  * @return \yii\db\ActiveQuery
  */
 public function getCommentsPassedBad()
 {
     return $this->hasMany(Comment::className(), ['product_id' => 'id'])->where(['status' => Status::STATUS_ACTIVE, 'star' => 1])->orderBy(['created_at' => SORT_DESC]);
 }
Example #8
0
 /**
  * @return \yii\db\ActiveQuery
  */
 public function getChildComments()
 {
     return $this->hasMany(Comment::className(), ['parent' => 'id']);
 }