Reputation: 10024
This code (source: http://www.doctrine-project.org/documentation/manual/1_0/hu/component-overview:connection:flushing-the-connection)
$conn = Doctrine_Manager::connection();
$user1 = new User();
$user1->username = 'Jack';
$user2 = new User();
$user2->username = 'jwage';
$conn->flush();
is resulting 2 insert queries to be executed.
Is there a way to do this with only one bulk insert?
I think doctrine 2 is solving this problem (http://www.doctrine-project.org/blog/doctrine2-batch-processing), but it's still in beta.
Any idea?
Upvotes: 2
Views: 4623
Reputation: 870
This post explains how to do it with Collections, as suggested by Michelangelo: Doctrine - insert multiple rows with just one save()
Upvotes: 6