setId() 공개 메소드

PHPCR documents can be moved by setting the id to a new path.
public setId ( string $id )
$id string
예제 #1
0
 protected function loadVoterMenu(DocumentManager $manager)
 {
     // test content
     $content = new Content();
     $content->setTitle('Content 1');
     $content->setId('/test/content-1');
     $manager->persist($content);
     $route = new Route();
     $route->setId('/test/routes/contents/content-1');
     $route->setDefault('_controller', 'Symfony\\Cmf\\Bundle\\MenuBundle\\Tests\\Resources\\Controller\\VoterController::requestContentIdentityAction');
     $route->setContent($content);
     $manager->persist($route);
     // test blog
     $blog = new Content();
     $blog->setTitle('Blog');
     $blog->setId('/test/blog-1');
     $manager->persist($blog);
     $route = new Route();
     $route->setId('/test/routes/blog');
     $route->setDefault('_controller', 'Symfony\\Cmf\\Bundle\\MenuBundle\\Tests\\Resources\\Controller\\VoterController::blogAction');
     $route->setContent($blog);
     $manager->persist($route);
     // test blog post
     $post = new Post();
     $post->setTitle('My Post');
     $post->setId('/test/blog-1/my-post');
     $manager->persist($post);
     $route = new Route();
     $route->setId('/test/routes/blog/my-post');
     $route->setDefault('_controller', 'Symfony\\Cmf\\Bundle\\MenuBundle\\Tests\\Resources\\Controller\\VoterController::postAction');
     $route->setContent($post);
     $manager->persist($route);
     // test articles
     $articles = new Content();
     $articles->setTitle('Articles Index');
     $articles->setId('/test/articles');
     $manager->persist($articles);
     $articlesRoute = new Route();
     $articlesRoute->setId('/test/routes/articles');
     $articlesRoute->setDefault('_controller', 'Symfony\\Cmf\\Bundle\\MenuBundle\\Tests\\Resources\\Controller\\VoterController::articlesAction');
     $articlesRoute->setContent($articles);
     $articlesRoute->setOption('currentUriPrefix', '/articles');
     $manager->persist($articlesRoute);
     $article1 = new Content();
     $article1->setTitle('Article 1');
     $article1->setId('/test/article-1');
     $manager->persist($article1);
     $route = new Route();
     $route->setId('/test/routes/articles/some-category');
     $manager->persist($route);
     $route = new Route();
     $route->setId('/test/routes/articles/some-category/article-1');
     $route->setDefault('_controller', 'Symfony\\Cmf\\Bundle\\MenuBundle\\Tests\\Resources\\Controller\\VoterController::postAction');
     $route->setContent($article1);
     $manager->persist($route);
     // menu items
     $menu = new Menu();
     $menu->setName('side-menu');
     $menu->setLabel('Side Menu');
     $menu->setParentDocument($this->menuRoot);
     $manager->persist($menu);
     $menuNode = new MenuNode();
     $menuNode->setParentDocument($menu);
     $menuNode->setLabel('Default Behavior');
     $menuNode->setName('default');
     $menuNode->setRoute('current_menu_item_default');
     $manager->persist($menuNode);
     $menuNode = new MenuNode();
     $menuNode->setParentDocument($menu);
     $menuNode->setLabel('Request Content Identity Voter');
     $menuNode->setName('request-content-identity-voter');
     $menuNode->setContent($content);
     $manager->persist($menuNode);
     $menuNode = new MenuNode();
     $menuNode->setParentDocument($menu);
     $menuNode->setLabel('URI Prefix Voter');
     $menuNode->setName('uri-prefix-voter');
     $menuNode->setContent($articlesRoute);
     $manager->persist($menuNode);
     $menuNode = new MenuNode();
     $menuNode->setParentDocument($menu);
     $menuNode->setLabel('Request Parent Content Identity Voter');
     $menuNode->setName('request-parent-content-identity-voter');
     $menuNode->setContent($blog);
     $manager->persist($menuNode);
 }