Doctrine2 update using objects only
Is there a way to do a criteria update in Doctrine2 without using DQL and Native SQL? I only mean working with objects.
For example, something like this:
$data = new Entities\Articles();
$data->setStatus("published");
/*
Add some criteria for update here
*/
$em->persist($data);
$em->flush();
What I want to do is update multiple records without loading them from the database.
+3
source to share
1 answer
No, Doctrine ORM does not currently support the use of the update criteria API. The API criteria are currently only available for data retrieval and are still in a very early state.
If you can help us improve it, that would be awesome :)
The only currently available ways are DQL and NativeSQL
+1
source to share