diff --git a/src/Bundle/ChillDocStoreBundle/Controller/DocumentAccompanyingCourseController.php b/src/Bundle/ChillDocStoreBundle/Controller/DocumentAccompanyingCourseController.php index 512747b01..c5ccc2a22 100644 --- a/src/Bundle/ChillDocStoreBundle/Controller/DocumentAccompanyingCourseController.php +++ b/src/Bundle/ChillDocStoreBundle/Controller/DocumentAccompanyingCourseController.php @@ -73,14 +73,14 @@ class DocumentAccompanyingCourseController extends AbstractController $this->denyAccessUnlessGranted(AccompanyingPeriodVoter::SEE, $course); $documents = $em - ->getRepository("ChillDocStoreBundle:AccompanyingCourseDocument") + ->getRepository(AccompanyingCourseDocument::class) ->findBy( ['course' => $course], ['date' => 'DESC'] ); return $this->render( - 'ChillDocStoreBundle:AccompanyingCourseDocument:index.html.twig', + '@ChillDocStore/AccompanyingCourseDocument/index.html.twig', [ 'documents' => $documents, 'accompanyingCourse' => $course @@ -122,7 +122,7 @@ class DocumentAccompanyingCourseController extends AbstractController $this->addFlash('error', $this->translator->trans("This form contains errors")); } - return $this->render('ChillDocStoreBundle:AccompanyingCourseDocument:new.html.twig', [ + return $this->render('@ChillDocStore/AccompanyingCourseDocument/new.html.twig', [ 'document' => $document, 'form' => $form->createView(), 'accompanyingCourse' => $course, @@ -138,7 +138,7 @@ class DocumentAccompanyingCourseController extends AbstractController $this->denyAccessUnlessGranted('CHILL_ACCOMPANYING_COURSE_DOCUMENT_SEE', $document); return $this->render( - 'ChillDocStoreBundle:AccompanyingCourseDocument:show.html.twig', + '@ChillDocStore/AccompanyingCourseDocument/show.html.twig', ['document' => $document, 'accompanyingCourse' => $course]); } @@ -171,7 +171,7 @@ class DocumentAccompanyingCourseController extends AbstractController } return $this->render( - 'ChillDocStoreBundle:AccompanyingCourseDocument:edit.html.twig', + '@ChillDocStore/AccompanyingCourseDocument/edit.html.twig', [ 'document' => $document, 'form' => $form->createView(), diff --git a/src/Bundle/ChillDocStoreBundle/EntityRepository/AccompanyingCourseDocumentRepository.php b/src/Bundle/ChillDocStoreBundle/EntityRepository/AccompanyingCourseDocumentRepository.php index 383529f52..c06ab1aee 100644 --- a/src/Bundle/ChillDocStoreBundle/EntityRepository/AccompanyingCourseDocumentRepository.php +++ b/src/Bundle/ChillDocStoreBundle/EntityRepository/AccompanyingCourseDocumentRepository.php @@ -3,8 +3,9 @@ namespace Chill\DocStoreBundle\Repository; use App\Entity\AccompanyingCourseDocument; -use Doctrine\Bundle\DoctrineBundle\Repository\ServiceEntityRepository; -use Doctrine\Persistence\ManagerRegistry; +use Chill\DocStoreBundle\Entity\AccompanyingCourseDocument as EntityAccompanyingCourseDocument; +use Doctrine\ORM\EntityManagerInterface; +use Doctrine\Persistence\ObjectRepository; /** * @method AccompanyingCourseDocument|null find($id, $lockMode = null, $lockVersion = null) @@ -12,39 +13,41 @@ use Doctrine\Persistence\ManagerRegistry; * @method AccompanyingCourseDocument[] findAll() * @method AccompanyingCourseDocument[] findBy(array $criteria, array $orderBy = null, $limit = null, $offset = null) */ -class AccompanyingCourseDocumentRepository extends ServiceEntityRepository +class AccompanyingCourseDocumentRepository implements ObjectRepository { - public function __construct(ManagerRegistry $registry) + private EntityRepository $repository; + + public function __construct(EntityManagerInterface $entityManager) { - parent::__construct($registry, AccompanyingCourseDocument::class); + $this->repository = $entityManager->getRepository(EntityAccompanyingCourseDocument::class); } - // /** - // * @return AccompanyingCourseDocument[] Returns an array of AccompanyingCourseDocument objects - // */ - /* - public function findByExampleField($value) + public function getClassName() { - return $this->createQueryBuilder('a') - ->andWhere('a.exampleField = :val') - ->setParameter('val', $value) - ->orderBy('a.id', 'ASC') - ->setMaxResults(10) - ->getQuery() - ->getResult() - ; + return EntityAccompanyingCourseDocument::class; } - */ - /* - public function findOneBySomeField($value): ?AccompanyingCourseDocument + public function find($id): ?EntityAccompanyingCourseDocument { - return $this->createQueryBuilder('a') - ->andWhere('a.exampleField = :val') - ->setParameter('val', $value) - ->getQuery() - ->getOneOrNullResult() - ; + return $this->repository->find($id); + } + + /** + * @return EntityAccompanyingCourseDocument[] + */ + + public function findAll(): array + { + return $this->repository->findAll(); + } + + public function findBy(array $criteria, $orderBy = null, $limit = null, $offset = null): array + { + return $this->repository->findBy($criteria, $orderBy, $limit, $offset); + } + + public function findOneBy(array $criteria): ?EntityAccompanyingCourseDocument + { + return $this->repository->findOneBy($criteria); } - */ } diff --git a/src/Bundle/ChillDocStoreBundle/Resources/views/AccompanyingCourseDocument/edit.html.twig b/src/Bundle/ChillDocStoreBundle/Resources/views/AccompanyingCourseDocument/edit.html.twig index 088a351f3..058960962 100644 --- a/src/Bundle/ChillDocStoreBundle/Resources/views/AccompanyingCourseDocument/edit.html.twig +++ b/src/Bundle/ChillDocStoreBundle/Resources/views/AccompanyingCourseDocument/edit.html.twig @@ -21,8 +21,8 @@