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