Commit d6dbf07d authored by Antony Le Courtes's avatar Antony Le Courtes
Browse files

Correction sur recherche typeAgrement

parent 6719fa05
Loading
Loading
Loading
Loading
Loading
+4 −6
Changes for module/Agrement/src/Controller/AgrementController.php: 4 added lines, 6 removed lines.
Original line number Diff line number Diff line
@@ -151,19 +151,17 @@ class AgrementController extends AbstractController
    public function saisirAction()
    {
        $this->initFilters();

        /* @var $agrement Agrement */
        $agrement = $this->getEvent()->getParam('agrement');

        if (!$agrement) {
            $typeAgrementCode = $this->getEvent()->getRouteMatch()->getParam('typeAgrementCode');
            $typeAgrement = $this->getServiceTypeAgrement()->getByCode($typeAgrementCode);

            $idTypeAgrement = $this->getEvent()->getRouteMatch()->getParam('typeAgrement');
            $typeAgrement   = $this->getServiceTypeAgrement()->get($idTypeAgrement);
            if ($typeAgrement) {
                $agrement = $this->getServiceAgrement()->newEntity();
                $agrement->setType($typeAgrement);
                $agrement->setIntervenant($this->getEvent()->getParam('intervenant'));
                $agrement->setStructure($this->getEvent()->getParam('structure'));
            }
        }

        $form = $this->getFormAgrementSaisie();
        $form->bindRequestSave($agrement, $this->getRequest(), function ($a) {
+3 −2
Changes for module/Agrement/src/Service/TypeAgrementService.php: 3 added lines, 2 removed lines.
Original line number Diff line number Diff line
@@ -39,7 +39,7 @@ class TypeAgrementService extends AbstractEntityService



    public function getByCode(string $code): TypeAgrement
    public function getByCode(string $code): ?TypeAgrement
    {
        if ($code) {
            return $this->getRepo()->findOneBy(['code' => $code]);
@@ -65,7 +65,8 @@ class TypeAgrementService extends AbstractEntityService
     */
    public function orderBy(?QueryBuilder $qb = null, $alias = null)
    {
        [$qb, $alias] = $this->initQuery($qb, $alias);
        [$qb,
         $alias] = $this->initQuery($qb, $alias);
        $qb->addOrderBy("$alias.id");

        return $qb;