From 0602505f63a8e67d60fa1e7eeec8ad2cb8cfcfb1 Mon Sep 17 00:00:00 2001 From: afornerot Date: Wed, 15 Jul 2020 15:36:18 +0200 Subject: [PATCH] =?UTF-8?q?creation=20categorie=20alerte=20par=20d=C3=A9fa?= =?UTF-8?q?ut=20(ref=20#189)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../PortalBundle/Command/InitDataCommand.php | 20 +++++++++++++++++++ .../PortalBundle/Entity/Alertcategory.php | 7 +++++++ 2 files changed, 27 insertions(+) diff --git a/src/ninegate-1.0/src/Cadoles/PortalBundle/Command/InitDataCommand.php b/src/ninegate-1.0/src/Cadoles/PortalBundle/Command/InitDataCommand.php index b0f1d0d8..fab8fb27 100644 --- a/src/ninegate-1.0/src/Cadoles/PortalBundle/Command/InitDataCommand.php +++ b/src/ninegate-1.0/src/Cadoles/PortalBundle/Command/InitDataCommand.php @@ -21,6 +21,7 @@ use Cadoles\PortalBundle\Entity\Appexternal; use Cadoles\PortalBundle\Entity\Flux; use Cadoles\PortalBundle\Entity\Projecttasktag; use Cadoles\PortalBundle\Entity\Projecttaskstatus; +use Cadoles\PortalBundle\Entity\Alertcategory; use Cadoles\PortalBundle\Entity\Itemcategory; use Cadoles\PortalBundle\Entity\Item; @@ -95,6 +96,10 @@ class InitDataCommand extends ContainerAwareCommand $metadata->setIdGeneratorType(ClassMetadata::GENERATOR_TYPE_NONE); $metadata->setIdGenerator(new AssignedGenerator()); + $metadata = $em->getClassMetaData('CadolesPortalBundle:Alertcategory'); + $metadata->setIdGeneratorType(ClassMetadata::GENERATOR_TYPE_NONE); + $metadata->setIdGenerator(new AssignedGenerator()); + $metadata = $em->getClassMetaData('CadolesPortalBundle:Itemcategory'); $metadata->setIdGeneratorType(ClassMetadata::GENERATOR_TYPE_NONE); $metadata->setIdGenerator(new AssignedGenerator()); @@ -318,6 +323,21 @@ class InitDataCommand extends ContainerAwareCommand } +//== ALERTCATEGORY======================================================================================================================================== + $output->writeln(' > Creation Alert Category'); + + $entityicon = $em->getRepository('CadolesPortalBundle:Icon')->findoneby(["label"=>"uploads/icon/icon_megaphone2.png"]); + $entityAlertcategoryapp = $em->getRepository('CadolesPortalBundle:Alertcategory')->find(-100); + if(!$entityAlertcategoryapp) { + $entityAlertcategoryapp = new Alertcategory(); + $entityAlertcategoryapp->setId(-100); + $entityAlertcategoryapp->setColor("00a996"); + $entityAlertcategoryapp->setLabel('Annonces'); + $entityAlertcategoryapp->setIcon($entityicon); + $em->persist($entityAlertcategoryapp); + } + + //== ITEMCATEGORY======================================================================================================================================== $output->writeln(' > Creation Item Category'); diff --git a/src/ninegate-1.0/src/Cadoles/PortalBundle/Entity/Alertcategory.php b/src/ninegate-1.0/src/Cadoles/PortalBundle/Entity/Alertcategory.php index 3999c47c..3eb72d09 100644 --- a/src/ninegate-1.0/src/Cadoles/PortalBundle/Entity/Alertcategory.php +++ b/src/ninegate-1.0/src/Cadoles/PortalBundle/Entity/Alertcategory.php @@ -50,6 +50,13 @@ class Alertcategory */ protected $alerts; + // A garder pour forcer l'id en init + public function setId($id) + { + $this->id = $id; + return $this; + } + /** * Constructor