Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- protected function execute(InputInterface $input, OutputInterface $output)
- {
- $em = $this->getContainer()->get('doctrine.orm.entity_manager');
- $medicamentService = $this->getContainer()->get('pharmacy.service.medicament');
- $medicaments = $medicamentService->getMedicaments();
- $c = 0;
- foreach ($medicaments as $drug) {
- $c++;
- $taste = $this->convertQuantity($drug->getQuantity());
- $drug->setQuantity($taste);
- $em->persist($drug);
- if ($c === 50) {
- $em->flush();
- $c = 0;
- }
- }
- $em->flush();
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement