common\models\PostComment::findComment PHP Method

findComment() public static method

通过ID获取指定评论
public static findComment ( $id ) : array | null | ActiveRecord | static
$id
return array | null | yii\db\ActiveRecord | static
    public static function findComment($id)
    {
        return static::findModel($id, ['status' => self::STATUS_ACTIVE]);
    }

Usage Example

示例#1
0
 public function userDoAction($id, $action)
 {
     $comment = PostComment::findComment($id);
     $user = \Yii::$app->user->getIdentity();
     if (in_array($action, ['like'])) {
         return UserService::CommentAction($user, $comment, $action);
     }
 }
All Usage Examples Of common\models\PostComment::findComment