Commit 3c6bd3bc authored by Jean-Philippe Metivier's avatar Jean-Philippe Metivier
Browse files

Ajout de la colonne mot clef dans les instances d'événements

parent 38baec06
Loading
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -34,6 +34,7 @@ create table unicaen_evenement_instance
    type_id integer not null constraint fk_evenement_instance_type references unicaen_evenement_type deferrable,
    etat_id integer not null constraint fk_evenement_instance_etat references unicaen_evenement_etat deferrable,
    parametres text,
    mots_clefs text,
    date_creation timestamp not null,
    date_planification timestamp not null,
    date_traitement timestamp,

doc/release/5.0.2.md

0 → 100644
+4 −0
Original line number Diff line number Diff line
```sql
alter table unicaen_evenement_instance add mots_clefs text;
```
+68 −219
Original line number Diff line number Diff line
@@ -8,337 +8,186 @@ use Doctrine\Common\Collections\Collection;

class Evenement {
    const DATE_FORMAT = 'd/m/Y H:i';
    const SEPARATOR = ';';

    private ?int $id = -1;

    private ?string $nom = null;
    private ?string $description = null;
    private ?Type $type = null;
    private ?string $parametres = null;
    private ?string $motsClefs = null;

    private ?Etat $etat;
    private ?string $log = null;

    private ?DateTime $dateCreation = null;
    private ?DateTime $datePlanification = null;
    private ?DateTime $dateTraitement = null;
    private ?DateTime $dateFin = null;

    private ?Evenement $parent = null;
    private Collection $fils;

    /**
     * @var integer
     */
    private $id;

    /**
     * @var string
     */
    private $nom;

    /**
     * @var string
     */
    private $description;

    /**
     * @var Type
     */
    private $type;

    /**
     * @var Etat
     */
    private $etat;

    /**
     * @var string
     */
    private $parametres;

    /**
     * @var DateTime
     */
    private $dateCreation;

    /**
     * @var DateTime
     */
    private $datePlanification;

    /**
     * @var DateTime
     */
    private $dateTraitement;

    /**
     * @var DateTime
     */
    private $dateFin;

    /**
     * @var string
     */
    private $log;

    /**
     * @var Evenement
     */
    private $parent;

    /**
     * @var Collection
     */
    private $fils;

    /**
     * Constructor
     */
    public function __construct()
    {
        $this->fils = new ArrayCollection();
    }


    /**
     * @return int
     */
    public function getId()
    public function getId() : ?int
    {
        return $this->id;
    }

    /**
     * @param string $nom
     * @return self
     */
    public function setNom($nom)
    /** DESCRIPTION ***************************************************************************************************/

    public function setNom(?string $nom) : void
    {
        $this->nom = $nom;

        return $this;
    }

    /**
     * @return string
     */
    public function getNom()
    public function getNom() : ?string
    {
        return $this->nom;
    }

    /**
     * @return string
     */
    public function getDescription()
    public function getDescription() : ?string
    {
        return $this->description;
    }

    /**
     * @param string $description
     * @return self
     */
    public function setDescription($description)
    public function setDescription(?string $description) : void
    {
        $this->description = $description;

        return $this;
    }

    /**
     * @return Type
     */
    public function getType()
    public function getType() : ?Type
    {
        return $this->type;
    }

    /**
     * @param Type $type
     * @return self
     */
    public function setType($type)
    public function setType(?Type $type) : void
    {
        $this->type = $type;

        return $this;
    }

    /**
     * @return Etat
     */
    public function getEtat()
    public function getParametres() : ?string
    {
        return $this->etat;
        return $this->parametres;
    }

    /**
     * @param Etat $etat
     * @return self
     */
    public function setEtat($etat)
    public function setParametres(?string $parametres) : void
    {
        $this->etat = $etat;

        return $this;
        $this->parametres = $parametres;
    }

    /**
     * @return string
     */
    public function getParametres()
    public function getMotsClefs(): ?string
    {
        return $this->parametres;
        return $this->motsClefs;
    }

    /**
     * @param string $parametres
     * @return self
     */
    public function setParametres($parametres)
    public function setMotsClefs(array $motsClefs): void
    {
        $this->parametres = $parametres;
        $this->motsClefs = implode(Evenement::SEPARATOR, $motsClefs);
    }

        return $this;
    public function hasMotClef(string $motclef): bool
    {
        $array = explode(Evenement::SEPARATOR, $this->motsClefs);
        return in_array($motclef, $array);
    }

    /**
     * @return DateTime
     */
    public function getDateCreation()
    /** DATES *********************************************************************************************************/

    public function getDateCreation() : ?DateTime
    {
        return $this->dateCreation;
    }

    /**
     * @param DateTime $dateCreation
     * @return self
     */
    public function setDateCreation($dateCreation)
    public function setDateCreation(?DateTime $dateCreation) : void
    {
        $this->dateCreation = $dateCreation;

        return $this;
    }

    /**
     * @return DateTime
     */
    public function getDatePlanification(): ?DateTime
    {
        return $this->datePlanification;
    }

    /**
     * @param DateTime $datePlanification
     * @return self
     */
    public function setDatePlanification(DateTime $datePlanification) : Evenement
    public function setDatePlanification(DateTime $datePlanification) : void
    {
        $this->datePlanification = $datePlanification;

        return $this;
    }

    /**
     * @return DateTime
     */
    public function getDateTraitement(): ?DateTime
    {
        return $this->dateTraitement;
    }

    /**
     * @param DateTime|null $dateTraitement
     * @return self
     */
    public function setDateTraitement(?DateTime $dateTraitement) : Evenement
    public function setDateTraitement(?DateTime $dateTraitement) : void
    {
        $this->dateTraitement = $dateTraitement;

        return $this;
    }

    /**
     * @return DateTime
     */
    public function getDateFin(): ?DateTime
    {
        return $this->dateFin;
    }

    /**
     * @param DateTime|null $dateFin
     * @return Evenement
     */
    public function setDateFin(?DateTime $dateFin): Evenement
    public function setDateFin(?DateTime $dateFin): void
    {
        $this->dateFin = $dateFin;
        return $this;
    }

    /** LOG et ETAT  **************************************************************************************************/

    public function getEtat() : ?Etat
    {
        return $this->etat;
    }

    /**
     * @return string
     */
    public function getLog()
    public function setEtat(?Etat $etat) : void
    {
        $this->etat = $etat;
    }

    public function getLog() : ?string
    {
        return $this->log;
    }

    /**
     * @param string $log
     * @return self
     */
    public function setLog($log)
    public function setLog(?string $log) : void
    {
        $this->log = $log;

        return $this;
    }

    /**
     * @return Evenement
     */
    public function getParent()
    /** ARBRE  ********************************************************************************************************/

    public function getParent() : ?Evenement
    {
        return $this->parent;
    }

    /**
     * @param Evenement $parent
     * @return self
     */
    public function setParent($parent)
    public function setParent(?Evenement $parent) : void
    {
        $this->parent = $parent;

        return $this;
    }

    /**
     * Add fils
     *
     * @param Evenement $fils
     *
     * @return self
     */
    public function addFils(Evenement $fils)
    public function addFils(Evenement $fils) : void
    {
        if(!$this->fils->contains($fils)) {
            $this->fils->add($fils);
        }

        return $this;
    }

    /**
     * Remove fils
     *
     * @param Evenement $fils
     *
     * @return self
     */
    public function removeFils(Evenement $fils)
    public function removeFils(Evenement $fils) : void
    {
        if($this->fils->contains($fils)) {
            $this->fils->removeElement($fils);
        }

        return $this;
    }

    /**
     * Get fils
     *
     * @return Collection
     */
    public function getFils()
    public function getFils() : Collection
    {
        return $this->fils;
    }
+1 −0
Original line number Diff line number Diff line
@@ -11,6 +11,7 @@
        <field name="nom" type="string" column="NOM" length="255" nullable="false"/>
        <field name="description" type="string" column="DESCRIPTION" length="1024" nullable="false"/>
        <field name="parametres" type="string" column="PARAMETRES" nullable="true"/>
        <field name="motsClefs" type="string" column="MOTS_CLEFS" nullable="true"/>
        <field name="dateCreation" type="datetime" column="DATE_CREATION" nullable="false"/>
        <field name="datePlanification" type="datetime" column="DATE_PLANIFICATION" nullable="false"/>
        <field name="dateTraitement" type="datetime" column="DATE_TRAITEMENT" nullable="true"/>