Commit af618b50 authored by Bertrand Gauthier's avatar Bertrand Gauthier
Browse files

WIP

parent 515c36fc
Loading
Loading
Loading
Loading
+3 −3
Original line number Diff line number Diff line
@@ -308,9 +308,9 @@ return array(
        'factories' => [
            'EcoleDoctoraleForm' => EcoleDoctoraleFormFactory::class,
        ],
//        'initializers' => [
//            'UnicaenApp\Service\EntityManagerAwareInitializer',
//        ],
        'initializers' => [
            ServiceAwareInitializer::class,
        ]
    ],
    'public_files' => [
        'head_scripts' => [
+141 −0
Original line number Diff line number Diff line
<?php

namespace Application\Entity\Db\Workflow;

abstract class AbstractVWorkflow // todo : renommer en AbstractWorkflowElement
{
    /**
     * @var \Application\Entity\Db\Workflow\AbstractWfEtape
     */
    protected AbstractWfEtape $etape;

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

    /**
     * @var integer
     */
    protected $ordre;

    /**
     * @var bool
     */
    protected $franchie = false;

    /**
     * @var bool
     */
    protected $atteignable = false;

    /**
     * @var bool
     */
    protected $courante = false;

    /**
     * @var integer
     */
    protected $resultat;

    /**
     * @var integer
     */
    protected $objectif;

    public function setEtape(AbstractWfEtape $etape): static
    {
        $this->etape = $etape;

        return $this;
    }

    public function getEtape(): AbstractWfEtape
    {
        return $this->etape;
    }

    /**
     * Get ordre
     *
     * @return integer
     */
    public function getOrdre()
    {
        return $this->ordre;
    }

    /**
     * Get franchie
     *
     * @return bool
     */
    public function getFranchie()
    {
        return $this->franchie;
    }

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

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

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

    /**
     * Get resultat
     *
     * @return integer
     */
    public function getResultat()
    {
        return $this->resultat;
    }

    /**
     * Get objectif
     *
     * @return integer
     */
    public function getObjectif()
    {
        return $this->objectif;
    }


    public static function pseudoEtapeFinale(): static
    {
        $inst = new static();
        $inst->etape = AbstractWfEtape::pseudoEtapeFinale();
        $inst->franchie = false;
        $inst->atteignable = true;

        return $inst;
    }

    public function estNull(): bool
    {
        return $this instanceof VWorkflowNull;

    }
}
+299 −0
Original line number Diff line number Diff line
<?php

namespace Application\Entity\Db\Workflow;

abstract class AbstractWfEtape implements WfEtapeEtatAwareInterface
{
    use WfEtapeEtatAwareTrait;

    const PSEUDO_ETAPE_FINALE = 'pseudo-etape-finale';

    /**
     * @var string
     */
    protected $code;

    /**
     * @var string
     */
    protected $libelleActeur;

    /**
     * @var string
     */
    protected $libelleAutres;

    /**
     * @var integer
     */
    protected $ordre;

    /**
     * @var integer
     */
    protected $chemin;

    /**
     * @var string
     */
    protected $route;

    /**
     * @var boolean
     */
    protected $obligatoire;

    /**
     * @var string
     */
    protected $descNonFranchie;

    /**
     * @var string
     */
    protected $descSansObjectif;

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

    /**
     * @var bool
     */
    protected $estPseudoEtapeFinale = false;

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

    /**
     * Set code
     *
     * @param string $code
     */
    public function setCode($code)
    {
        $this->code = $code;

        return $this;
    }

    /**
     * Get code
     *
     * @return string
     */
    public function getCode()
    {
        return $this->code;
    }

    /**
     * Set libelleActeur
     *
     * @param string $libelleActeur
     */
    public function setLibelleActeur($libelleActeur)
    {
        $this->libelleActeur = $libelleActeur;

        return $this;
    }

    /**
     * Get libelleActeur
     *
     * @return string
     */
    public function getLibelleActeur()
    {
        return $this->libelleActeur;
    }

    /**
     * Set libelleAutres
     *
     * @param string $libelleAutres
     */
    public function setLibelleAutres($libelleAutres)
    {
        $this->libelleAutres = $libelleAutres;

        return $this;
    }

    /**
     * Get libelleAutres
     *
     * @return string
     */
    public function getLibelleAutres()
    {
        return $this->libelleAutres;
    }

    /**
     * Set ordre
     *
     * @param integer $ordre
     */
    public function setOrdre($ordre)
    {
        $this->ordre = $ordre;

        return $this;
    }

    /**
     * Get ordre
     *
     * @return integer
     */
    public function getOrdre()
    {
        return $this->ordre;
    }

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

    /**
     * @param int $chemin
     * @return $this
     */
    public function setChemin($chemin)
    {
        $this->chemin = $chemin;

        return $this;
    }

    /**
     * Set route
     *
     * @param string $route
     */
    public function setRoute($route)
    {
        $this->route = $route;

        return $this;
    }

    /**
     * Get route
     *
     * @return string
     */
    public function getRoute()
    {
        return $this->route;
    }

    /**
     * Set obligatoire
     *
     * @param boolean $obligatoire
     */
    public function setObligatoire($obligatoire)
    {
        $this->obligatoire = $obligatoire;

        return $this;
    }

    /**
     * Get obligatoire
     *
     * @return boolean
     */
    public function getObligatoire()
    {
        return $this->obligatoire;
    }

    /**
     * Set descNonFranchie
     *
     * @param string $descNonFranchie
     */
    public function setDescNonFranchie($descNonFranchie)
    {
        $this->descNonFranchie = $descNonFranchie;

        return $this;
    }

    /**
     * Get descNonFranchie
     *
     * @return string
     */
    public function getDescNonFranchie()
    {
        return $this->descNonFranchie;
    }

    /**
     * Set descSansObjectif
     *
     * @param string $descSansObjectif
     */
    public function setDescSansObjectif($descSansObjectif)
    {
        $this->descSansObjectif = $descSansObjectif;

        return $this;
    }

    /**
     * Get descSansObjectif
     *
     * @return string
     */
    public function getDescSansObjectif()
    {
        return $this->descSansObjectif;
    }

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

    public function estPseudoEtapeFinale(): bool
    {
        return $this->estPseudoEtapeFinale;
    }

    public static function pseudoEtapeFinale(): static
    {
        $inst = new static();

        $inst->setCode(static::PSEUDO_ETAPE_FINALE);
//        $inst->setLibelleActeur("C'est terminé : dépôt validé.");
//        $inst->setLibelleAutres("C'est terminé : dépôt validé.");
        $inst->setLibelleActeur("C'est terminé.");
        $inst->setLibelleAutres("C'est terminé.");
        $inst->setOrdre(100000000000);
        $inst->setChemin(1);
        $inst->setRoute(null);
        $inst->setObligatoire(false);

        $inst->estPseudoEtapeFinale = true;

        return $inst;
    }
}
 No newline at end of file
+27 −0
Original line number Diff line number Diff line
<?php

namespace Application\Entity\Db\Workflow;

/**
 * Null Object Pattern.
 *
 * @author Unicaen
 */
class VWorkflowNull extends AbstractVWorkflow
{
    private static ?VWorkflowNull $instance = null;

    static public function inst(): static
    {
        if (null === static::$instance) {
            static::$instance = new static();
        }

        return static::$instance;
    }

    protected function __construct()
    {
        $this->setEtape(WfEtapeNull::inst());
    }
}
 No newline at end of file
+28 −0
Original line number Diff line number Diff line
<?php

namespace Application\Entity\Db\Workflow;

/**
 * Trait spécifiant les propriétés et accesseurs utiles pour obtenir l'état d'une étape de workflow.
 *
 * @author Bertrand GAUTHIER <bertrand.gauthier at unicaen.fr>
 */
interface WfEtapeEtatAwareInterface
{
    public function getPrecedente(): ?AbstractWfEtape;

    public function setPrecedente(?AbstractWfEtape $precedente = null, bool $reciprocite = true): void;

    public function getSuivante(): ?AbstractWfEtape;

    public function setSuivante(?AbstractWfEtape $suivante = null, bool $reciprocite = true): void;

    public function getFranchie(): bool;

    public function setFranchie(bool $franchie = true);

    public function getAtteignable(): bool;

    public function setAtteignable(bool $atteignable = true);

}
 No newline at end of file
Loading