예제 #1
0
 /**
  * Create new entity BackBee\NestedNode\KeyWord with $keyword if not exists.
  *
  * @param string $keyword
  *
  * @return BackBee\NestedNode\KeyWord
  */
 public function createKeywordIfNotExists($keyword, $do_persist = true)
 {
     if (null === ($keyword_object = $this->em->getRepository('BackBee\\NestedNode\\KeyWord')->exists($keyword))) {
         $keyword_object = new \BackBee\NestedNode\KeyWord();
         $keyword_object->setRoot($this->em->find('BackBee\\NestedNode\\KeyWord', md5('root')));
         $keyword_object->setKeyWord(preg_replace('#[/\\"]#', '', trim($keyword)));
         if (true === $do_persist) {
             $this->em->persist($keyword_object);
             $this->em->flush($keyword_object);
         }
     }
     return $keyword_object;
 }
예제 #2
0
         $homeContainer->setRevision(1);
         $homeContainer->container->setState(\BackBee\ClassContent\AbstractClassContent::STATE_NORMAL);
         $homeContainer->container->setRevision(1);
         $homeContainer->container->push($blockDemo);
         $page->getContentSet()->first()->push($homeContainer);
     }
     // Creating mediacenter root
     if (null === ($mediafolder = $em->find('BackBee\\NestedNode\\MediaFolder', md5('media')))) {
         $mediafolder = new \BackBee\NestedNode\MediaFolder(md5('media'));
         $mediafolder->setTitle('Mediacenter')->setUrl('/');
         $em->persist($mediafolder);
     }
 }
 if (null === $em->find('BackBee\\NestedNode\\KeyWord', md5('root'))) {
     $keyword = new \BackBee\NestedNode\KeyWord(md5('root'));
     $keyword->setRoot($keyword);
     $keyword->setKeyWord('root');
     $em->persist($keyword);
 }
 $em->flush();
 $step = 5;
 $yamlParser = new \Symfony\Component\Yaml\Parser();
 $groups = $yamlParser->parse(file_get_contents(\BackBee\Standard\Application::getConfigurationDir() . 'groups.yml'));
 foreach ($groups as $groupName => $rights) {
     $group = new \BackBee\Security\Group();
     $group->setName($groupName);
     if (array_key_exists('description', $rights)) {
         $group->setDescription($rights['description']);
         unset($rights['description']);
     }
     $group->setSite($site);
예제 #3
0
 /**
  * Create keywords
  */
 private function createKeyword()
 {
     $keyword = new \BackBee\NestedNode\KeyWord(md5('root'));
     $keyword->setRoot($keyword);
     $keyword->setKeyWord('root');
     $this->entyMgr->persist($keyword);
     $this->entyMgr->flush($keyword);
 }