0
I am implementing Doctrine in a project, but I have a question about inserting, updating and removing data. When I run the following command for example:
$companyName = $entityManager->getRepository("Admin\\Module\\Configuration\\Entity\\Config")->findOneBy(array("type"=>"company_name"));
$companyName->setValue($POST["companyName"]);
$entityManager->persist($companyName);
$entityManager->flush();
How can I capture the Doctrine result to know if it actually gave the persist and also ran the flush successfully? In case I couldn’t catch his return yet. I tried with Try catch, but the Exception always comes back empty.
I wonder if there is something similar to the affected_rows of mysqli to use in Doctrine
It is worth asking if there is an extension or third-party api that implements this count in Doctrine?
– RodrigoBorth
If the value of affected lines is not exposed I believe it is for some good reason, or because you can get the value otherwise (for example, the size of your initial resultset). Is there a case you really need that count?
– Rodrigo Rigotti
is relative in fact, I am making insertions in ajax and wanted to give the answer containing the number of affected lines and also wanted to use to validate the return in some cases. But mostly it is more for didactic reasons, it is always good to know how far the possibilities of a tool extend
– RodrigoBorth