Commit 6a5c1d21 authored by Antony Le Courtes's avatar Antony Le Courtes
Browse files

Ajout date de début et de fin sur les tags

parent 4034f796
Loading
Loading
Loading
Loading
+24
Changes for data/ddl/table/TAG.php: 24 added lines, 0 removed lines.
Original line number Diff line number Diff line
@@ -129,6 +129,30 @@ return [
            'position'    => 4,
            'commentaire' => NULL,
        ],
        'DATE_DEBUT'            => [
            'name'        => 'DATE_DEBUT',
            'type'        => 'date',
            'bdd-type'    => 'DATE',
            'length'      => 0,
            'scale'       => NULL,
            'precision'   => NULL,
            'nullable'    => TRUE,
            'default'     => NULL,
            'position'    => 11,
            'commentaire' => NULL,
        ],
        'DATE_FIN'              => [
            'name'        => 'DATE_FIN',
            'type'        => 'date',
            'bdd-type'    => 'DATE',
            'length'      => 0,
            'scale'       => NULL,
            'precision'   => NULL,
            'nullable'    => TRUE,
            'default'     => NULL,
            'position'    => 12,
            'commentaire' => NULL,
        ],
    ],
];

+7 −4
Changes for module/Application/config/tag.config.php: 7 added lines, 4 removed lines.
Original line number Diff line number Diff line
@@ -2,6 +2,8 @@

namespace Application;

use Application\Form\Tag\TagSaisieForm;
use Application\Form\Tag\TagSaisieFormFactory;
use Application\Provider\Privilege\Privileges;
use UnicaenPrivilege\Guard\PrivilegeController;

@@ -100,9 +102,10 @@ return [
    ],
    'view_helpers'    => [
    ],
    'form_elements'   => [
        'invokables' => [
            Form\Tag\TagSaisieForm::class => Form\Tag\TagSaisieForm::class,
        ],


    'forms' => [
        TagSaisieForm::class => TagSaisieFormFactory::class,
    ],

];
+5 −2
Changes for module/Application/src/Controller/TagController.php: 5 added lines, 2 removed lines.
Original line number Diff line number Diff line
@@ -3,7 +3,7 @@
namespace Application\Controller;

use Application\Entity\Db\Tag;
use Application\Form\Tag\Traits\TagSaisieFormAwareTrait;
use Application\Form\Tag\TagSaisieFormAwareTrait;
use Application\Service\Traits\TagServiceAwareTrait;
use UnicaenApp\View\Model\MessengerViewModel;

@@ -25,12 +25,13 @@ class TagController extends AbstractController
    }



    public function saisirAction ()
    {
        /* @var $tag Tag */
        $tag  = $this->getEvent()->getParam('tag');
        $form = $this->getFormTag();

        $form = $this->getFormTagSaisie();
        if (empty($tag)) {
            $title = 'Création d\'un nouveau tag';
            $tag   = $this->getServiceTag()->newEntity();
@@ -38,6 +39,7 @@ class TagController extends AbstractController
            $title = 'Édition d\'un tag';
        }


        $form->bindRequestSave($tag, $this->getRequest(), function (Tag $tag) {
            try {
                $this->getServiceTag()->save($tag);
@@ -51,6 +53,7 @@ class TagController extends AbstractController
    }



    public function supprimerAction ()
    {
        $tag = $this->getEvent()->getParam('tag');
+5 −2
Changes for module/Application/src/Entity/Db/Mapping/Application.Entity.Db.Tag.dcm.xml: 5 added lines, 2 removed lines.
Original line number Diff line number Diff line
<?xml version="1.0" encoding="utf-8"?>
<doctrine-mapping xmlns="http://doctrine-project.org/schemas/orm/doctrine-mapping"
                  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
<doctrine-mapping xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
                  xmlns="http://doctrine-project.org/schemas/orm/doctrine-mapping"
                  xsi:schemaLocation="http://doctrine-project.org/schemas/orm/doctrine-mapping http://doctrine-project.org/schemas/orm/doctrine-mapping.xsd">
    <entity name="Application\Entity\Db\Tag" table="TAG">
        <indexes>
@@ -17,6 +17,9 @@
        <field name="histoModification" type="datetime" column="HISTO_MODIFICATION" nullable="false"/>
        <field name="libelleCourt" type="string" column="LIBELLE_COURT" length="50" nullable="false"/>
        <field name="libelleLong" type="string" column="LIBELLE_LONG" length="200" nullable="false"/>
        <field name="dateDebut" type="datetime" column="DATE_DEBUT" nullable="false"/>
        <field name="dateFin" type="datetime" column="DATE_FIN" nullable="false"/>
        
        <many-to-one field="histoModificateur" target-entity="Application\Entity\Db\Utilisateur">
            <join-columns>
                <join-column name="HISTO_MODIFICATEUR_ID" referenced-column-name="ID"/>
+52 −6
Changes for module/Application/src/Entity/Db/Tag.php: 52 added lines, 6 removed lines.
Original line number Diff line number Diff line
@@ -2,6 +2,7 @@

namespace Application\Entity\Db;

use Laminas\Validator\Date;
use UnicaenApp\Entity\HistoriqueAwareInterface;
use UnicaenApp\Entity\HistoriqueAwareTrait;

@@ -17,6 +18,11 @@ class Tag implements HistoriqueAwareInterface

    protected ?string  $libelleLong  = null;

    private ?\DateTime $dateDebut    = null;

    private ?\DateTime $dateFin      = null;



    public function getId (): ?int
    {
@@ -24,12 +30,14 @@ class Tag implements HistoriqueAwareInterface
    }



    public function getCode (): ?string
    {
        return $this->code;
    }



    public function setCode (?string $code): Tag
    {
        $this->code = $code;
@@ -38,12 +46,37 @@ class Tag implements HistoriqueAwareInterface
    }



    public function __toString (): string
    {
        return $this->getLibelleLong() ? : $this->getLibelleCourt();
    }



    public function getLibelleLong (): ?string
    {
        return $this->libelleLong;
    }



    public function setLibelleLong (?string $libelleLong): Tag
    {
        $this->libelleLong = $libelleLong;

        return $this;
    }



    public function getLibelleCourt (): ?string
    {
        return $this->libelleCourt;
    }



    public function setLibelleCourt (?string $libelleCourt): Tag
    {
        $this->libelleCourt = $libelleCourt;
@@ -52,22 +85,35 @@ class Tag implements HistoriqueAwareInterface
    }


    public function getLibelleLong(): ?string

    public function getDateDebut (): ?\DateTime
    {
        return $this->libelleLong;
        return $this->dateDebut;
    }


    public function setLibelleLong(?string $libelleLong): Tag

    public function setDateDebut (?\DateTime $dateDebut): Tag
    {
        $this->libelleLong = $libelleLong;
        $this->dateDebut = $dateDebut;

        return $this;
    }


    public function __toString(): string

    public function getDateFin (): ?\DateTime
    {
        return $this->getLibelleLong() ?: $this->getLibelleCourt();
        return $this->dateFin;
    }



    public function setDateFin (?\DateTime $dateFin): Tag
    {
        $this->dateFin = $dateFin;

        return $this;
    }

}
Loading