public function findOrCreateConferenceSchedule(Conference $conference) { $schedule = $this->findOneBy(['conference' => $conference]); if (!$schedule) { $schedule = PersonalSchedule::ofConference($conference); $this->getEntityManager()->persist($schedule); } return $schedule; }
/** * @When I choose the :talk talk for my personal schedule of this conference * @When I try to choose the :talk talk for my personal schedule of this conference */ public function iChooseTheTalkForMyPersonalScheduleOfThisConference(Talk $talk) { $this->personalSchedule = $this->personalSchedule ?: PersonalSchedule::ofConference($this->conference); try { $this->personalSchedule->chooseTalk($talk); } catch (\Exception $e) { $this->choiceException = $e; } }