Created
July 31, 2012 22:53
-
-
Save egulias/3221440 to your computer and use it in GitHub Desktop.
Test controller ofr CMF Routes
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public function indexAction() | |
{ | |
$dm = $this->get('doctrine_phpcr.odm.document_manager'); | |
$this->session = $this->container->get('doctrine_phpcr.default_session'); | |
$base_path = $this->container->getParameter('symfony_cmf_routing_extra.routing_repositoryroot'); | |
$content_path = $this->container->getParameter('symfony_cmf_content.static_basepath'); | |
if ($this->session->itemExists($base_path)) { | |
$this->session->removeItem($base_path); | |
} | |
$this->createPath(dirname($base_path)); | |
$root = $dm->find(null, dirname($base_path)); | |
$parent = new MultilangLanguageSelectRoute(); | |
$parent->setPosition($root, basename($base_path)); | |
$dm->persist($parent); | |
$home = new DMRoute; | |
$home->setPosition($parent, 'es'); | |
$home->setDefault('_locale', 'es'); | |
$home->setRouteContent($dm->find(null, "/my-name")); | |
$dm->persist($home); | |
$dm->flush(); | |
$root = $dm->find(null, '/cms/routes'); | |
//Exception trying to get property of a non Object, routes is NULL | |
var_dump($root->getRoutes());die; | |
return array('name' => 'admin'); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment