public function __construct(ConferenceRepository $repository) { $this->repository = $repository; } public function registerAction($id) { $conference = $this->repository->findOneById($id); ... } }
ConferenceRepository { ... public function findOneById($id) { return parent::find($id); } public function save(Conference $conference) { $this->getEntityManager()->persist($conference); $this->getEntityManager()->flush(); } }
ConferenceRepository { public function findOneById($id) { return parent::load($id); } public function save(Conference $conference) { parent::add($conference, $conference->getId()); } }