umpirsky
umpirsky

Reputation: 10024

Bulk insert with Doctrine 1.2

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

Answers (2)

Phil Moorhouse
Phil Moorhouse

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

umpirsky
umpirsky

Reputation: 10024

Definatelly no this feature in v1, only v2.

Upvotes: -1

Related Questions