/** * Updates `has_section` data from existing section * * * @return \BackBee\Console\Command\UpgradeToPageSectionCommand */ private function updateSections() { $sections = $this->repo->findAll(); foreach ($sections as $section) { PageListener::setSectionHasChildren($this->em, $section); } $this->em->flush(); return $this; }
/** * Sets up the fixture */ protected function setUp() { self::$em->clear(); self::$kernel->resetDatabase([self::$em->getClassMetaData('BackBee\\NestedNode\\Section'), self::$em->getClassMetaData('BackBee\\NestedNode\\Page'), self::$em->getClassMetaData('BackBee\\Site\\Site')]); $this->repository = self::$em->getRepository('BackBee\\NestedNode\\Section'); $site = new Site('site_uid', array('label' => 'site mock')); self::$em->persist($site); $this->root = new Section('root_uid', array('site' => $site)); self::$em->persist($this->root); $child1 = $this->repository->insertNodeAsFirstChildOf(new Section('child1', array('site' => $site)), $this->root); self::$em->flush($child1); $child2 = $this->repository->insertNodeAsFirstChildOf(new Section('child2', array('site' => $site)), $this->root); self::$em->flush($child2); self::$em->refresh($child1); self::$em->refresh($this->root); }