projectDir = $projectDir; $this->entityManager = $entityManager; $this->courtRepository = $courtRepository; $this->courtSessionRepository = $courtSessionRepository; } public function addCourt(string $court_name, string $court_postcode) : ?Court { $___court = null; $court = new Court( $court_name, $court_name, //clean manually later $court_postcode ); $this->entityManager->persist($court); $this->entityManager->flush(); if($court->getId() > 0) { $___court = $court; } return $___court; } public function findCourt(int $id) : ?Court { $___court = null; $court = $this->courtRepository->findCourt($id); if ($court != null) { $___court = $court; } return $___court; } public function findCourtByName(string $court_name) : ?Court { $___court = null; $court = $this->courtRepository->findOneByCourtName($court_name); if ($court != null) { $___court = $court; } return $___court; } public function findCourtByPostcode(string $court_postcode) : ?Court { $___court = null; $court = $this->courtRepository->findOneByCourtPostcode($court_postcode); if ($court != null) { $___court = $court; } return $___court; } public function addCourtSession( \DateTime $hearing_date, string $case_reference, string $case_details, bool $motoring_related, Court $court ) : ?CourtSession { $___courtSession = null; $courtSession = new CourtSession( $hearing_date, $case_reference, $case_details, $motoring_related, $court ); $this->entityManager->persist($courtSession); $this->entityManager->flush(); if($courtSession->getId() > 0) { $___courtSession = $courtSession; } return $___courtSession; } public function findCourtSession(int $id) : ?CourtSession { $___courtSession = null; $courtSession = $this->courtSessionRepository->findCourtSession($id); if ($courtSession != null) { $___courtSession = $courtSession; } return $___courtSession; } public function findCourtSessionByCaseReference(string $case_reference) : ?CourtSession { $___courtSession = null; $courtSession = $this->courtSessionRepository->findOneByCaseReference($case_reference); if ($courtSession != null) { $___courtSession = $courtSession; } return $___courtSession; } }