From 65af83edd0c3e8060298548d4c4320453bf12422 Mon Sep 17 00:00:00 2001 From: David Buchmann Date: Thu, 20 Jun 2013 11:15:58 +0200 Subject: [PATCH 1/7] WIP orm provider and content repository --- Doctrine/Orm/ContentRepository.php | 57 ++++++++++++++++++++++++++++++ Doctrine/Orm/RouteProvider.php | 55 ++++++++++++++++++++++++++++ 2 files changed, 112 insertions(+) create mode 100644 Doctrine/Orm/ContentRepository.php create mode 100644 Doctrine/Orm/RouteProvider.php diff --git a/Doctrine/Orm/ContentRepository.php b/Doctrine/Orm/ContentRepository.php new file mode 100644 index 00000000..478140d9 --- /dev/null +++ b/Doctrine/Orm/ContentRepository.php @@ -0,0 +1,57 @@ +getModelAndId($id); + + return $this->getObjectManager()->getRepository($model)->find($modelId); + } + + /** + * {@inheritDoc} + */ + public function getContentId($content) + { + if (! is_object($content)) { + return null; + } + + try { + $meta = $this->getObjectManager()->getClassMetadata(get_class($content)); + $ids = $meta->getIdentifierValues($content); + if (0 !== count($ids)) { + throw new \Exception('Multi identifier values not supported in ' . get_class($content)); + } + return implode(':', array( + get_class($content), + reset($ids) + )); + } catch (\Exception $e) { + return null; + } + } +} diff --git a/Doctrine/Orm/RouteProvider.php b/Doctrine/Orm/RouteProvider.php new file mode 100644 index 00000000..e30d99a2 --- /dev/null +++ b/Doctrine/Orm/RouteProvider.php @@ -0,0 +1,55 @@ +NOT not a doctrine repository but just the route + * provider for the NestedMatcher. (you could of course implement this + * interface in a repository class, if you need that) + * + * @author david.buchmann@liip.ch + */ +class RouteProvider extends DoctrineProvider implements RouteProviderInterface +{ + protected function getCandidates($url) + { + $candidates = array(); + if ('/' !== $url) { + if (preg_match('/(.+)\.[a-z]+$/i', $url, $matches)) { + $candidates[] = $url; + $url = $matches[1]; + } + + $part = $url; + while (false !== ($pos = strrpos($part, '/'))) { + $candidates[] = $part; + $part = substr($url, 0, $pos); + } + } + + $candidates[] = '/'; + + return $candidates; + } + + /** + * {@inheritDoc} + */ + public function getRouteByName($name, $parameters = array()) + { + } + + public function getRoutesByNames($names, $parameters = array()) + { + } +} From 3e4ac26486f4e917b4545eaa269977899f702d3a Mon Sep 17 00:00:00 2001 From: Matteo Caberlotto Date: Tue, 30 Jul 2013 20:46:55 +0200 Subject: [PATCH 2/7] Added orm entity and implemented provider matching; added orm configuration options --- CmfRoutingBundle.php | 12 +++++ DependencyInjection/CmfRoutingExtension.php | 12 +++++ DependencyInjection/Configuration.php | 6 +++ Doctrine/DoctrineProvider.php | 1 + Doctrine/Orm/ContentRepository.php | 6 ++- Doctrine/Orm/Route.php | 47 +++++++++++++++++ Doctrine/Orm/RouteProvider.php | 50 ++++++++++++++++++- Model/Route.php | 10 ++++ Resources/config/doctrine-model/Route.orm.xml | 10 ++++ Resources/config/doctrine-orm/Route.orm.xml | 30 +++++++++++ Resources/config/provider_orm.xml | 24 +++++++++ 11 files changed, 206 insertions(+), 2 deletions(-) create mode 100644 Doctrine/Orm/Route.php create mode 100644 Resources/config/doctrine-model/Route.orm.xml create mode 100644 Resources/config/doctrine-orm/Route.orm.xml create mode 100644 Resources/config/provider_orm.xml diff --git a/CmfRoutingBundle.php b/CmfRoutingBundle.php index 72612e2c..b2aaa430 100644 --- a/CmfRoutingBundle.php +++ b/CmfRoutingBundle.php @@ -3,6 +3,7 @@ namespace Symfony\Cmf\Bundle\RoutingBundle; use Doctrine\Bundle\PHPCRBundle\DependencyInjection\Compiler\DoctrinePhpcrMappingsPass; +use Doctrine\Bundle\DoctrineBundle\DependencyInjection\Compiler\DoctrineOrmMappingsPass; use Symfony\Component\DependencyInjection\Definition; use Symfony\Component\HttpKernel\Bundle\Bundle; use Symfony\Component\DependencyInjection\ContainerBuilder; @@ -37,6 +38,17 @@ public function build(ContainerBuilder $container) ) ); } + + if (class_exists('Doctrine\Bundle\DoctrineBundle\DependencyInjection\Compiler\DoctrineOrmMappingsPass')) { + $container->addCompilerPass( + DoctrineOrmMappingsPass::createXmlMappingDriver( + array( + realpath(__DIR__ . '/Resources/config/doctrine-model') => 'Symfony\Cmf\Bundle\RoutingBundle\Model', + realpath(__DIR__ . '/Resources/config/doctrine-orm') => 'Symfony\Cmf\Bundle\RoutingBundle\Doctrine\Orm', + ) + ) + ); + } } /** diff --git a/DependencyInjection/CmfRoutingExtension.php b/DependencyInjection/CmfRoutingExtension.php index 6706d46f..a45b60ee 100644 --- a/DependencyInjection/CmfRoutingExtension.php +++ b/DependencyInjection/CmfRoutingExtension.php @@ -93,6 +93,12 @@ private function setupDynamicRouter(array $config, ContainerBuilder $container, $hasProvider = true; $hasContentRepository = true; } + + if (!empty($config['persistence']['orm']['enabled'])) { + $this->loadOrmProvider($config['persistence']['orm'], $loader, $container); + $hasProvider = true; + } + if (isset($config['route_provider_service_id'])) { $container->setAlias('cmf_routing.route_provider', $config['route_provider_service_id']); $hasProvider = true; @@ -171,6 +177,12 @@ public function loadSonataPhpcrAdmin($config, XmlFileLoader $loader, ContainerBu $loader->load('admin_phpcr.xml'); } + public function loadOrmProvider($config, XmlFileLoader $loader, ContainerBuilder $container) + { + $container->setParameter($this->getAlias() . '.manager_name', $config['manager_name']); + $loader->load('provider_orm.xml'); + } + /** * Returns the base path for the XSD files. * diff --git a/DependencyInjection/Configuration.php b/DependencyInjection/Configuration.php index cb89a4ea..d7d4a4e1 100644 --- a/DependencyInjection/Configuration.php +++ b/DependencyInjection/Configuration.php @@ -72,6 +72,12 @@ public function getConfigTreeBuilder() ->end() ->end() ->end() + ->arrayNode('orm') + ->children() + ->scalarNode('enabled')->defaultNull()->end() + ->scalarNode('manager_name')->defaultNull()->end() + ->end() + ->end() ->end() ->end() ->scalarNode('uri_filter_regexp')->defaultValue('')->end() diff --git a/Doctrine/DoctrineProvider.php b/Doctrine/DoctrineProvider.php index 368f5d5d..e2f705a5 100644 --- a/Doctrine/DoctrineProvider.php +++ b/Doctrine/DoctrineProvider.php @@ -40,6 +40,7 @@ abstract class DoctrineProvider public function __construct(ManagerRegistry $managerRegistry, $className = null) { $this->managerRegistry = $managerRegistry; + $this->className = $className; } /** diff --git a/Doctrine/Orm/ContentRepository.php b/Doctrine/Orm/ContentRepository.php index 478140d9..4d7d087c 100644 --- a/Doctrine/Orm/ContentRepository.php +++ b/Doctrine/Orm/ContentRepository.php @@ -2,8 +2,11 @@ namespace Symfony\Cmf\Bundle\RoutingBundle\Doctrine\Orm; +use Symfony\Cmf\Component\Routing\ContentRepositoryInterface; +use Symfony\Cmf\Bundle\RoutingBundle\Doctrine\DoctrineProvider; + /** - * Abstract content repository for PHPCR-ODM + * Abstract content repository for ORM * * @author teito */ @@ -46,6 +49,7 @@ public function getContentId($content) if (0 !== count($ids)) { throw new \Exception('Multi identifier values not supported in ' . get_class($content)); } + return implode(':', array( get_class($content), reset($ids) diff --git a/Doctrine/Orm/Route.php b/Doctrine/Orm/Route.php new file mode 100644 index 00000000..01329c3e --- /dev/null +++ b/Doctrine/Orm/Route.php @@ -0,0 +1,47 @@ +getRoutesRepository()->findOneByName($name); + if (!$route) { + throw new RouteNotFoundException("No route found for name '$name'"); + } + + return $route; } public function getRoutesByNames($names, $parameters = array()) { } + + public function getRouteCollectionForRequest(Request $request) + { + $url = $request->getPathInfo(); + + $candidates = $this->getCandidates($url); + + $collection = new RouteCollection(); + + if (empty($candidates)) { + return $collection; + } + + try { + $routes = $this->getRoutesRepository()->findByStaticPrefix($candidates, array('position' => 'ASC')); + + foreach ($routes as $key => $route) { + if (preg_match('/.+\.([a-z]+)$/i', $url, $matches)) { + if ($route->getDefault('_format') === $matches[1]) { + continue; + } + + $route->setDefault('_format', $matches[1]); + } + // SYMFONY 2.1 COMPATIBILITY: tweak route name + $key = trim(preg_replace('/[^a-z0-9A-Z_.]/', '_', $key), '_'); + $collection->add($key, $route); + } + } catch (RepositoryException $e) { + // TODO: how to determine whether this is a relevant exception or not? + // for example, getting /my//test (note the double /) is just an invalid path + // and means another router might handle this. + // but if the PHPCR backend is down for example, we want to alert the user + } + + return $collection; + } + + protected function getRoutesRepository() + { + return $this->getObjectManager()->getRepository($this->className); + } } diff --git a/Model/Route.php b/Model/Route.php index 4373ab06..e5999cdf 100644 --- a/Model/Route.php +++ b/Model/Route.php @@ -259,6 +259,16 @@ public function compile() return parent::compile(); } + /** + * {@inheritDoc} + * + * Required by orm + */ + public function getDefaults() + { + return $this->defaults; + } + public function __toString() { return (string) $this->id; diff --git a/Resources/config/doctrine-model/Route.orm.xml b/Resources/config/doctrine-model/Route.orm.xml new file mode 100644 index 00000000..be0c6331 --- /dev/null +++ b/Resources/config/doctrine-model/Route.orm.xml @@ -0,0 +1,10 @@ + + + + + + + + diff --git a/Resources/config/doctrine-orm/Route.orm.xml b/Resources/config/doctrine-orm/Route.orm.xml new file mode 100644 index 00000000..655cef10 --- /dev/null +++ b/Resources/config/doctrine-orm/Route.orm.xml @@ -0,0 +1,30 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Resources/config/provider_orm.xml b/Resources/config/provider_orm.xml new file mode 100644 index 00000000..e88420ba --- /dev/null +++ b/Resources/config/provider_orm.xml @@ -0,0 +1,24 @@ + + + + + Symfony\Cmf\Bundle\RoutingBundle\Doctrine\Orm\Route + Symfony\Cmf\Bundle\RoutingBundle\Doctrine\Orm\RouteProvider + Symfony\Cmf\Bundle\RoutingBundle\Doctrine\Orm\ContentRepository + + + + + + + + + + + %cmf_routing.route_entity_class% + %cmf_routing.manager_name% + + + From 2a2b2daf6bab20938b0ca38ab4b1298015627894 Mon Sep 17 00:00:00 2001 From: Matteo Caberlotto Date: Tue, 30 Jul 2013 21:47:32 +0200 Subject: [PATCH 3/7] added namespace to orm manager name parameter --- DependencyInjection/CmfRoutingExtension.php | 2 +- Resources/config/provider_orm.xml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/DependencyInjection/CmfRoutingExtension.php b/DependencyInjection/CmfRoutingExtension.php index a45b60ee..7c2cc778 100644 --- a/DependencyInjection/CmfRoutingExtension.php +++ b/DependencyInjection/CmfRoutingExtension.php @@ -179,7 +179,7 @@ public function loadSonataPhpcrAdmin($config, XmlFileLoader $loader, ContainerBu public function loadOrmProvider($config, XmlFileLoader $loader, ContainerBuilder $container) { - $container->setParameter($this->getAlias() . '.manager_name', $config['manager_name']); + $container->setParameter($this->getAlias() . '.persistence.orm.manager_name', $config['manager_name']); $loader->load('provider_orm.xml'); } diff --git a/Resources/config/provider_orm.xml b/Resources/config/provider_orm.xml index e88420ba..ad0001ce 100644 --- a/Resources/config/provider_orm.xml +++ b/Resources/config/provider_orm.xml @@ -18,7 +18,7 @@ %cmf_routing.route_entity_class% - %cmf_routing.manager_name% + %cmf_routing.persistence.orm.manager_name% From 74cd6f3763412d599eb148105f88e9972f83d865 Mon Sep 17 00:00:00 2001 From: Matteo Caberlotto Date: Tue, 30 Jul 2013 21:52:44 +0200 Subject: [PATCH 4/7] RouteProvider::getRouteByName() returns a collection --- Doctrine/Orm/RouteProvider.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Doctrine/Orm/RouteProvider.php b/Doctrine/Orm/RouteProvider.php index d100af2d..d29873b0 100644 --- a/Doctrine/Orm/RouteProvider.php +++ b/Doctrine/Orm/RouteProvider.php @@ -47,7 +47,7 @@ protected function getCandidates($url) */ public function getRouteByName($name, $parameters = array()) { - $route = $this->getRoutesRepository()->findOneByName($name); + $route = $this->getRoutesRepository()->findBy(array('name' => $name)); if (!$route) { throw new RouteNotFoundException("No route found for name '$name'"); } From 6a34a0fe8a2c2b85b088f0534bad93312ec73811 Mon Sep 17 00:00:00 2001 From: Matteo Caberlotto Date: Tue, 30 Jul 2013 22:48:19 +0200 Subject: [PATCH 5/7] fix: orm mapping configuration options --- CmfRoutingBundle.php | 4 +++- DependencyInjection/CmfRoutingExtension.php | 1 + 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/CmfRoutingBundle.php b/CmfRoutingBundle.php index b2aaa430..f028b07c 100644 --- a/CmfRoutingBundle.php +++ b/CmfRoutingBundle.php @@ -45,7 +45,9 @@ public function build(ContainerBuilder $container) array( realpath(__DIR__ . '/Resources/config/doctrine-model') => 'Symfony\Cmf\Bundle\RoutingBundle\Model', realpath(__DIR__ . '/Resources/config/doctrine-orm') => 'Symfony\Cmf\Bundle\RoutingBundle\Doctrine\Orm', - ) + ), + array('cmf_routing.dynamic.persistence.orm.manager_name'), + 'cmf_routing.persistence.orm.enabled' ) ); } diff --git a/DependencyInjection/CmfRoutingExtension.php b/DependencyInjection/CmfRoutingExtension.php index 7c2cc778..8bc9f7f2 100644 --- a/DependencyInjection/CmfRoutingExtension.php +++ b/DependencyInjection/CmfRoutingExtension.php @@ -180,6 +180,7 @@ public function loadSonataPhpcrAdmin($config, XmlFileLoader $loader, ContainerBu public function loadOrmProvider($config, XmlFileLoader $loader, ContainerBuilder $container) { $container->setParameter($this->getAlias() . '.persistence.orm.manager_name', $config['manager_name']); + $container->setParameter($this->getAlias() . '.persistence.orm.enabled', $config['enabled']); $loader->load('provider_orm.xml'); } From f361535810ec6a92122a024aaf4aa1baf59796c5 Mon Sep 17 00:00:00 2001 From: Matteo Caberlotto Date: Tue, 30 Jul 2013 23:40:17 +0200 Subject: [PATCH 6/7] fix: added orm mapping for Symfony\Component\Routing\Route --- CmfRoutingBundle.php | 15 ++++++++++++++ Doctrine/Orm/Route.php | 20 ------------------- Model/Route.php | 10 ---------- .../Symfony.Component.Routing.Route.orm.xml | 12 +++++++++++ Resources/config/doctrine-orm/Route.orm.xml | 7 ------- 5 files changed, 27 insertions(+), 37 deletions(-) create mode 100644 Resources/config/doctrine-base/Symfony.Component.Routing.Route.orm.xml diff --git a/CmfRoutingBundle.php b/CmfRoutingBundle.php index f028b07c..28311d50 100644 --- a/CmfRoutingBundle.php +++ b/CmfRoutingBundle.php @@ -40,6 +40,7 @@ public function build(ContainerBuilder $container) } if (class_exists('Doctrine\Bundle\DoctrineBundle\DependencyInjection\Compiler\DoctrineOrmMappingsPass')) { + $container->addCompilerPass($this->buildBaseOrmCompilerPass()); $container->addCompilerPass( DoctrineOrmMappingsPass::createXmlMappingDriver( array( @@ -53,6 +54,20 @@ public function build(ContainerBuilder $container) } } + private function buildBaseOrmCompilerPass() + { + $arguments = array(array(realpath(__DIR__ . '/Resources/config/doctrine-base')), '.orm.xml'); + $locator = new Definition('Doctrine\Common\Persistence\Mapping\Driver\DefaultFileLocator', $arguments); + $driver = new Definition('Doctrine\ORM\Mapping\Driver\XmlDriver', array($locator)); + + return new DoctrineOrmMappingsPass( + $driver, + array('Symfony\Component\Routing'), + array('cmf_routing.dynamic.persistence.orm.manager_name'), + 'cmf_routing.persistence.orm.enabled' + ); + } + /** * Build the compiler pass for the symfony core routing component. The * factory method uses the SymfonyFileLocator which will look at the diff --git a/Doctrine/Orm/Route.php b/Doctrine/Orm/Route.php index 01329c3e..236df273 100644 --- a/Doctrine/Orm/Route.php +++ b/Doctrine/Orm/Route.php @@ -24,24 +24,4 @@ class Route extends RouteModel * {@inheritDoc} */ protected $addTrailingSlash; - - /** - * {@inheritDoc} - */ - protected $host; - - /** - * {@inheritDoc} - */ - protected $defaults; - - /** - * {@inheritDoc} - */ - protected $requirements; - - /** - * {@inheritDoc} - */ - protected $options; } diff --git a/Model/Route.php b/Model/Route.php index e5999cdf..4373ab06 100644 --- a/Model/Route.php +++ b/Model/Route.php @@ -259,16 +259,6 @@ public function compile() return parent::compile(); } - /** - * {@inheritDoc} - * - * Required by orm - */ - public function getDefaults() - { - return $this->defaults; - } - public function __toString() { return (string) $this->id; diff --git a/Resources/config/doctrine-base/Symfony.Component.Routing.Route.orm.xml b/Resources/config/doctrine-base/Symfony.Component.Routing.Route.orm.xml new file mode 100644 index 00000000..29192202 --- /dev/null +++ b/Resources/config/doctrine-base/Symfony.Component.Routing.Route.orm.xml @@ -0,0 +1,12 @@ + + + + + + + + + + diff --git a/Resources/config/doctrine-orm/Route.orm.xml b/Resources/config/doctrine-orm/Route.orm.xml index 655cef10..29d98bb0 100644 --- a/Resources/config/doctrine-orm/Route.orm.xml +++ b/Resources/config/doctrine-orm/Route.orm.xml @@ -10,16 +10,9 @@ - - - - - - - From 48194cb53106288778a3a4552a7da8da13c826eb Mon Sep 17 00:00:00 2001 From: David Buchmann Date: Wed, 31 Jul 2013 01:55:13 +0200 Subject: [PATCH 7/7] making configuration consistent --- CmfRoutingBundle.php | 13 +++++++------ DependencyInjection/CmfRoutingExtension.php | 10 +++++----- Doctrine/Orm/Route.php | 5 ----- Resources/config/admin-phpcr.xml | 6 +++--- Resources/config/doctrine-model/Route.orm.xml | 8 +++++++- Resources/config/doctrine-orm/Route.orm.xml | 7 ------- Resources/config/provider-phpcr.xml | 12 ++++++------ Resources/config/provider_orm.xml | 2 +- 8 files changed, 29 insertions(+), 34 deletions(-) diff --git a/CmfRoutingBundle.php b/CmfRoutingBundle.php index 28311d50..fcce4960 100644 --- a/CmfRoutingBundle.php +++ b/CmfRoutingBundle.php @@ -3,7 +3,7 @@ namespace Symfony\Cmf\Bundle\RoutingBundle; use Doctrine\Bundle\PHPCRBundle\DependencyInjection\Compiler\DoctrinePhpcrMappingsPass; -use Doctrine\Bundle\DoctrineBundle\DependencyInjection\Compiler\DoctrineOrmMappingsPass; +use Symfony\Cmf\Bundle\CoreBundle\DependencyInjection\Compiler\DoctrineOrmMappingsPass; use Symfony\Component\DependencyInjection\Definition; use Symfony\Component\HttpKernel\Bundle\Bundle; use Symfony\Component\DependencyInjection\ContainerBuilder; @@ -34,12 +34,13 @@ public function build(ContainerBuilder $container) realpath(__DIR__ . '/Resources/config/doctrine-model') => 'Symfony\Cmf\Bundle\RoutingBundle\Model', realpath(__DIR__ . '/Resources/config/doctrine-phpcr') => 'Symfony\Cmf\Bundle\RoutingBundle\Doctrine\Phpcr', ), - array('cmf_routing.manager_name') + array('cmf_routing.dynamic.persistence.phpcr.manager_name'), + 'cmf_routing.backend_type_phpcr' ) ); } - if (class_exists('Doctrine\Bundle\DoctrineBundle\DependencyInjection\Compiler\DoctrineOrmMappingsPass')) { + if (class_exists('Symfony\Cmf\Bundle\CoreBundle\DependencyInjection\Compiler\DoctrineOrmMappingsPass')) { $container->addCompilerPass($this->buildBaseOrmCompilerPass()); $container->addCompilerPass( DoctrineOrmMappingsPass::createXmlMappingDriver( @@ -48,7 +49,7 @@ public function build(ContainerBuilder $container) realpath(__DIR__ . '/Resources/config/doctrine-orm') => 'Symfony\Cmf\Bundle\RoutingBundle\Doctrine\Orm', ), array('cmf_routing.dynamic.persistence.orm.manager_name'), - 'cmf_routing.persistence.orm.enabled' + 'cmf_routing.backend_type_orm' ) ); } @@ -64,7 +65,7 @@ private function buildBaseOrmCompilerPass() $driver, array('Symfony\Component\Routing'), array('cmf_routing.dynamic.persistence.orm.manager_name'), - 'cmf_routing.persistence.orm.enabled' + 'cmf_routing.backend_type_orm' ); } @@ -84,7 +85,7 @@ private function buildBasePhpcrCompilerPass() return new DoctrinePhpcrMappingsPass( $driver, array('Symfony\Component\Routing'), - array('cmf_routing.manager_name'), + array('cmf_routing.dynamic.persistence.phpcr.manager_name'), 'cmf_routing.backend_type_phpcr' ); } diff --git a/DependencyInjection/CmfRoutingExtension.php b/DependencyInjection/CmfRoutingExtension.php index d7314c2e..9bd43515 100644 --- a/DependencyInjection/CmfRoutingExtension.php +++ b/DependencyInjection/CmfRoutingExtension.php @@ -148,10 +148,10 @@ public function loadPhpcrProvider($config, XmlFileLoader $loader, ContainerBuild $container->setParameter($this->getAlias() . '.backend_type_phpcr', true); - $container->setParameter($this->getAlias() . '.persistence.phpcr.route_basepath', $config['route_basepath']); - $container->setParameter($this->getAlias() . '.persistence.phpcr.content_basepath', $config['content_basepath']); + $container->setParameter($this->getAlias() . '.dynamic.persistence.phpcr.route_basepath', $config['route_basepath']); + $container->setParameter($this->getAlias() . '.dynamic.persistence.phpcr.content_basepath', $config['content_basepath']); - $container->setParameter($this->getAlias() . '.manager_name', $config['manager_name']); + $container->setParameter($this->getAlias() . '.dynamic.persistence.phpcr.manager_name', $config['manager_name']); $container->setAlias($this->getAlias() . '.route_provider', $this->getAlias() . '.phpcr_route_provider'); $container->setAlias($this->getAlias() . '.content_repository', $this->getAlias() . '.phpcr_content_repository'); @@ -179,8 +179,8 @@ public function loadSonataPhpcrAdmin($config, XmlFileLoader $loader, ContainerBu public function loadOrmProvider($config, XmlFileLoader $loader, ContainerBuilder $container) { - $container->setParameter($this->getAlias() . '.persistence.orm.manager_name', $config['manager_name']); - $container->setParameter($this->getAlias() . '.persistence.orm.enabled', $config['enabled']); + $container->setParameter($this->getAlias() . '.dynamic.persistence.orm.manager_name', $config['manager_name']); + $container->setParameter($this->getAlias() . '.backend_type_orm', true); $loader->load('provider_orm.xml'); } diff --git a/Doctrine/Orm/Route.php b/Doctrine/Orm/Route.php index 236df273..114fc8f4 100644 --- a/Doctrine/Orm/Route.php +++ b/Doctrine/Orm/Route.php @@ -19,9 +19,4 @@ class Route extends RouteModel * {@inheritDoc} */ protected $position; - - /** - * {@inheritDoc} - */ - protected $addTrailingSlash; } diff --git a/Resources/config/admin-phpcr.xml b/Resources/config/admin-phpcr.xml index daab38c9..2e9aa97c 100644 --- a/Resources/config/admin-phpcr.xml +++ b/Resources/config/admin-phpcr.xml @@ -25,11 +25,11 @@ - %cmf_routing.persistence.phpcr.content_basepath% + %cmf_routing.dynamic.persistence.phpcr.content_basepath% - %cmf_routing.persistence.phpcr.route_basepath% + %cmf_routing.dynamic.persistence.phpcr.route_basepath% @@ -47,7 +47,7 @@ - %cmf_routing.persistence.phpcr.route_basepath% + %cmf_routing.dynamic.persistence.phpcr.route_basepath% diff --git a/Resources/config/doctrine-model/Route.orm.xml b/Resources/config/doctrine-model/Route.orm.xml index be0c6331..d815a646 100644 --- a/Resources/config/doctrine-model/Route.orm.xml +++ b/Resources/config/doctrine-model/Route.orm.xml @@ -2,9 +2,15 @@ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="https://raw.github.com/doctrine/doctrine2/master/doctrine-mapping.xsd"> - + + + + + + + diff --git a/Resources/config/doctrine-orm/Route.orm.xml b/Resources/config/doctrine-orm/Route.orm.xml index 29d98bb0..039081d3 100644 --- a/Resources/config/doctrine-orm/Route.orm.xml +++ b/Resources/config/doctrine-orm/Route.orm.xml @@ -9,14 +9,7 @@ - - - - - - - diff --git a/Resources/config/provider-phpcr.xml b/Resources/config/provider-phpcr.xml index 2dd23b5a..59a60c7d 100644 --- a/Resources/config/provider-phpcr.xml +++ b/Resources/config/provider-phpcr.xml @@ -15,23 +15,23 @@ %cmf_routing.route_model_class% - %cmf_routing.manager_name% - %cmf_routing.persistence.phpcr.route_basepath% + %cmf_routing.dynamic.persistence.phpcr.manager_name% + %cmf_routing.dynamic.persistence.phpcr.route_basepath% - %cmf_routing.manager_name% + %cmf_routing.dynamic.persistence.phpcr.manager_name% - %cmf_routing.persistence.phpcr.route_basepath% + %cmf_routing.dynamic.persistence.phpcr.route_basepath% - %cmf_routing.persistence.phpcr.route_basepath% + %cmf_routing.dynamic.persistence.phpcr.route_basepath% %cmf_routing.locales% @@ -40,7 +40,7 @@ - %cmf_routing.persistence.phpcr.route_basepath% + %cmf_routing.dynamic.persistence.phpcr.route_basepath% diff --git a/Resources/config/provider_orm.xml b/Resources/config/provider_orm.xml index ad0001ce..4e8fc709 100644 --- a/Resources/config/provider_orm.xml +++ b/Resources/config/provider_orm.xml @@ -18,7 +18,7 @@ %cmf_routing.route_entity_class% - %cmf_routing.persistence.orm.manager_name% + %cmf_routing.dynamic.persistence.orm.manager_name%