corrections review 107

This commit is contained in:
Julie Lenaerts 2021-09-28 09:33:47 +02:00
parent d60b6aa3c4
commit 93c0197cdb
3 changed files with 38 additions and 35 deletions

View File

@ -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(),

View File

@ -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 find($id): ?EntityAccompanyingCourseDocument
{
return $this->repository->find($id);
}
/**
* @return EntityAccompanyingCourseDocument[]
*/
/*
public function findOneBySomeField($value): ?AccompanyingCourseDocument
public function findAll(): array
{
return $this->createQueryBuilder('a')
->andWhere('a.exampleField = :val')
->setParameter('val', $value)
->getQuery()
->getOneOrNullResult()
;
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);
}
*/
}

View File

@ -21,8 +21,8 @@
<ul class="record_actions">
<li class="cancel">
<a href="{{ path('accompanying_course_document_index', {'course': accompanyingCourse.id}) }}" class="btn btn-cancel">
{{ 'Back to the list' | trans }}
<a href="{{ chill_return_path_or('accompanying_course_document_index', {'course': accompanyingCourse.id}) }}" class="btn btn-cancel">
{{ 'Cancel' | trans }}
</a>
</li>
<li class="edit">