templates added and adapted, still problems with scope

This commit is contained in:
2021-09-03 16:05:55 +02:00
parent aad0d295ef
commit b11592fb6d
11 changed files with 518 additions and 67 deletions

View File

@@ -2,7 +2,8 @@
namespace Chill\DocStoreBundle\Controller;
use App\Entity\AccompanyingCourseDocument;
use Chill\DocStoreBundle\Entity\AccompanyingCourseDocument;
use Chill\DocStoreBundle\Form\AccompanyingCourseDocumentType;
use Chill\MainBundle\Security\Authorization\AuthorizationHelper;
use Chill\PersonBundle\Entity\AccompanyingPeriod;
use Chill\PersonBundle\Privacy\PrivacyEvent;
@@ -12,12 +13,13 @@ use Symfony\Component\EventDispatcher\EventDispatcherInterface;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Contracts\Translation\TranslatorInterface;
use Symfony\Component\Routing\Annotation\Route;
/**
* Class DocumentAccompanyingCourseController
*
* @package Chill\DocStoreBundle\Controller
* @Route("/{_locale}/parcours/course/document")
* @Route("/{_locale}/parcours/{course}/document")
*
* TODO faire un controller abstrait ?
*/
@@ -92,7 +94,7 @@ class DocumentAccompanyingCourseController extends AbstractController
'ChillDocStoreBundle:AccompanyingCourseDocument:index.html.twig',
[
'documents' => $documents,
'course' => $course
'accompanyingCourse' => $course
]);
}
@@ -134,7 +136,7 @@ class DocumentAccompanyingCourseController extends AbstractController
return $this->render('ChillDocStoreBundle:AccompanyingCourseDocument:new.html.twig', [
'document' => $document,
'form' => $form->createView(),
'course' => $course,
'accompanyingCourse' => $course,
]);
}
@@ -155,7 +157,7 @@ class DocumentAccompanyingCourseController extends AbstractController
return $this->render(
'ChillDocStoreBundle:AccompanyingCourseDocument:show.html.twig',
['document' => $document, 'course' => $course]);
['document' => $document, 'accompanyingCourse' => $course]);
}
/**
@@ -187,7 +189,7 @@ class DocumentAccompanyingCourseController extends AbstractController
return $this->redirectToRoute(
'accompanying_course_document_edit',
['id' => $document->getId(), 'course' => $course->getId()]);
['id' => $document->getId(), 'accompanyingCourse' => $course->getId()]);
} elseif ($form->isSubmitted() and !$form->isValid()) {
$this->addFlash('error', $this->translator->trans("This form contains errors"));
@@ -205,7 +207,7 @@ class DocumentAccompanyingCourseController extends AbstractController
[
'document' => $document,
'form' => $form->createView(),
'person' => $course,
'accompanyingCourse' => $course,
]);
}
@@ -224,6 +226,6 @@ class DocumentAccompanyingCourseController extends AbstractController
}
return $this->redirectToRoute(
'accompanying_course_document_index', ['course' => $course->getId()]);
'accompanying_course_document_index', ['accompanyingCourse' => $course->getId()]);
}
}