0

I try to insert 1 000 - 30 000 records in one http request. And I cannot manage with this.

My codes:

foreach ($recipients as $recipient) {
    $notificationHubAction = new NotificationHubAction();
    $notificationHubAction->setNotificationId($popup->getId());
    $notificationHubAction->setUserId($recipient['id']);
    $notificationHubAction->save();
    $notificationHubAction->free();
}



$notificationHubActions = new Doctrine_Collection('NotificationHubAction');
foreach ($recipients as $recipient) {
    $notificationHubAction = new NotificationHubAction();
    $notificationHubAction->setNotificationId($popup->getId());
    $notificationHubAction->setUserId($recipient['id']);
    $notificationHubActions->add($notificationHubAction);
}
$notificationHubActions->save();

Both don't work :( Trying to save almost 20 000 records.

latata
  • 1,703
  • 5
  • 27
  • 57
  • 1
    Instead of updating your question to include the answer, you should better post an answer an accept it. This is the way Stackoverflow works to define a question as resolved. – j0k Nov 25 '14 at 08:42

1 Answers1

0

The solution is to use clear SQL, not Doctrine DQL or something like that. http://oldforum.symfony-project.org/index.php/m/98628/#msg_num_5

latata
  • 1,703
  • 5
  • 27
  • 57