creation categorie alerte par défaut (ref #189)

This commit is contained in:
afornerot 2020-07-15 15:36:18 +02:00
parent c4815ac935
commit 0602505f63
2 changed files with 27 additions and 0 deletions

View File

@ -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');

View File

@ -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