[TYPO3-mvc] How to speed up the creation of 100.000+ objects in an extbase extension?

Stefano Cecere scecere at krur.com
Wed Dec 5 17:43:31 CET 2012


DIG EXTBASE for this operation
go straight with DB->insert in the fe_user table!



On 05/12/12 17:32, Roland wrote:
> hi everybody,
>
> i have to import 100.000+ database records from an external oracle
> database. these records should be transformed into objects of a extbase
> extension.
>
> at the moment this takes a lot of time. 60+ minutes an still waiting...
>
> is there something like a best practice to make this work faster?
>
> this is some of my code:
>
> --- quote ---
>
> foreach ($recordSet as $record) {
>    $newUser =
> $this->objectManager->create('Tx_MyExtension_Domain_Model_User');
>    $newUser->setName($record['name']);
>    $newUser->setName($record['email']);
>    $newUser->setName($record['fax']);
>    ...
>    $newUser->setName($record['phone']);
>    $newUser->setName($record['city']);
>    $newUser->setName($record['zip']);
>    $this->userRepository->add($newUser);
> }
>
> --- /quote ---
>
> how can i improve this? what about a persistAll() or should a unset()
> help somehow?
>
> kind regards
>
> roland


-- 

-- --- ----- -------

Stefano Cecere
KRUR studio - http://krur.com


More information about the TYPO3-project-typo3v4mvc mailing list