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


PHP ObjectManager::getPhpcrSession方法代码示例

本文整理汇总了PHP中Doctrine\Common\Persistence\ObjectManager::getPhpcrSession方法的典型用法代码示例。如果您正苦于以下问题:PHP ObjectManager::getPhpcrSession方法的具体用法?PHP ObjectManager::getPhpcrSession怎么用?PHP ObjectManager::getPhpcrSession使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Doctrine\Common\Persistence\ObjectManager的用法示例。


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

示例1: load

 /**
  * @param DocumentManager $manager
  */
 public function load(ObjectManager $manager)
 {
     $this->root = $manager->find(null, '/test');
     $doc = new TestDocument();
     $doc->id = '/test/doc';
     $doc->bool = true;
     $doc->date = new \DateTime('2014-01-14');
     $doc->integer = 42;
     $doc->long = 24;
     $doc->number = 3.14;
     $doc->text = 'text content';
     $manager->persist($doc);
     $doc = new TestDocument();
     $doc->id = '/test/doc2';
     $doc->bool = true;
     $doc->date = new \DateTime('2014-01-14');
     $doc->integer = 42;
     $doc->long = 24;
     $doc->number = 3.14;
     $doc->text = 'text content';
     $manager->persist($doc);
     $ref = new ReferrerDocument();
     $ref->id = '/test/ref';
     $ref->addDocument($doc);
     $manager->persist($ref);
     $manager->flush();
     $node = $manager->getPhpcrSession()->getNode('/test/doc');
     $node->addNode('child');
     $node->addNode('second');
     $manager->getPhpcrSession()->save();
     $manager->clear();
 }
开发者ID:nikophil,项目名称:cmf-tests,代码行数:35,代码来源:LoadData.php

示例2: 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

示例3: 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

示例4: 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

示例5: 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

示例6: 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

示例7: 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

示例8: load

 public function load(ObjectManager $manager)
 {
     $session = $manager->getPhpcrSession();
     $root = $session->getRootNode();
     /*
      * /a
      * /a/b
      * /a/b/c
      * /a/b/d
      * /a/b/e
      * /a/f
      * /a/f/g
      * /a/f/g/h
      * /a/i
      */
     $a = $root->addNode('a');
     $b = $a->addNode('b');
     $c = $b->addNode('c');
     $c->addMixin('phpcr:managed');
     $c->setProperty('phpcr:class', 'Symfony\\Cmf\\Bundle\\CoreBundle\\Tests\\Resources\\Document\\RouteAware');
     $b->addNode('d');
     $e = $b->addNode('e');
     $e->addMixin('phpcr:managed');
     $e->setProperty('phpcr:class', 'Symfony\\Cmf\\Bundle\\CoreBundle\\Tests\\Resources\\Document\\RouteAware');
     $f = $a->addNode('f');
     $g = $f->addNode('g');
     $g->addNode('h');
     $a->addNode('i');
     $session->save();
 }
开发者ID:frogriotcom,项目名称:CoreBundle,代码行数:30,代码来源:LoadHierarchyRouteData.php

示例9: 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

示例10: load

 public function load(ObjectManager $manager)
 {
     NodeHelper::createPath($manager->getPhpcrSession(), '/test');
     NodeHelper::createPath($manager->getPhpcrSession(), '/test/content');
     NodeHelper::createPath($manager->getPhpcrSession(), '/test/routes');
     $contentRoot = $manager->find(null, '/test/content');
     $routeRoot = $manager->find(null, '/test/routes');
     $sitemapAwareContent = new SitemapAwareContent();
     $sitemapAwareContent->setIsVisibleForSitemap(true)->setTitle('Sitemap Aware Content')->setName('sitemap-aware')->setParentDocument($contentRoot)->setBody('Content for that is sitemap aware');
     $manager->persist($sitemapAwareContent);
     $manager->bindTranslation($sitemapAwareContent, 'en');
     $sitemapAwareContent->setTitle('Content für die Sitemap')->setBody('Das sollte die Deutsche Version des Contents sein.');
     $manager->bindTranslation($sitemapAwareContent, 'de');
     $route = new Route();
     $route->setPosition($routeRoot, 'sitemap-aware');
     $route->setContent($sitemapAwareContent);
     $manager->persist($route);
     $nonPublishedContent = new SitemapAwareWithPublishWorkflowContent();
     $nonPublishedContent->setIsVisibleForSitemap(true);
     $nonPublishedContent->setPublishable(false);
     $nonPublishedContent->setTitle('Sitemap Aware Content non publish')->setName('sitemap-aware-non-publish')->setParentDocument($contentRoot)->setBody('Content for that is sitemap aware, that is not publish');
     $manager->persist($nonPublishedContent);
     $route = new Route();
     $route->setPosition($routeRoot, 'sitemap-aware-non-publish');
     $route->setContent($nonPublishedContent);
     $manager->persist($route);
     $publishedContent = new SitemapAwareWithPublishWorkflowContent();
     $publishedContent->setIsVisibleForSitemap(true);
     $publishedContent->setPublishable(true);
     $publishedContent->setTitle('Sitemap Aware Content publish')->setName('sitemap-aware-publish')->setParentDocument($contentRoot)->setBody('Content for that is sitemap aware, that is publish');
     $manager->persist($publishedContent);
     $route = new Route();
     $route->setPosition($routeRoot, 'sitemap-aware-publish');
     $route->setContent($publishedContent);
     $manager->persist($route);
     $lastModifiedContent = new SitemapAwareWithLastModifiedDateContent();
     $lastModifiedContent->setIsVisibleForSitemap(true)->setLastModified(new \DateTime('2016-07-06', new \DateTimeZone('Europe/Berlin')))->setTitle('Sitemap Aware Content last mod date')->setName('sitemap-aware-last-mod-date')->setParentDocument($contentRoot)->setBody('Content for that is sitemap aware, that has last modified date.');
     $manager->persist($lastModifiedContent);
     $route = new Route();
     $route->setPosition($routeRoot, 'sitemap-aware-last-mod-date');
     $route->setContent($lastModifiedContent);
     $manager->persist($route);
     $manager->flush();
 }
开发者ID:symfony-cmf,项目名称:seo-bundle,代码行数:44,代码来源:LoadSitemapData.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: load

 /**
  * Load data fixtures with the passed EntityManager
  *
  * @param \Doctrine\Common\Persistence\ObjectManager $manager
  */
 public function load(ObjectManager $manager)
 {
     /** @var $session \PHPCR\SessionInterface */
     $session = $manager->getPhpcrSession();
     $root = $session->getNode('/');
     $root->addNode('users');
     $this->createUser('User Foo', 'user', 'abc123', 'user@example.com', array('ROLE_USER'), $manager);
     $this->createUser('John Editor', 'editor', 'abc123', 'editor@example.com', array('ROLE_EDITOR'), $manager);
     $this->createUser('Administrator', 'admin', 'abc123', 'admin@example.com', array('ROLE_ADMIN'), $manager);
     $manager->flush();
 }
开发者ID:Cohros,项目名称:KnowledgeBase,代码行数:16,代码来源:LoadUsersData.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


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