Symfony doctrine flash connection saved

"Problem"

In the profiler:

  • select request
  • another choice request
  • third request

AND NOW I CALL INSERT INTO THE CONTROLLER THAT THIS QUERY IS EXCLUDED

$re=new Requests(); $re->setViewed(false); $em->persist($add); $em->flush(); 

And this raises other "3" requests: enter image description here

Everything is good? Or am I doing something wrong? ...

+4
source share
1 answer

Each call to Doctrine\ORM\EntityManager#flush enclosed in a transaction.

This means that if your current RDBM supports transactions , ORM will automatically START TRANSACTION , and then perform all the necessary queries, and then either COMMIT if everything goes fine, or ROLLBACK if an error occurs.

You can learn more about how Doctrine 2 ORM handles transactions and concurrency in the documentation.

+6
source

Source: https://habr.com/ru/post/1468936/


All Articles