| Conditions | 2 |
| Paths | 2 |
| Total Lines | 14 |
| Code Lines | 8 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 1 | ||
| Bugs | 0 | Features | 1 |
| 1 | <?php |
||
| 19 | public function save(Registration $registration) |
||
| 20 | { |
||
| 21 | $maxNumber = 0; |
||
| 22 | foreach ($registration->getEvent()->getRegistrations() as $registration) { |
||
| 23 | $maxNumber = max($registration->getNumber(), $maxNumber); |
||
| 24 | } |
||
| 25 | |||
| 26 | ++$maxNumber; |
||
| 27 | |||
| 28 | $registration->setNumber($maxNumber); |
||
| 29 | |||
| 30 | $manager = $this->getEntityManager(); |
||
| 31 | $manager->persist($registration); |
||
| 32 | $manager->flush(); |
||
| 33 | } |
||
| 35 |