Answer the question
In order to leave comments, you need to log in
How to make such a request in symfony?
Hello! I have this sql query
select * from comment where id in (select child_comment_id from parent_child_comment where parent_comment_id = 12);
public function findChildsComment($id)
{
$entityManager = $this->getEntityManager();
$query = $entityManager->createQuery("
select comment from App\Entity\Comment comment
where comment.id in (select child.childCommentId from App\Entity\ParentChildComment child
where child.parentCommentId = :id)
")->setParameters([
'id' => $id
]);
return $query->getResult();
}
"[Semantical Error] line 0, col 99 near 'childCommentId': Error: Invalid PathExpression. Must be a StateFieldPathExpression.",
Answer the question
In order to leave comments, you need to log in
And if you rewrite without in - through JOIN - won't it be easier?
SELECT DISTINCT comment.*
FROM comment
INNER JOIN parent_child_comment
ON parent_child_comment.child_comment_id = comment.id
WHERE parent_child_comment.parent_comment_id = 12
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question