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

WIP

parent fe095e25
Loading
Loading
Loading
Loading
+0 −178
Original line number Diff line number Diff line
<?php

namespace Application\Entity\Db;

use Application\Entity\Db\Interfaces\HasDescriptionInterface;
use Application\Entity\Db\Traits\HasDescriptionTrait;
use Doctrine\Common\Collections\ArrayCollection;

class Application implements HasDescriptionInterface {
    use HasDescriptionTrait;

    /** @var integer */
    private $id;
    /** @var string */
    private $libelle;
    /** @var string */
    private $url;
    /** @var boolean */
    private $actif;
    /** @var ApplicationTheme */
    private $groupe;

    /** @var ArrayCollection */
    private  $activites;
    /** @var ArrayCollection */
    private  $formations;

    public function __construct()
    {
        $this->activites = new ArrayCollection();
        $this->formations = new ArrayCollection();
    }

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

    /**
     * @return string
     */
    public function getLibelle()
    {
        return $this->libelle;
    }

    /**
     * @param string $libelle
     * @return Application
     */
    public function setLibelle($libelle)
    {
        $this->libelle = $libelle;
        return $this;
    }

    /**
     * @return string
     */
    public function getUrl()
    {
        return $this->url;
    }

    /**
     * @param string $url
     * @return Application
     */
    public function setUrl($url)
    {
        $this->url = $url;
        return $this;
    }

    /**
     * @return bool
     */
    public function isActif()
    {
        return $this->actif;
    }

    /**
     * @param bool $actif
     * @return Application
     */
    public function setActif($actif)
    {
        $this->actif = $actif;
        return $this;
    }

    /**
     * @return ApplicationTheme
     */
    public function getGroupe()
    {
        return $this->groupe;
    }

    /**
     * @param ApplicationTheme $groupe
     * @return Application
     */
    public function setGroupe($groupe)
    {
        $this->groupe = $groupe;
        return $this;
    }

    /**
     * @return Activite[]
     */
    public function getActivites()
    {
        return $this->activites->toArray();
    }

    /**
     * @param Activite $activite
     * @return Application
     */
    public function addApplication($activite)
    {
        $this->activites->add($activite);
        return $this;
    }

    /**
     * @param Activite $activite
     * @return Application
     */
    public function removeApplication($activite)
    {
        $this->activites->removeElement($activite);
        return $this;
    }

    /**
     * @param Activite $activite
     * @return boolean
     */
    public function hasApplication($activite)
    {
        return $this->activites->contains($activite);
    }

    /**
     * @return Formation[]
     */
    public function getFormations()
    {
        return $this->formations->toArray();
    }

    /**
     * @param Formation $formation
     * @return Application
     */
    public function addFormation($formation)
    {
        $this->formations->add($formation);
        return $this;
    }

    /**
     * @param Formation $formation
     * @return Application
     */
    public function removeFormation($formation)
    {
        $this->formations->removeElement($formation);
        return $this;
    }
}
 No newline at end of file
+2 −3
Original line number Diff line number Diff line
@@ -2,6 +2,7 @@

namespace Application\Entity\Db;

use Doctrine\Common\Collections\Collection;
use Element\Entity\Db\ApplicationElement;
use Element\Entity\Db\Competence;
use Element\Entity\Db\CompetenceElement;
@@ -24,13 +25,11 @@ class FicheMetier implements HistoriqueAwareInterface, HasEtatInterface,
    use HasApplicationCollectionTrait;
    use HasCompetenceCollectionTrait;

    /** @var int */
    private ?int $id = -1;
    private ?Metier $metier = null;
    private ?bool $hasExpertise = false;

    /** @var ArrayCollection */
    private $activites;
    private Collection $activites;

    public function __construct()
    {
+10 −32
Original line number Diff line number Diff line
@@ -2,61 +2,39 @@

namespace Application\Entity\Db;

use Element\Entity\Db\Application;
use UnicaenUtilisateur\Entity\Db\HistoriqueAwareInterface;
use UnicaenUtilisateur\Entity\Db\HistoriqueAwareTrait;

class FicheposteApplicationRetiree implements HistoriqueAwareInterface {
    use HistoriqueAwareTrait;

    /** @var integer */
    private $id;
    /** @var FichePoste */
    private $fichePoste;
    /** @var Application */
    private $application;

    /**
     * @return int
     */
    public function getId()
    private ?int $id = null;
    private ?FichePoste $fichePoste = null;
    private ?Application $application = null;

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

    /**
     * @return FichePoste
     */
    public function getFichePoste()
    public function getFichePoste() : ?FichePoste
    {
        return $this->fichePoste;
    }

    /**
     * @param FichePoste $fichePoste
     * @return FicheposteApplicationRetiree
     */
    public function setFichePoste($fichePoste)
    public function setFichePoste(?FichePoste $fichePoste) : void
    {
        $this->fichePoste = $fichePoste;
        return $this;
    }


    /**
     * @return Application
     */
    public function getApplication()
    public function getApplication() : ?Application
    {
        return $this->application;
    }

    /**
     * @param Application $application
     * @return FicheposteApplicationRetiree
     */
    public function setApplication($application)
    public function setApplication(?Application $application) : void
    {
        $this->application = $application;
        return $this;
    }
}
 No newline at end of file
+0 −92
Original line number Diff line number Diff line
-- role de validateur
insert into user_role (id, libelle, role_id, is_default)
values (6, 'Validateur', 'Validateur', false);

-- categorie privilege
insert into categorie_privilege (id, code, libelle, ordre)
values (20, 'validation', 'Gestion des validations', 700);

-- privilege
insert into privilege (id, categorie_id, code, libelle, ordre)
values (1,1,1,1,1);

-- tables

-- VALIDATION TYPE --
create table validation_type
(
    id serial not null constraint validation_type_pk primary key,
    code varchar(255) not null,
    libelle varchar(1024) not null
);
create unique index validation_type_id_uindex on validation_type (id);
create unique index validation_type_code_uindex on validation_type (code);

INSERT INTO validation_type (id, code, libelle)
VALUES (1, 'FICHE-METIER-RELECTURE', 'Relecture de fiche métier');

-- VALIDATION VALEUR
create table if not exists validation_valeur
(
    id serial not null constraint validation_valeur_pk primary key,
    code varchar(255) not null,
    libelle varchar(1023)
);

create unique index if not exists validation_valeur_id_uindex on validation_valeur (id);
create unique index if not exists validation_valeur_code_uindex on validation_valeur (code);

INSERT INTO validation_valeur (id, code, libelle) VALUES (1, 'VALIDER', 'Validé');
INSERT INTO validation_valeur (id, code, libelle) VALUES (2, 'REJETER', 'Rejeté');
INSERT INTO validation_valeur (id, code, libelle) VALUES (3, 'A MODIFIER', 'À modifier');

-- VALIDATION VALIDATION --
create table validation_validation
(
    id serial not null constraint validation_validation_pk primary key,
    type_id integer not null constraint validation_validation_validation_type_id_fk
            references validation_type on delete set null,
    valeur_id integer constraint validation_validation_validation_valeur_id_fk
            references validation_valeur on delete set null,
    commentaire text,
    histo_creation timestamp not null,
    histo_createur_id integer not null constraint validation_validation_user_id_fk_2
            references "user",
    histo_modification timestamp not null,
    histo_modificateur_id integer not null constraint validation_validation_user_id_fk_3
            references "user",
    histo_destruction timestamp,
    histo_destructeur_id integer constraint validation_validation_user_id_fk_4
            references "user",
    object_id varchar(40)
);

create unique index validation_validation_id_uindex on validation_validation (id);

-- VALIDATION DEMANDE --
create table validation_demande
(
    id serial not null constraint validation_demande_pk primary key,
    type_id integer not null constraint demande_validation_type_id_fk
            references validation_type,
    entity varchar(1023),
    object_id varchar(40),
    validateur_id integer not null constraint demande_validateur_id_fk
            references "user",
    validation_id integer constraint demande_validation_id_fk
            references validation_validation,
    histo_creation timestamp not null,
    histo_createur_id integer not null constraint demande_createur_id_fk
            references "user",
    histo_modification timestamp not null,
    histo_modificateur_id integer not null constraint demande_modificateur_id_fk
            references "user",
    histo_destruction timestamp,
    histo_destructeur_id integer constraint demande_destructeur_id_fk
            references "user"
);

create unique index validation_demande_id_uindex on validation_demande (id);


+6 −15
Original line number Diff line number Diff line
@@ -2,25 +2,20 @@

namespace Element\Entity\Db\Traits;

use Doctrine\Common\Collections\Collection;
use Element\Entity\Db\Application;
use Element\Entity\Db\ApplicationElement;
use Doctrine\Common\Collections\ArrayCollection;

trait HasApplicationCollectionTrait
{

    /** @var ArrayCollection */
    private $applications;
    private Collection $applications;

    public function getApplicationCollection()
    public function getApplicationCollection() : Collection
    {
        return $this->applications;
    }

    /**
     * @param bool $avecHisto
     * @return ApplicationElement[]
     */
    public function getApplicationListe(bool $avecHisto = false): array
    {
        $applications = [];
@@ -31,7 +26,7 @@ trait HasApplicationCollectionTrait
        return $applications;
    }

    public function getApplicationDictionnaire()
    public function getApplicationDictionnaire() : array
    {
        $dictionnaire = [];
        foreach ($this->applications as $applicationElement) {
@@ -44,10 +39,6 @@ trait HasApplicationCollectionTrait
        return $dictionnaire;
    }

    /**
     * @param Application $application
     * @return ApplicationElement|null
     */
    public function hasApplication(Application $application): ?ApplicationElement
    {
        /** @var ApplicationElement $applicationElement */
@@ -57,12 +48,12 @@ trait HasApplicationCollectionTrait
        return null;
    }

    public function addApplicationElement(ApplicationElement $element)
    public function addApplicationElement(ApplicationElement $element) : void
    {
        $this->applications->add($element);
    }

    public function removeApplicationElement(ApplicationElement $element)
    public function removeApplicationElement(ApplicationElement $element) : void
    {
        $this->applications->removeElement($element);
    }