em->createSimpleCriteria(Comment::getClass(), array(), array('id' => 'DESC')); return $criteria->toQuery()->fetchArray(); } function getCommentById(int $id): ?Comment { // http://localhost/php-storm/internship-playground/src-php/public/api/comment/comment/2 return $this->em->find(Comment::getClass(), $id); } /* function getCommentById(int $id) { $criteria = $this->em->createCriteria(); $criteria->select('c.id', 'commentId') ->select('c.article.id', 'articleId') ->from(Comment::class , 'c') ->where(['c.id'=>$id]); return $criteria->toQuery()->fetchSingle(); } */ }