当前位置: 首页>>代码示例>>PHP>>正文


PHP Util\NodeHelper类代码示例

本文整理汇总了PHP中PHPCR\Util\NodeHelper的典型用法代码示例。如果您正苦于以下问题:PHP NodeHelper类的具体用法?PHP NodeHelper怎么用?PHP NodeHelper使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了NodeHelper类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: load

 public function load(ObjectManager $manager)
 {
     NodeHelper::createPath($manager->getPhpcrSession(), '/test');
     NodeHelper::createPath($manager->getPhpcrSession(), '/test/content');
     NodeHelper::createPath($manager->getPhpcrSession(), '/test/routes/content');
     $contentRoot = $manager->find(null, '/test/content');
     $routeRoot = $manager->find(null, '/test/routes/content');
     $content = new SeoAwareContent();
     $content->setName('content-1');
     $content->setTitle('Content 1');
     $content->setBody('Content 1');
     $content->setParentDocument($contentRoot);
     $metadata = new SeoMetadata();
     $metadata->setTitle('Title content 1');
     $metadata->setMetaDescription('Description of content 1.');
     $metadata->setMetaKeywords('content1, content');
     $metadata->setOriginalUrl('/to/original');
     $content->setSeoMetadata($metadata);
     $manager->persist($content);
     $route = new Route();
     $route->setPosition($routeRoot, 'content-1');
     $route->setContent($content);
     $route->setDefault('_controller', 'Symfony\\Cmf\\Bundle\\SeoBundle\\Tests\\Resources\\Controller\\TestController::indexAction');
     $manager->persist($route);
     $manager->persist($route);
     $manager->flush();
 }
开发者ID:symfony-cmf,项目名称:sonata-admin-integration-bundle,代码行数:27,代码来源:LoadContentData.php

示例2: load

 /**
  * {@inheritdoc}
  */
 public function load(ObjectManager $manager)
 {
     $session = $manager->getPhpcrSession();
     $basepath = $this->container->getParameter('cmf_routing.dynamic.persistence.phpcr.route_basepath');
     NodeHelper::createPath($session, $basepath);
     $routeRoot = $manager->find(null, $basepath);
     $basepath = $this->container->getParameter('cmf_content.persistence.phpcr.content_basepath');
     NodeHelper::createPath($session, $basepath);
     $parent = $manager->find(null, $basepath);
     $repository = $this->container->get('sylius.repository.static_content');
     $routeRepository = $this->container->get('sylius.repository.route');
     // Terms of service.
     $route = $routeRepository->createNew();
     $route->setPosition($routeRoot, 'terms-of-service');
     $manager->persist($route);
     $content = $repository->createNew();
     $content->setTitle('Terms of Service');
     $content->setBody($this->faker->text(350));
     $content->addRoute($route);
     $content->setParent($parent);
     $content->setName('terms-of-service');
     $manager->persist($content);
     // Contact.
     $route = $routeRepository->createNew();
     $route->setPosition($routeRoot, 'about');
     $manager->persist($route);
     $content = $repository->createNew();
     $content->setTitle('About us');
     $content->setBody($this->faker->text(300));
     $content->addRoute($route);
     $content->setParent($parent);
     $content->setName('about-us');
     $manager->persist($content);
     $manager->flush();
 }
开发者ID:Strontium-90,项目名称:Sylius,代码行数:38,代码来源:LoadPagesData.php

示例3: load

 /**
  * Load data fixtures with the passed DocumentManager
  *
  * @param DocumentManager $manager
  */
 public function load(ObjectManager $manager)
 {
     if (!$manager instanceof DocumentManager) {
         $class = get_class($manager);
         throw new \RuntimeException("Fixture requires a PHPCR ODM DocumentManager instance, instance of '{$class}' given.");
     }
     // tweak homepage
     $page = $manager->find(null, '/cms/simple');
     $page->setBody('Hello');
     $page->setDefault('_template', 'AcmeDemoBundle::home.html.twig');
     // add menu item for home
     $menuRoot = $manager->find(null, '/cms/simple');
     $homeMenuNode = new MenuNode('home');
     $homeMenuNode->setLabel('Home');
     $homeMenuNode->setParentDocument($menuRoot);
     $homeMenuNode->setContent($page);
     $manager->persist($homeMenuNode);
     // load the pages
     Fixtures::load(array(__DIR__ . '/../../Resources/data/pages.yml'), $manager);
     // add menu item for login
     $loginMenuNode = new MenuNode('login');
     $loginMenuNode->setLabel('Admin Login');
     $loginMenuNode->setParentDocument($menuRoot);
     $loginMenuNode->setRoute('_demo_login');
     $manager->persist($loginMenuNode);
     // load the blocks
     NodeHelper::createPath($manager->getPhpcrSession(), '/cms/content/blocks');
     Fixtures::load(array(__DIR__ . '/../../Resources/data/blocks.yml'), $manager);
     // save the changes
     $manager->flush();
 }
开发者ID:yookihiroo,项目名称:standard-edition,代码行数:36,代码来源:LoadDemoData.php

示例4: load

 /**
  * {@inheritdoc}
  */
 public function load(ObjectManager $manager)
 {
     $this->manager = $manager;
     $session = $manager->getPhpcrSession();
     //création namespace menu
     NodeHelper::createPath($session, '/website/symfony-prestacms/route');
     $root = $manager->find(null, '/website/symfony-prestacms/route');
     //Routing home
     $configuration = array('parent' => $root, 'content_path' => '/website/symfony-prestacms/page/home', 'name' => 'en', 'locale' => 'en');
     $home = $this->getFactory()->create($configuration);
     $configuration['name'] = 'fr';
     $configuration['locale'] = 'fr';
     $homeFr = $this->getFactory()->create($configuration);
     $yaml = new Parser();
     $datas = $yaml->parse(file_get_contents(__DIR__ . '/../data/page.yml'));
     foreach ($datas['pages'] as $pageConfiguration) {
         if ($pageConfiguration['name'] == 'home') {
             continue;
         }
         $pageConfiguration['content_path'] = '/website/symfony-prestacms/page' . '/' . $pageConfiguration['name'];
         $pageConfiguration['parent'] = $home;
         $pageConfiguration['locale'] = 'en';
         $this->getFactory()->create($pageConfiguration);
         $pageConfiguration['parent'] = $homeFr;
         $pageConfiguration['locale'] = 'fr';
         $this->getFactory()->create($pageConfiguration);
     }
     $this->manager->flush();
 }
开发者ID:ajbm6,项目名称:symfony-prestacms,代码行数:32,代码来源:LoadRoute.php

示例5: execute

    /**
     * {@inheritDoc}
     */
    protected function execute(InputInterface $input, OutputInterface $output)
    {
        $session = $this->getPhpcrSession();
        $force = $input->getOption('force');

        $workspaceName = $session->getWorkspace()->getName();
        if (!$force) {
            /** @var $dialog DialogHelper */
            $dialog = $this->getHelperSet()->get('dialog');
            $force = $dialog->askConfirmation($output, sprintf(
                '<question>Are you sure you want to purge workspace "%s" Y/N ?</question>',
                $workspaceName
            ), false);
        }

        if (!$force) {
            $output->writeln('<error>Aborted</error>');

            return 1;
        }

        $output->writeln(sprintf('<info>Purging workspace:</info> %s', $workspaceName));

        // Using the static NodeHelper is bad for testing as we cannot mock it.
        NodeHelper::purgeWorkspace($session);
        $session->save();

        return 0;
    }
开发者ID:xxspartan16,项目名称:BMS-Market,代码行数:32,代码来源:WorkspacePurgeCommand.php

示例6: load

    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();
    }
开发者ID:xxspartan16,项目名称:BMS-Market,代码行数:26,代码来源:LoadContentData.php

示例7: createBasePaths

 private function createBasePaths(SessionInterface $session, array $basePaths)
 {
     foreach ($basePaths as $path) {
         NodeHelper::createPath($session, $path);
     }
     $session->save();
 }
开发者ID:SuperdeskWebPublisher,项目名称:SWPMultiTenancyBundle,代码行数:7,代码来源:PHPCRBasePathsInitializer.php

示例8: load

 /**
  * {@inheritdoc}
  */
 public function load(ObjectManager $manager)
 {
     $session = $manager->getPhpcrSession();
     $basepath = $this->container->getParameter('cmf_block.persistence.phpcr.block_basepath');
     NodeHelper::createPath($session, $basepath);
     $parent = $manager->find(null, $basepath);
     $factory = $this->container->get('sylius.factory.simple_block');
     $contactBlock = $factory->createNew();
     $contactBlock->setParentDocument($parent);
     $contactBlock->setName('contact');
     $contactBlock->setTitle('Contact us');
     $contactBlock->setBody('<p>Call us ' . $this->faker->phoneNumber . '!</p><p>' . $this->faker->paragraph . '</p>');
     $manager->persist($contactBlock);
     for ($i = 1; $i <= 3; ++$i) {
         $block = $factory->createNew();
         $block->setParentDocument($parent);
         $block->setName('block-' . $i);
         $block->setTitle(ucfirst($this->faker->word));
         $block->setBody($this->faker->paragraph);
         $manager->persist($block);
     }
     $factory = $this->container->get('sylius.factory.string_block');
     $welcomeText = $factory->createNew();
     $welcomeText->setParentDocument($parent);
     $welcomeText->setName('welcome-text');
     $welcomeText->setBody('Welcome to Sylius e-commerce');
     $manager->persist($welcomeText);
     $manager->flush();
 }
开发者ID:okwinza,项目名称:Sylius,代码行数:32,代码来源:LoadBlocksData.php

示例9: load

 public function load(ObjectManager $manager)
 {
     NodeHelper::createPath($manager->getPhpcrSession(), '/test/menus');
     NodeHelper::createPath($manager->getPhpcrSession(), '/test/routes/contents');
     $this->menuRoot = $manager->find(null, '/test/menus');
     $this->routeRoot = $manager->find(null, '/test/routes');
     $this->loadMenu($manager);
     $manager->flush();
 }
开发者ID:frogriotcom,项目名称:MenuBundle,代码行数:9,代码来源:LoadMenuData.php

示例10: load

 /**
  * {@inheritdoc}
  */
 public function load(ObjectManager $manager)
 {
     $session = $manager->getPhpcrSession();
     $basePath = DIRECTORY_SEPARATOR . Website::WEBSITE_PREFIX;
     // Create the path in the repository
     NodeHelper::createPath($session, $basePath);
     $this->getFactory()->create(array('path' => $basePath . DIRECTORY_SEPARATOR . 'symfony-prestacms', 'name' => 'symfony-prestacms', 'available_locales' => array('fr', 'en'), 'default_locale' => 'en', 'theme' => 'creative'));
     $manager->flush();
 }
开发者ID:ajbm6,项目名称:symfony-prestacms,代码行数:12,代码来源:LoadWebsite.php

示例11: load

 public function load(ObjectManager $manager)
 {
     $session = $manager->getPhpcrSession();
     $basepath = $this->container->getParameter('cmf_menu.persistence.phpcr.menu_basepath');
     $content_path = $this->container->getParameter('cmf_content.persistence.phpcr.content_basepath');
     NodeHelper::createPath($session, $basepath);
     $root = $manager->find(null, $basepath);
     $main = $this->createMenuNode($manager, $root, 'main', 'Home', $manager->find(null, "/cms/content/pages/home"));
     $this->createMenuNode($manager, $main, 'about', 'About', $manager->find(null, "/cms/content/pages/about"));
     $postsNode = $this->createMenuNode($manager, $main, 'posts', 'Liste des posts');
     $posts = $manager->getRepository('AcmeBasicCmsBundle:Post')->findAll();
     /** @var Post $post */
     foreach ($posts as $post) {
         $this->createMenuNode($manager, $postsNode, $post->getSlug(), $post->getTitle(), $post);
     }
     //        $menu = new Menu();
     //        $menu->setName('main-menu');
     //        $menu->setLabel('Main Menu');
     //        $menu->setParentDocument($menuParent);
     //        $dm->persist($menu);
     //
     //        $homeMenuNode = new MenuNode();
     //        $homePage = $dm->find('Acme\BasicCmsBundle\Document\Page', '/cms/content/pages/home');
     //        $homeMenuNode->setName($homePage->getSlug());
     //        $homeMenuNode->setLabel($homePage->getTitle());
     //        $homeMenuNode->setContent($homePage);
     //        $homeMenuNode->setParentDocument($menu);
     //        $dm->persist($homeMenuNode);
     //
     //        $aboutMenuNode = new MenuNode();
     //        $aboutPage = $dm->find('Acme\BasicCmsBundle\Document\Page', '/cms/content/pages/about');
     //        $aboutMenuNode->setName($aboutPage->getSlug());
     //        $aboutMenuNode->setLabel($aboutPage->getTitle());
     //        $aboutMenuNode->setContent($aboutPage);
     //        $aboutMenuNode->setParentDocument($homeMenuNode);
     //        $dm->persist($aboutMenuNode);
     //
     //        $postsMenuNode = new MenuNode();
     //        $postsMenuNode->setName('posts');
     //        $postsMenuNode->setLabel('Liste des posts');
     //        $postsMenuNode->setParentDocument($menu);
     //        $dm->persist($postsMenuNode);
     //
     //        $posts = $dm->getRepository('AcmeBasicCmsBundle:Post')->findAll();
     //
     //        /** @var Post $post */
     //        foreach ($posts as $post) {
     //            $postMenuNode = new MenuNode();
     //            $postMenuNode->setName($post->getSlug());
     //            $postMenuNode->setLabel($post->getTitle());
     //            $postMenuNode->setContent($post);
     //            $postMenuNode->setParentDocument($postsMenuNode);
     //            $dm->persist($postMenuNode);
     //        }
     $manager->flush();
 }
开发者ID:nikophil,项目名称:cmf-tests,代码行数:56,代码来源:LoadMenuData.php

示例12: load

 /**
  * Load data fixtures with the passed EntityManager
  *
  * @param ObjectManager|DocumentManager $manager
  */
 public function load(ObjectManager $manager)
 {
     NodeHelper::createPath($manager->getPhpcrSession(), '/cms/routes');
     $routeBase = $manager->find(null, '/cms/routes');
     $route = new Route();
     $route->setPosition($routeBase, 'route_only');
     $route->addDefaults(['_controller' => 'froscon_application.controller.default:routeOnlyAction']);
     $manager->persist($route);
     $manager->flush();
 }
开发者ID:ElectricMaxxx,项目名称:ipc-cmf-example-application,代码行数:15,代码来源:LoadRoutesOnly.php

示例13: setUp

 public function setUp()
 {
     $this->fetchDbParameters();
     $this->connection = DriverManager::getConnection($this->params);
     $this->createEntityManager();
     $this->createDocumentManager();
     $this->resetFunctionalNode($this->dm);
     $this->createObjectAdapterManager();
     NodeHelper::createPath($this->dm->getPhpcrSession(), '/functional');
     $this->base = $this->dm->find(null, '/functional');
     $this->createBaseTables();
 }
开发者ID:joschi127,项目名称:DoctrineOrmOdmAdapter,代码行数:12,代码来源:BaseFunctionalTestCase.php

示例14: load

 public function load(ObjectManager $manager)
 {
     NodeHelper::createPath($manager->getPhpcrSession(), '/test');
     $testDataDir = realpath(__DIR__ . '/../../app/Resources/data');
     $root = $manager->find(null, '/test');
     // media root
     $mediaRoot = new Generic();
     $mediaRoot->setNodename('media');
     $mediaRoot->setParent($root);
     $manager->persist($mediaRoot);
     // content root
     $contentRoot = new Generic();
     $contentRoot->setNodename('content');
     $contentRoot->setParent($root);
     $manager->persist($contentRoot);
     // File
     $file = new File();
     $file->setParent($mediaRoot);
     $file->setName('file-1.txt');
     $file->setContentFromString('Test file 1.');
     $file->setContentType('text/plain');
     $manager->persist($file);
     // Image
     $image = new Image();
     $image->setParent($mediaRoot);
     $image->setName('cmf-logo.png');
     $image->setFileContentFromFilesystem($testDataDir . '/cmf-logo.png');
     $manager->persist($image);
     $image2 = new Image();
     $image2->setParent($contentRoot);
     $image2->setName('cmf-logo-2.png');
     $image2->setFileContentFromFilesystem($testDataDir . '/cmf-logo.png');
     $manager->persist($image2);
     // Content with image
     $content = new Content();
     $content->setParent($contentRoot);
     $content->setName('content-with-image');
     $content->setTitle('Content document with image embedded');
     $contentImage = new Image();
     $contentImage->setFileContentFromFilesystem($testDataDir . '/cmf-logo.png');
     $content->setFile($contentImage);
     $manager->persist($content);
     // Content with file
     $content2 = new Content();
     $content2->setParent($contentRoot);
     $content2->setName('content-with-file');
     $content2->setTitle('Content document with file attached');
     $contentFile = new File();
     $contentFile->setFileContentFromFilesystem($testDataDir . '/testfile.txt');
     $content2->setFile($contentFile);
     $manager->persist($content2);
     $manager->flush();
 }
开发者ID:frogriotcom,项目名称:MediaBundle,代码行数:53,代码来源:LoadMediaData.php

示例15: load

 public function load(ObjectManager $manager)
 {
     $session = $manager->getPhpcrSession();
     $basePath = $this->container->getParameter('cmf_simple_cms.persistence.phpcr.basepath');
     NodeHelper::createPath($session, preg_replace('#/[^/]*$#', '', $basePath));
     $root = $manager->find(null, $basePath);
     if (!$root) {
         $root = new Page();
         $root->setId($basePath);
         $root->setTitle('Home Page');
     }
     $manager->persist($root);
     $manager->flush();
 }
开发者ID:geoffreytran,项目名称:zym,代码行数:14,代码来源:LoadPageData.php


注:本文中的PHPCR\Util\NodeHelper类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。