| Conditions | 2 |
| Paths | 2 |
| Total Lines | 20 |
| Code Lines | 10 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 0 | ||
| 1 | <?php declare(strict_types=1); |
||
| 23 | public function save(Registration $registration): void |
||
| 24 | { |
||
| 25 | $registrationEntity = RegistrationEntity::fromRegistration($registration); |
||
| 26 | |||
| 27 | /** @var UserEntity $userEntity */ |
||
| 28 | $userEntity = $this->entityManager->find( |
||
| 29 | UserEntity::class, |
||
| 30 | $registrationEntity->getUserEntity()->getId() |
||
| 31 | ); |
||
| 32 | |||
| 33 | if ($userEntity == null) { |
||
| 34 | throw new \InvalidArgumentException( |
||
| 35 | 'User with id: '.$registrationEntity->getUserEntity()->getId().' not found.' |
||
| 36 | ); |
||
| 37 | } |
||
| 38 | |||
| 39 | $registrationEntity->setUserEntity($userEntity); |
||
| 40 | |||
| 41 | $this->entityManager->persist($registrationEntity); |
||
| 42 | $this->entityManager->flush(); |
||
| 43 | } |
||
| 61 |