I am trying to insert a large amount of data (30,000+ rows) into a MySQL database using Doctrine2 and the Symfony2 toolkit.
I looked at the right way to do this . I saw many questions about memory leaks and the Doctrine, but there was no satisfactory answer for me. The Doctrine function is often used clear().
So, I made various forms of this:
while (($data = getData()) {
    $iteration++;
    $obj = new EntityObject();
    $obj->setName('henry');
    
    $manager->persist($obj);
    if ($iteration % 500 == 0) {
        $manager->flush();
        $manager->clear();
        
        
        
        
    }
}
PHP - , flush() ( ). , , , , . , : , KB.
clear(), detach() GC . KB.
? - ? ?
:
EDIT ( ):
@qooplmao , , sql logger: $manager->getConnection()->getConfiguration()->setSQLLogger(null);
, - .