| Conditions | 3 |
| Paths | 3 |
| Total Lines | 23 |
| Code Lines | 14 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 33 | protected function execute(InputInterface $input, OutputInterface $output) |
||
| 34 | { |
||
| 35 | /** @var EntityManager $entityManager */ |
||
| 36 | $entityManager = $this->getContainer()->get('doctrine.orm.entity_manager'); |
||
| 37 | |||
| 38 | $widgetMaps = $entityManager->getRepository('VictoireWidgetMapBundle:WidgetMap')->findAll(); |
||
| 39 | |||
| 40 | $progress = $this->getHelper('progress'); |
||
| 41 | $progress->start($output, count($widgetMaps)); |
||
| 42 | foreach ($widgetMaps as $key => $widgetMap) { |
||
| 43 | $widget = $widgetMap->getWidget(); |
||
| 44 | $widget->setWidgetMap($widgetMap); |
||
| 45 | $widgetMap->setWidget(null); |
||
| 46 | if ($key % 100 == 0) { |
||
| 47 | $entityManager->flush(); |
||
| 48 | } |
||
| 49 | $progress->advance(); |
||
| 50 | } |
||
| 51 | |||
| 52 | $entityManager->flush(); |
||
| 53 | |||
| 54 | $progress->finish(); |
||
| 55 | } |
||
| 56 | } |
||
| 57 |