| Conditions | 2 |
| Paths | 2 |
| Total Lines | 15 |
| Code Lines | 10 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 25 | public function addGroupToCalendar(int $calendarId, int $groupId): void |
||
| 26 | { |
||
| 27 | $em = $this->getEntityManager(); |
||
| 28 | $existingRelation = $this->findOneBy([ |
||
| 29 | 'attendanceCalendar' => $calendarId, |
||
| 30 | 'group' => $groupId, |
||
| 31 | ]); |
||
| 32 | |||
| 33 | if (!$existingRelation) { |
||
| 34 | $relation = new CAttendanceCalendarRelGroup(); |
||
| 35 | $relation->setAttendanceCalendar($em->getReference(CAttendanceCalendar::class, $calendarId)); |
||
| 36 | $relation->setGroup($em->getReference(CGroup::class, $groupId)); |
||
| 37 | |||
| 38 | $em->persist($relation); |
||
| 39 | $em->flush(); |
||
| 40 | } |
||
| 43 |