| Conditions | 3 |
| Paths | 2 |
| Total Lines | 10 |
| Code Lines | 5 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 18 | public function setName(string $name): void |
||
| 19 | { |
||
| 20 | /** @var ArtistRepository $artistRepository */ |
||
| 21 | $artistRepository = _em()->getRepository(self::class); |
||
| 22 | |||
| 23 | $exists = $artistRepository->findOneBy(['name' => $name]); |
||
| 24 | if ($exists && $exists->getId() !== $this->getId()) { |
||
| 25 | throw new Exception('Le nom de cet artiste existe déjà.'); |
||
| 26 | } |
||
| 27 | parent::setName($name); |
||
| 28 | } |
||
| 30 |