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

Les indicateurs et les tableaux de bords sont maintenant munis de namespace

parent 2967bd2b
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -11,7 +11,7 @@
        "unicaen/app": "^4|^5",
        "unicaen/utilisateur": "^4|^5",
        "unicaen/privilege": "^4|^5",
        "unicaen/mail": "^4|^5"
        "unicaen/mail": "^5"
    },
    "autoload": {
        "psr-0": [],
+6 −2
Original line number Diff line number Diff line
@@ -66,17 +66,21 @@ class IndicateurController extends AbstractActionController {
    public function creerAction() : ViewModel
    {
        $indicateur = new Indicateur();

        $namespace = $this->params()->fromQuery('namespace');
        if ($namespace) $indicateur->setNamespace($namespace);

        $form = $this->getIndicateurForm();
        $form->setAttribute('action', $this->url()->fromRoute('indicateur/creer', [], [], true));
        $form->setAttribute('action', $this->url()->fromRoute('indicateur/creer', [], ['query' => ['namespace' => $namespace]], true));
        $form->bind($indicateur);

        /** @var Request $request */
        $request = $this->getRequest();
        if ($request->isPost()) {
            $data = $request->getPost();
            $form->setData($data);
            if ($form->isValid()) {
                $indicateur->setDernierRafraichissement(new DateTime());

                $this->getIndicateurService()->create($indicateur);
                $this->getIndicateurService()->createView($indicateur);
            }
+3 −0
Original line number Diff line number Diff line
@@ -39,6 +39,9 @@ class TableauDeBordController extends AbstractActionController
    {
        $tableau = new TableauDeBord();

        $namespace = $this->params()->fromQuery('namespace');
        if ($namespace) $tableau->setNamespace($namespace);

        $form = $this->getTableauDeBordForm();
        $form->setAttribute('action', $this->url()->fromRoute('tableau-de-bord/ajouter', [], [], true));
        $form->bind($tableau);
+11 −0
Original line number Diff line number Diff line
@@ -20,6 +20,7 @@ class Indicateur {
    private ?DateTime $dernierRafraichissement = null;
    private ?string $viewId = null;
    private ?string $entity = null;
    private ?string $namespace = null;
    private Collection $abonnements;
    private Collection $tableaux;

@@ -94,6 +95,16 @@ class Indicateur {
        $this->entity = $entity;
    }

    public function getNamespace(): ?string
    {
        return $this->namespace;
    }

    public function setNamespace(?string $namespace): void
    {
        $this->namespace = $namespace;
    }

    /** Abonnements **************************************************************** */

    /**
+1 −0
Original line number Diff line number Diff line
@@ -12,6 +12,7 @@
        <field name="dernierRafraichissement"      type="datetime"      column="dernier_rafraichissement" nullable="true"/>
        <field name="viewId"            type="string" length="255"      column="view_id"                nullable="true"/>
        <field name="entity"            type="string" length="255"      column="entity"                nullable="true"/>
        <field name="namespace"         type="string" length="1024"     column="namespace"             nullable="true"/>

        <one-to-many target-entity="UnicaenIndicateur\Entity\Db\Abonnement" field="abonnements" mapped-by="indicateur" />

Loading