I found an example in the internet, and my code finally looks like this; $connection = sfContext::getInstance()->getDatabaseManager()- >getDatabase('default')->getDoctrineConnection(); $connection->beginTransaction(); try { while ($data = $reader->read()) { // some logics here $np = new Np(); $np->setTime(date("Y-m-d H:i:s",($data[0] - 25569) * 86400 - 28800)); // more set $np->setMerged(0); $np->save(); } } catch (Exception $e) { $connection->rollback(); }
and it's fast!! Thanks On Jan 4, 9:07 pm, Ramunas <wool...@gmail.com> wrote: > Hi, > > Try to use transactions. Things usually goes faster when you add all > of your records in one transaction and then commit them. > > Tuesday, January 4, 2011, 12:54:33 AM, you wrote: http://www.mohdshakir.net -- If you want to report a vulnerability issue on symfony, please send it to security at symfony-project.com You received this message because you are subscribed to the Google Groups "symfony users" group. To post to this group, send email to symfony-users@googlegroups.com To unsubscribe from this group, send email to symfony-users+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/symfony-users?hl=en