public function delete($id) { $collectionEntity = $this->collectionRepository->findCollectionById($id); if (!$collectionEntity) { throw new CollectionNotFoundException($id); } $this->em->remove($collectionEntity); $this->em->flush(); }