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