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