Commit a6374197 authored by Jean-Baptiste Oellers's avatar Jean-Baptiste Oellers
Browse files

Ajout convention information

parent 9f099abb
Loading
Loading
Loading
Loading
+2 −1
Original line number Diff line number Diff line
@@ -619,7 +619,8 @@ return array(
                    'controller' => 'ConventionAdministration',
                    'action' => [
                        'conventions',
                        'conventionConfigurer'
                        'conventionConfigurer',
                        'conventionConfigurerInformationsAjouter'
                    ],
                    'roles' => ['user']
                ],
+14 −0
Original line number Diff line number Diff line
@@ -2095,6 +2095,20 @@ administration:
            route: /:id
            defaults:
              action: conventionConfigurer
          child_routes:
            informations:
              type: segment
              may_terminate: false
              options:
                route: /informations
              child_routes:
                ajouter:
                  type: segment
                  may_terminate: true
                  options:
                    route: /ajouter
                    defaults:
                      action: conventionConfigurerInformationsAjouter

    # Gestion et chargement du référenciel des pays
    logs:
+11 −0
Original line number Diff line number Diff line
@@ -43,4 +43,15 @@ class ConventionAdministrationController extends AbstractOscarController

        return $this->redirect()->toRoute('administration/conventions/configurer', ['id' => $convention->id]);
    }

    public function conventionConfigurerInformationsAjouterAction()
    {
        /** @var \Oscar\Entity\Convention $convention */
        $convention = $this->getEntityManager()->find(\Oscar\Entity\Convention::class, $this->params('id'));
        if (!$convention) {
            return $this->getResponseNotFound("La convention n'a pas été trouvée.");
        }
        
        return ['convention' => $convention];
    }
}
+10 −0
Original line number Diff line number Diff line
@@ -48,9 +48,19 @@ class Convention
     */
    public $updatedBy;

    /**
     * Informations
     *
     * @var \Doctrine\Common\Collections\ArrayCollection
     * @ORM\OneToMany(targetEntity="ConventionInformation", mappedBy="convention", cascade={"remove"}, fetch="EAGER")
     * @ORM\OrderBy({"nom" = "ASC"})
     */
    public $informations;

    public function __construct()
    {
        $this->dateCreated = new \DateTime();
        $this->informations = new \Doctrine\Common\Collections\ArrayCollection();
    }

    public function __toString()
+71 −0
Original line number Diff line number Diff line
<?php

namespace Oscar\Entity;

use Doctrine\ORM\Mapping as ORM;

/**
 * Class ConventionInformation
 * @package Oscar\Entity
 * @ORM\Entity
 */
class ConventionInformation
{
    /**
     * @ORM\Id
     * @ORM\GeneratedValue(strategy="IDENTITY")
     * @ORM\Column(type="integer")
     */
    public $id;

    /**
     * @var string
     * @ORM\Column(type="text")
     */
    public $nom;

    /**
     * @var \DateTime
     * @ORM\Column(type="datetime", nullable=false)
     */
    public $dateCreated;

    /**
     * @var Person
     * @ORM\ManyToOne(targetEntity="Person")
     */
    public $createdBy;

        /**
     * @var \DateTime
     * @ORM\Column(type="datetime", nullable=true)
     */
    public $dateUpdated;

    /**
     * @var Person
     * @ORM\ManyToOne(targetEntity="Person")
     */
    public $updatedBy;

    /**
     * @var \Oscar\Entity\Convention
     * @ORM\ManyToOne(targetEntity="Convention", inversedBy="informations")
     */
    public $convention;

    public function __construct()
    {
        $this->dateCreated = new \DateTime();
    }

    public function __toString()
    {
        return (string) $this->nom;
    }

    public function getResourceId()
    {
        return self::class;
    }
}
Loading