i'm trying to add xlsx data to my data base as entities i wrote this script
$batchCount = 10000; $i = 0; foreach($rows as $row) { if (is_numeric($row[0])){ $i++; $cart = new Carte(); //doing something $this->em->persist($cart); if (($i % $batchCount) == 0) { $this->em->flush(); $this->em->clear(); } } }
But for a adding 50,000 line in database its taking to long I'd love if some one have fast method to add large data to database using Symfony
2.1m questions
2.1m answers
60 comments
57.0k users