| Conditions | 3 |
| Paths | 3 |
| Total Lines | 16 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 12 |
| CRAP Score | 3 |
| Changes | 0 | ||
| 1 | <?php |
||
| 21 | 11 | public function onFlush(OnFlushEventArgs $args) |
|
| 22 | { |
||
| 23 | 11 | $em = $args->getEntityManager(); |
|
| 24 | 11 | $uow = $em->getUnitOfWork(); |
|
| 25 | |||
| 26 | 11 | foreach ($uow->getScheduledEntityInsertions() as $keyEntity => $entity) { |
|
| 27 | 1 | if ($entity instanceof PerformanceEvent) { |
|
| 28 | 1 | $performance = $entity->getPerformance(); |
|
| 29 | 1 | $currentSeason = $em->getRepository(RepertoireSeason::class) |
|
| 30 | 1 | ->findSeasonByDate($entity->getDateTime()); |
|
| 31 | 1 | $performance->addSeason($currentSeason); |
|
| 32 | 1 | $classMetadata = $em->getClassMetadata(get_class($performance)); |
|
| 33 | 1 | $uow->computeChangeSet($classMetadata, $performance); |
|
| 34 | } |
||
| 35 | } |
||
| 36 | 11 | } |
|
| 37 | } |
||
| 38 |