Ejemplo n.º 1
0
    public function load(ObjectManager $manager)
    {
        NodeHelper::createPath($manager->getPhpcrSession(), '/test');
        $root = $manager->find(null, '/test');

        $contentRoot = new Generic;
        $contentRoot->setNodename('contents');
        $contentRoot->setParent($root);
        $manager->persist($contentRoot);

        $content = new StaticContent;
        $content->setName('content-1');
        $content->setTitle('Content 1');
        $content->setBody('Content 1');
        $content->setParentDocument($contentRoot);
        $manager->persist($content);

        $content = new StaticContent;
        $content->setName('content-2');
        $content->setTitle('Content 2');
        $content->setBody('Content 2');
        $content->setParentDocument($contentRoot);
        $manager->persist($content);

        $manager->flush();
    }
 public function testSubmitValidData()
 {
     $data = ['name' => 'hello-world', 'parentDocument' => '/cms/content'];
     $document = $this->getMock(Generic::class);
     $this->documentManager->expects($this->once())->method('find')->with(null, $data['parentDocument'])->will($this->returnValue($document));
     $form = $this->factory->create(StaticContentType::class);
     $form->submit($data);
     $object = new StaticContent();
     $object->setName($data['name']);
     $object->setParentDocument($document);
     $this->assertTrue($form->isSynchronized());
     $this->assertEquals($object, $form->getData());
 }
 /**
  * Load data fixtures with the passed EntityManager
  *
  * @param ObjectManager|DocumentManager $manager
  */
 public function load(ObjectManager $manager)
 {
     $contentParent = $manager->find(null, '/cms/content');
     $routeParent = $manager->find(null, '/cms/routes');
     $menuBase = $manager->find(null, '/cms/menu');
     $enRoute = new Route();
     $enRoute->setPosition($routeParent, 'en');
     $manager->persist($enRoute);
     $deRoute = new Route();
     $deRoute->setPosition($routeParent, 'de');
     $manager->persist($deRoute);
     $enServiceRoute = new Route();
     $enServiceRoute->setPosition($enRoute, 'services');
     $manager->persist($enServiceRoute);
     $deServiceRoute = new Route();
     $deServiceRoute->setPosition($deRoute, 'dienstleistungen');
     $manager->persist($deServiceRoute);
     $content = new StaticContent();
     $content->setParentDocument($contentParent);
     $content->setName('symfony-service');
     $manager->persist($content);
     $content->setTitle('Symfony Service');
     $content->setBody('A page about Symfony service');
     $manager->bindTranslation($content, 'en');
     $contentRoute = new Route();
     $contentRoute->setPosition($enServiceRoute, 'symfony-service');
     $contentRoute->setContent($content);
     $manager->persist($contentRoute);
     $content->setTitle('Symfony Dienstleistungen');
     $content->setBody('Eine Seite über Symfony Dienstleistungen');
     $manager->bindTranslation($content, 'de');
     $contentRoute = new Route();
     $contentRoute->setPosition($deServiceRoute, 'symfony-dienstleistungen');
     $contentRoute->setContent($content);
     $manager->persist($contentRoute);
     $menu = new Menu();
     $menu->setPosition($menuBase, 'footer');
     $manager->persist($menu);
     $menuNode = new MenuNode();
     $menuNode->setParentDocument($menu);
     $menuNode->setContent($content);
     $menuNode->setName('symfony-service');
     $manager->persist($menuNode);
     $menuNode->setLabel('Symfony Services');
     $manager->bindTranslation($menuNode, 'en');
     $menuNode->setLabel('Symfony Dienstleistungen');
     $manager->bindTranslation($menuNode, 'de');
     $manager->flush();
 }