The Wayback Machine - https://web.archive.org/web/20221029110520/https://github.com/symfony/symfony/discussions/47923
Skip to content

Remove the results getting using createquerybuilder #47923

Unanswered
shubhangi101092 asked this question in Q&A
Discussion options

Hi ,

I have request Manager class which is inherting entitymanagerinterface.
In my function I am getting results but not able to delete using remove function

return $this->requestRepository->createQueryBuilder('cat')
  | ->andWhere('cat.name = :searchTerm')
  | ->setParameter('searchTerm', $term)
  | ->getQuery()
  | ->getResults();
Now what to delete these records using remove function instead of delete.

How can I achieve that ?

You must be logged in to vote

Replies: 2 suggested answers

Comment options

What do you mean? Why couldn't you use EntityManagerInterface::remove?

You must be logged in to vote
0 replies
Comment options

You have to call flush after calling remove.

You must be logged in to vote
0 replies
Category
🙏
Q&A
Labels
None yet
3 participants
Morty Proxy This is a proxified and sanitized view of the page, visit original site.