@@ -23,62 +23,67 @@ public function getOrder()
2323 }
2424
2525 /**
26- * @param \Doctrine\ODM\PHPCR\DocumentManager $dm
26+ * @param \Doctrine\ODM\PHPCR\DocumentManager $manager
2727 */
28- public function load (ObjectManager $ dm )
28+ public function load (ObjectManager $ manager )
2929 {
30- $ session = $ dm ->getPhpcrSession ();
30+ if (!$ manager instanceof DocumentManager) {
31+ $ class = get_class ($ manager );
32+ throw new \RuntimeException ("Fixture requires a PHPCR ODM DocumentManager instance, instance of ' $ class' given. " );
33+ }
34+
35+ $ session = $ manager ->getPhpcrSession ();
3136
3237 $ basepath = $ this ->container ->getParameter ('cmf_menu.persistence.phpcr.menu_basepath ' );
3338 $ content_path = $ this ->container ->getParameter ('cmf_content.persistence.phpcr.content_basepath ' );
3439
3540 NodeHelper::createPath ($ session , $ basepath );
36- $ root = $ dm ->find (null , $ basepath );
41+ $ root = $ manager ->find (null , $ basepath );
3742
3843 $ labels = array ('en ' => 'Home ' , 'de ' => 'Start ' , 'fr ' => 'Accueil ' );
3944 /** @var $main Menu */
40- $ main = $ this ->createMenuNode ($ dm , $ root , 'main ' , $ labels , $ dm ->find (null , "$ content_path/home " ));
45+ $ main = $ this ->createMenuNode ($ manager , $ root , 'main ' , $ labels , $ manager ->find (null , "$ content_path/home " ));
4146 $ main ->setChildrenAttributes (array ("class " => "menu_main " ));
4247
4348 if ($ session ->getRepository ()->getDescriptor (RepositoryInterface::QUERY_FULL_TEXT_SEARCH_SUPPORTED )) {
44- $ this ->createMenuNode ($ dm , $ main , 'search-item ' , 'Search ' , null , null , 'liip_search ' );
49+ $ this ->createMenuNode ($ manager , $ main , 'search-item ' , 'Search ' , null , null , 'liip_search ' );
4550 }
4651
47- $ this ->createMenuNode ($ dm , $ main , 'admin-item ' , 'Admin ' , null , null , 'sonata_admin_dashboard ' );
52+ $ this ->createMenuNode ($ manager , $ main , 'admin-item ' , 'Admin ' , null , null , 'sonata_admin_dashboard ' );
4853
49- $ projects = $ this ->createMenuNode ($ dm , $ main , 'projects-item ' , array ('en ' => 'Projects ' , 'de ' => 'Projekte ' , 'fr ' => 'Projets ' ), $ dm ->find (null , "$ content_path/projects " ));
50- $ this ->createMenuNode ($ dm , $ projects , 'cmf-item ' , 'Symfony CMF ' , $ dm ->find (null , "$ content_path/cmf " ));
54+ $ projects = $ this ->createMenuNode ($ manager , $ main , 'projects-item ' , array ('en ' => 'Projects ' , 'de ' => 'Projekte ' , 'fr ' => 'Projets ' ), $ manager ->find (null , "$ content_path/projects " ));
55+ $ this ->createMenuNode ($ manager , $ projects , 'cmf-item ' , 'Symfony CMF ' , $ manager ->find (null , "$ content_path/cmf " ));
5156
52- $ company = $ this ->createMenuNode ($ dm , $ main , 'company-item ' , array ('en ' => 'Company ' , 'de ' => 'Firma ' , 'fr ' => 'Entreprise ' ), $ dm ->find (null , "$ content_path/company " ));
53- $ this ->createMenuNode ($ dm , $ company , 'team-item ' , array ('en ' => 'Team ' , 'de ' => 'Team ' , 'fr ' => 'Equipe ' ), $ dm ->find (null , "$ content_path/team " ));
54- $ this ->createMenuNode ($ dm , $ company , 'more-item ' , array ('en ' => 'More ' , 'de ' => 'Mehr ' , 'fr ' => 'Plus ' ), $ dm ->find (null , "$ content_path/more " ));
57+ $ company = $ this ->createMenuNode ($ manager , $ main , 'company-item ' , array ('en ' => 'Company ' , 'de ' => 'Firma ' , 'fr ' => 'Entreprise ' ), $ manager ->find (null , "$ content_path/company " ));
58+ $ this ->createMenuNode ($ manager , $ company , 'team-item ' , array ('en ' => 'Team ' , 'de ' => 'Team ' , 'fr ' => 'Equipe ' ), $ manager ->find (null , "$ content_path/team " ));
59+ $ this ->createMenuNode ($ manager , $ company , 'more-item ' , array ('en ' => 'More ' , 'de ' => 'Mehr ' , 'fr ' => 'Plus ' ), $ manager ->find (null , "$ content_path/more " ));
5560
56- $ demo = $ this ->createMenuNode ($ dm , $ main , 'demo-item ' , 'Demo ' , $ dm ->find (null , "$ content_path/demo " ));
61+ $ demo = $ this ->createMenuNode ($ manager , $ main , 'demo-item ' , 'Demo ' , $ manager ->find (null , "$ content_path/demo " ));
5762 //TODO: this should be possible without a content as the controller might not need a content. support directly having the route document as "content" in the menu document?
58- $ this ->createMenuNode ($ dm , $ demo , 'controller-item ' , 'Explicit controller ' , $ dm ->find (null , "$ content_path/demo_controller " ));
59- $ this ->createMenuNode ($ dm , $ demo , 'template-item ' , 'Explicit template ' , $ dm ->find (null , "$ content_path/demo_template " ));
60- $ this ->createMenuNode ($ dm , $ demo , 'type-item ' , 'Route type to controller ' , $ dm ->find (null , "$ content_path/demo_type " ));
61- $ this ->createMenuNode ($ dm , $ demo , 'class-item ' , 'Class to controller ' , $ dm ->find (null , "$ content_path/demo_class " ));
62- $ this ->createMenuNode ($ dm , $ demo , 'test-item ' , 'Normal Symfony Route ' , null , null , 'test ' );
63- $ this ->createMenuNode ($ dm , $ demo , 'external-item ' , 'External Link ' , null , 'http://cmf.symfony.com/ ' );
63+ $ this ->createMenuNode ($ manager , $ demo , 'controller-item ' , 'Explicit controller ' , $ manager ->find (null , "$ content_path/demo_controller " ));
64+ $ this ->createMenuNode ($ manager , $ demo , 'template-item ' , 'Explicit template ' , $ manager ->find (null , "$ content_path/demo_template " ));
65+ $ this ->createMenuNode ($ manager , $ demo , 'type-item ' , 'Route type to controller ' , $ manager ->find (null , "$ content_path/demo_type " ));
66+ $ this ->createMenuNode ($ manager , $ demo , 'class-item ' , 'Class to controller ' , $ manager ->find (null , "$ content_path/demo_class " ));
67+ $ this ->createMenuNode ($ manager , $ demo , 'test-item ' , 'Normal Symfony Route ' , null , null , 'test ' );
68+ $ this ->createMenuNode ($ manager , $ demo , 'external-item ' , 'External Link ' , null , 'http://cmf.symfony.com/ ' );
6469
65- $ singlelocale = $ this ->createMenuNode ($ dm , $ main , 'singlelocale-item ' , array ('en ' => 'singlelocale ' ), $ dm ->find (null , "$ content_path/singlelocale " ));
66- $ this ->createMenuNode ($ dm , $ singlelocale , 'singlelocale-sub-item ' , array ('en ' => 'singlelocale child ' ), $ dm ->find (null , "$ content_path/singlelocale " ));
70+ $ singlelocale = $ this ->createMenuNode ($ manager , $ main , 'singlelocale-item ' , array ('en ' => 'singlelocale ' ), $ manager ->find (null , "$ content_path/singlelocale " ));
71+ $ this ->createMenuNode ($ manager , $ singlelocale , 'singlelocale-sub-item ' , array ('en ' => 'singlelocale child ' ), $ manager ->find (null , "$ content_path/singlelocale " ));
6772
68- $ seo = $ this ->createMenuNode ($ dm , $ main , 'seo ' , 'SEO ' , $ dm ->find (null , "$ content_path/simple-seo-example " ));
69- $ this ->createMenuNode ($ dm , $ seo , 'simple-seo-example ' , array ('en ' => 'Seo-Simple-Content ' ), $ dm ->find (null , "$ content_path/simple-seo-example " ));
70- $ this ->createMenuNode ($ dm , $ seo , 'demo-seo-extractor ' , array ('en ' => 'Seo-Extractor ' ), $ dm ->find (null , "$ content_path/demo-seo-extractor " ));
71- $ this ->createMenuNode ($ dm , $ seo , 'simple-seo-property ' , array ('en ' => 'Seo-Extra-Properties ' ), $ dm ->find (null , "$ content_path/simple-seo-property " ));
73+ $ seo = $ this ->createMenuNode ($ manager , $ main , 'seo ' , 'SEO ' , $ manager ->find (null , "$ content_path/simple-seo-example " ));
74+ $ this ->createMenuNode ($ manager , $ seo , 'simple-seo-example ' , array ('en ' => 'Seo-Simple-Content ' ), $ manager ->find (null , "$ content_path/simple-seo-example " ));
75+ $ this ->createMenuNode ($ manager , $ seo , 'demo-seo-extractor ' , array ('en ' => 'Seo-Extractor ' ), $ manager ->find (null , "$ content_path/demo-seo-extractor " ));
76+ $ this ->createMenuNode ($ manager , $ seo , 'simple-seo-property ' , array ('en ' => 'Seo-Extra-Properties ' ), $ manager ->find (null , "$ content_path/simple-seo-property " ));
7277
73- $ this ->createMenuNode ($ dm , $ main , 'routing-auto-item ' , array ('en ' => 'Auto routing example ' , 'de ' => 'Auto routing beispiel ' , 'fr ' => 'Auto routing exemple ' ), $ dm ->find (null , "$ content_path/news/RoutingAutoBundle generates routes! " ));
78+ $ this ->createMenuNode ($ manager , $ main , 'routing-auto-item ' , array ('en ' => 'Auto routing example ' , 'de ' => 'Auto routing beispiel ' , 'fr ' => 'Auto routing exemple ' ), $ manager ->find (null , "$ content_path/news/RoutingAutoBundle generates routes! " ));
7479
75- $ dm ->flush ();
80+ $ manager ->flush ();
7681 }
7782
7883 /**
7984 * @return MenuNode a Navigation instance with the specified information
8085 */
81- protected function createMenuNode (DocumentManager $ dm , $ parent , $ name , $ label , $ content , $ uri = null , $ route = null )
86+ protected function createMenuNode (DocumentManager $ manager , $ parent , $ name , $ label , $ content , $ uri = null , $ route = null )
8287 {
8388 if (!$ parent instanceof MenuNode && !$ parent instanceof Menu) {
8489 $ menuNode = new Menu ();
@@ -89,7 +94,7 @@ protected function createMenuNode(DocumentManager $dm, $parent, $name, $label, $
8994 $ menuNode ->setParentDocument ($ parent );
9095 $ menuNode ->setName ($ name );
9196
92- $ dm ->persist ($ menuNode ); // do persist before binding translation
97+ $ manager ->persist ($ menuNode ); // do persist before binding translation
9398
9499 if (null !== $ content ) {
95100 $ menuNode ->setContent ($ content );
@@ -102,7 +107,7 @@ protected function createMenuNode(DocumentManager $dm, $parent, $name, $label, $
102107 if (is_array ($ label )) {
103108 foreach ($ label as $ locale => $ l ) {
104109 $ menuNode ->setLabel ($ l );
105- $ dm ->bindTranslation ($ menuNode , $ locale );
110+ $ manager ->bindTranslation ($ menuNode , $ locale );
106111 }
107112 } else {
108113 $ menuNode ->setLabel ($ label );
0 commit comments