Skip to content

Commit c5888a8

Browse files
committed
no need to specify manager_registry when we know its the phpcr one. fix tests to use getContent
1 parent 812ea9b commit c5888a8

File tree

10 files changed

+18
-21
lines changed

10 files changed

+18
-21
lines changed

Admin/RedirectRouteAdmin.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ class RedirectRouteAdmin extends Admin
1515
* work around https://github.com/sonata-project/SonataAdminBundle/pull/1472
1616
*/
1717
protected $baseRouteName = 'cmf_routing';
18-
18+
1919
/**
2020
* work around https://github.com/sonata-project/SonataAdminBundle/pull/1472
2121
*/

DependencyInjection/CmfRoutingExtension.php

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -136,10 +136,6 @@ public function loadPhpcrProvider($config, XmlFileLoader $loader, ContainerBuild
136136
$container->setParameter($this->getAlias() . '.phpcr_provider.route_basepath', $config['route_basepath']);
137137
$container->setParameter($this->getAlias() . '.phpcr_provider.content_basepath', $config['content_basepath']);
138138

139-
$routeProvider = $container->getDefinition($this->getAlias() . '.phpcr_route_provider');
140-
$routeProvider->replaceArgument(0, new Reference($config['manager_registry']));
141-
$contentRepository = $container->getDefinition($this->getAlias() . '.phpcr_content_repository');
142-
$contentRepository->replaceArgument(0, new Reference($config['manager_registry']));
143139
$container->setParameter($this->getAlias() . '.manager_name', $config['manager_name']);
144140

145141
$container->setAlias($this->getAlias() . '.route_provider', $this->getAlias() . '.phpcr_route_provider');

DependencyInjection/Configuration.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,6 @@ public function getConfigTreeBuilder()
6161
->arrayNode('phpcr_provider')
6262
->children()
6363
->scalarNode('enabled')->defaultNull()->end()
64-
->scalarNode('manager_registry')->defaultValue('doctrine_phpcr')->end()
6564
->scalarNode('manager_name')->defaultNull()->end()
6665
->scalarNode('route_basepath')->defaultValue('/cms/routes')->end()
6766
->scalarNode('content_basepath')->defaultValue('/cms/content')->end()

Resources/config/provider_phpcr.xml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,23 +4,23 @@
44
xsi:schemaLocation="http://symfony.com/schema/dic/services http://symfony.com/schema/dic/services/services-1.0.xsd">
55

66
<parameters>
7-
<parameter key="cmf_routing.route_provider_class">Symfony\Cmf\Bundle\RoutingBundle\Doctrine\Phpcr\RouteProvider</parameter>
7+
<parameter key="cmf_routing.phpcr_route_provider_class">Symfony\Cmf\Bundle\RoutingBundle\Doctrine\Phpcr\RouteProvider</parameter>
88
<parameter key="cmf_routing.content_repository_class">Symfony\Cmf\Bundle\RoutingBundle\Doctrine\Phpcr\ContentRepository</parameter>
99
<parameter key="cmf_routing.phpcrodm_route_idprefix_listener_class">Symfony\Cmf\Bundle\RoutingBundle\Doctrine\Phpcr\IdPrefixListener</parameter>
1010
<parameter key="cmf_routing.phpcrodm_route_locale_listener_class">Symfony\Cmf\Bundle\RoutingBundle\Doctrine\Phpcr\LocaleListener</parameter>
1111
</parameters>
1212

1313
<services>
1414

15-
<service id="cmf_routing.phpcr_route_provider" class="%cmf_routing.route_provider_class%">
16-
<argument/>
15+
<service id="cmf_routing.phpcr_route_provider" class="%cmf_routing.phpcr_route_provider_class%">
16+
<argument type="service" id="doctrine_phpcr"/>
1717
<argument>%cmf_routing.route_model_class%</argument>
1818
<call method="setManagerName"><argument>%cmf_routing.manager_name%</argument></call>
1919
<call method="setPrefix"><argument>%cmf_routing.phpcr_provider.route_basepath%</argument></call>
2020
</service>
2121

2222
<service id="cmf_routing.phpcr_content_repository" class="%cmf_routing.content_repository_class%">
23-
<argument/>
23+
<argument type="service" id="doctrine_phpcr"/>
2424
<call method="setManagerName"><argument>%cmf_routing.manager_name%</argument></call>
2525
</service>
2626

Tests/DependencyInjection/CmfRoutingExtensionTest.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ public function testLoadDefault()
2929
array(
3030
'dynamic' => array(
3131
'phpcr_provider' => array(
32+
'enabled' => true,
3233
'use_sonata_admin' => false,
3334
),
3435
),

Tests/Functional/Controller/RedirectControllerTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ public function testRedirectContent()
5555
$root = self::$dm->find(null, self::ROUTE_ROOT);
5656

5757
$route = new Route;
58-
$route->setRouteContent($root); // this happens to be a referenceable node
58+
$route->setContent($root); // this happens to be a referenceable node
5959
$route->setPosition($root, 'testroute');
6060
self::$dm->persist($route);
6161

Tests/Functional/Doctrine/Phpcr/RedirectRouteTest.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ public function testRedirectDoctrine()
2222
$root = self::$dm->find(null, self::ROUTE_ROOT);
2323

2424
$route = new Route;
25-
$route->setRouteContent($root); // this happens to be a referenceable node
25+
$route->setContent($root); // this happens to be a referenceable node
2626
$route->setPosition($root, 'testroute');
2727
self::$dm->persist($route);
2828

@@ -40,7 +40,7 @@ public function testRedirectDoctrine()
4040
$redirect = self::$dm->find(null, self::ROUTE_ROOT.'/redirect');
4141

4242
$this->assertInstanceOf('Symfony\\Cmf\\Component\\Routing\\RedirectRouteInterface', $redirect);
43-
$this->assertSame($redirect, $redirect->getRouteContent());
43+
$this->assertSame($redirect, $redirect->getContent());
4444
$params = $redirect->getParameters();
4545
$this->assertSame($route, $redirect->getRouteTarget());
4646
$defaults = $redirect->getDefaults();
@@ -54,6 +54,6 @@ public function testSetContent()
5454
{
5555
$content = $this->getMock('Symfony\\Cmf\\Component\\Routing\\RouteAwareInterface');
5656
$redirect = new RedirectRoute;
57-
$redirect->setRouteContent($content);
57+
$redirect->setContent($content);
5858
}
5959
}

Tests/Functional/Doctrine/Phpcr/RouteTest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ public function testPersist()
2121
$route = new Route;
2222
$root = self::$dm->find(null, self::ROUTE_ROOT);
2323

24-
$route->setRouteContent($root); // this happens to be a referenceable node
24+
$route->setContent($root); // this happens to be a referenceable node
2525
$route->setPosition($root, 'testroute');
2626
$route->setDefault('x', 'y');
2727
$route->setRequirement('testreq', 'testregex');
@@ -36,7 +36,7 @@ public function testPersist()
3636

3737
$route = self::$dm->find(null, self::ROUTE_ROOT.'/testroute');
3838

39-
$this->assertNotNull($route->getRouteContent());
39+
$this->assertNotNull($route->getContent());
4040
$this->assertEquals('/testroute', $route->getPattern());
4141

4242
$this->assertEquals('y', $route->getDefault('x'));

Tests/Functional/Routing/DynamicRouterTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -220,7 +220,7 @@ public function testEnhanceTemplateByClass()
220220
// put a route for this content
221221
$root = self::$dm->find(null, self::ROUTE_ROOT);
222222
$route = new Route;
223-
$route->setRouteContent($document);
223+
$route->setContent($document);
224224
$route->setPosition($root, 'templatebyclass');
225225
self::$dm->persist($route);
226226
self::$dm->flush();

UPGRADE-1.1.md

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,13 +8,14 @@ PHPCR specific configurations moved into
88

99
dynamic:
1010
phpcr_provider:
11-
use_sonata_admin: auto
12-
manager_registry: ~
13-
manager_name: ~
11+
enabled: true
12+
# the rest is optional, the defaults are
1413
route_basepath: ~
14+
manager_name: ~
1515
content_basepath: ~
16+
use_sonata_admin: auto
1617

17-
You need to at least set `phpcr_provider: ~` to have the PHPCR provider loaded.
18+
You need to at least set `phpcr_provider.enabled: true` to have the PHPCR provider loaded.
1819

1920
Dropped redundant unused `routing_repositoryroot` configuration.
2021

0 commit comments

Comments
 (0)