Insert in Doctrine2

Is it possible to insert several objects into the database with one query? When I use the example from here , I see several requests in the web debugger

UPDATED 08/23/2012

I found the following links. Hope this helps someone understand batch processing:

The main things:

Some people seem to be wondering why Doctrine does not use multi-inserts (insert values ​​in (...) (...), (...), (...), ...

First of all, this syntax is supported only in mysql and later versions of postgresql. Secondly, there is no easy way to get hold of all generated identifiers in such a multi-insert when using AUTO_INCREMENT or SERIAL and ORM identifiers are needed to identify object management. Finally, insert performance is rarely an ORM bottleneck. Normal inserts are more than fast enough for most situations, and if you really want to do fast volume inserts, multi-insert is not the best way, i.e. Postgres COPY or Mysql LOAD DATA INFILE is several orders of magnitude faster.

Here are the reasons why you should not try to implement an abstraction that performs multi-inserts on mysql and postgresql in ORM. I hope this clears up some question marks.

+5
1

, , "".

http://doctrine-orm.readthedocs.org/en/2.0.x/reference/working-with-objects.html

"persist" UnitOfWork, EntityManager # flush(), ( UnitOfWork ).

, , , .

, Christophe

0

All Articles