diff --git a/src/Command/CreateCustomerFromWarrantyCommand.php b/src/Command/CreateCustomerFromWarrantyCommand.php index 8265b97e..ddc6d3a4 100644 --- a/src/Command/CreateCustomerFromWarrantyCommand.php +++ b/src/Command/CreateCustomerFromWarrantyCommand.php @@ -87,14 +87,17 @@ class CreateCustomerFromWarrantyCommand extends Command // get all warranties error_log('Getting warranties...'); $warr_q = $this->em->createQuery('select w from App\Entity\Warranty w where w.mobile_number is not null'); - $warranties = $warr_q->getResult(); + $warranties = $warr_q->iterate(); + // $warranties = $warr_q->getResult(); // $warranties = $this->em->getRepository(Warranty::class)->findAll(); $invalid_warranties = []; - $warr_count = count($warranties); - $output->writeln("Processing $warr_count warranties... "); - foreach($warranties as $warr) - { + // $warr_count = count($warranties); + $output->writeln("Processing warranties... "); + foreach($warranties as $row) + { + $warr = $row[0]; + $total_warr++; // check if warranty mobile already exists in customer $w_mobile = $warr->getMobileNumber(); @@ -209,6 +212,7 @@ class CreateCustomerFromWarrantyCommand extends Command */ } } + $this->em->clear(); } /*