public function UpdateWidgetType() { /** @var \Icap\PortfolioBundle\Entity\Widget\WidgetType|null $widgetType */ $widgetType = $this->entityManager->getRepository('IcapPortfolioBundle:Widget\\WidgetType')->findOneBy(array('name' => 'badges')); if (null === $widgetType) { $widgetType = new WidgetType(); $widgetType->setName('badges')->setIcon('trophy')->setIsUnique(false)->setIsDeletable(true); $this->entityManager->persist($widgetType); $this->entityManager->flush(); } }
/** * {@inheritdoc} */ public function load(ObjectManager $manager) { /* * array format: * - name * - icon class */ $widgetTypes = array(array('userInformation', 'info'), array('text', 'align-left'), array('skills', 'bookmark'), array('formations', 'graduation-cap'), array('experience', 'briefcase')); foreach ($widgetTypes as $widgetType) { $entity = new WidgetType(); $entity->setName($widgetType[0])->setIcon($widgetType[1]); $manager->persist($entity); } $manager->flush(); }
/** * @return WidgetType */ public function createBadgeWidgetType() { $widgetType = new WidgetType(); return $widgetType->setName('badges')->setIcon('trophy'); }