本文整理匯總了PHP中common\models\Comment::className方法的典型用法代碼示例。如果您正苦於以下問題:PHP Comment::className方法的具體用法?PHP Comment::className怎麽用?PHP Comment::className使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類common\models\Comment
的用法示例。
在下文中一共展示了Comment::className方法的8個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: getComments
/**
* @return \yii\db\ActiveQuery
*/
public function getComments()
{
return $this->hasMany(Comment::className(), ['section_id' => 'id']);
}
示例2: getParent
public function getParent()
{
return $this->hasOne(Comment::className(), ['id' => 'parent_id']);
}
示例3: getComments
/**
* 關聯關係,獲取評論信息,按時間倒序排列
* @return ActiveQuery
*/
public function getComments()
{
return $this->hasMany(Comment::className(), ['post_id' => 'id'])->orderBy(Comment::tableName() . '.created_at DESC');
}
示例4: getSons
/**
* 獲取所有子評論
* @return \yii\db\ActiveQuery
*/
public function getSons()
{
return $this->hasMany(Comment::className(), ['parent_id' => 'id']);
}
示例5: getComment
public function getComment()
{
return $this->hasOne(Comment::className(), ['id' => 'commentID']);
}
示例6: getComments
/**
* @return \yii\db\ActiveQuery
*/
public function getComments()
{
return $this->hasMany(Comment::className(), ['post_id' => 'id'])->where('status = ' . Comment::STATUS_ACTIVE)->orderBy('id');
}
示例7: getCommentsPassedBad
/**
* @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]);
}
示例8: getChildComments
/**
* @return \yii\db\ActiveQuery
*/
public function getChildComments()
{
return $this->hasMany(Comment::className(), ['parent' => 'id']);
}