Skip to content
This repository was archived by the owner on Sep 16, 2021. It is now read-only.

Commit 55aeb2f

Browse files
authored
Merge pull request #96 from symfony-cmf/remove-route-root-logic
Removed route root logic
2 parents 3866791 + 705e505 commit 55aeb2f

File tree

3 files changed

+5
-34
lines changed

3 files changed

+5
-34
lines changed

src/Admin/Routing/RedirectRouteAdmin.php

Lines changed: 2 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -23,13 +23,6 @@ class RedirectRouteAdmin extends AbstractAdmin
2323
{
2424
protected $translationDomain = 'CmfSonataPhpcrAdminIntegrationBundle';
2525

26-
/**
27-
* Root path for the route parent selection.
28-
*
29-
* @var string
30-
*/
31-
protected $routeRoot;
32-
3326
protected function configureListFields(ListMapper $listMapper)
3427
{
3528
$listMapper->addIdentifier('path', 'text');
@@ -42,7 +35,7 @@ protected function configureFormFields(FormMapper $formMapper)
4235
->add(
4336
'parentDocument',
4437
TreeSelectType::class,
45-
['root_node' => $this->routeRoot, 'widget' => 'browser']
38+
['root_node' => $this->getRootPath(), 'widget' => 'browser']
4639
)
4740
->add('name', TextType::class)
4841
->end()
@@ -53,7 +46,7 @@ protected function configureFormFields(FormMapper $formMapper)
5346
->add(
5447
'routeTarget',
5548
TreeSelectType::class,
56-
['root_node' => $this->routeRoot, 'widget' => 'browser', 'required' => false]
49+
['root_node' => $this->getRootPath(), 'widget' => 'browser', 'required' => false]
5750
)
5851
->end()
5952
;
@@ -66,11 +59,6 @@ protected function configureDatagridFilters(DatagridMapper $datagridMapper)
6659
$datagridMapper->add('name', 'doctrine_phpcr_nodename');
6760
}
6861

69-
public function setRouteRoot($routeRoot)
70-
{
71-
$this->routeRoot = $routeRoot;
72-
}
73-
7462
public function getExportFormats()
7563
{
7664
return array();

src/Admin/Routing/RouteAdmin.php

Lines changed: 1 addition & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -21,19 +21,11 @@
2121
use Symfony\Component\Form\Extension\Core\Type\TextType;
2222
use Symfony\Cmf\Bundle\RoutingBundle\Model\Route;
2323
use Symfony\Cmf\Bundle\RoutingBundle\Form\Type\RouteTypeType;
24-
use PHPCR\Util\PathHelper;
2524

2625
class RouteAdmin extends AbstractAdmin
2726
{
2827
protected $translationDomain = 'CmfSonataPhpcrAdminIntegrationBundle';
2928

30-
/**
31-
* Root path for the route parent selection.
32-
*
33-
* @var string
34-
*/
35-
protected $routeRoot;
36-
3729
/**
3830
* Root path for the route content selection.
3931
*
@@ -54,7 +46,7 @@ protected function configureFormFields(FormMapper $formMapper)
5446
->add(
5547
'parentDocument',
5648
TreeSelectType::class,
57-
['root_node' => $this->routeRoot, 'widget' => 'browser']
49+
['root_node' => $this->getRootPath(), 'widget' => 'browser']
5850
)
5951
->add('name', TextType::class)
6052
->end() // group location
@@ -111,15 +103,6 @@ protected function configureDatagridFilters(DatagridMapper $datagridMapper)
111103
$datagridMapper->add('name', 'doctrine_phpcr_nodename');
112104
}
113105

114-
public function setRouteRoot($routeRoot)
115-
{
116-
// make limitation on base path work
117-
parent::setRootPath($routeRoot);
118-
// TODO: fix widget to show root node when root is selectable
119-
// https://github.com/sonata-project/SonataDoctrinePhpcrAdminBundle/issues/148
120-
$this->routeRoot = PathHelper::getParentPath($routeRoot);
121-
}
122-
123106
public function setContentRoot($contentRoot)
124107
{
125108
$this->contentRoot = $contentRoot;

src/Resources/config/routing.xml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@
2828
<argument>%cmf_sonata_phpcr_admin_integration.routing.content_basepath%</argument>
2929
</call>
3030

31-
<call method="setRouteRoot">
31+
<call method="setRootPath">
3232
<argument>%cmf_sonata_phpcr_admin_integration.routing.basepath%</argument>
3333
</call>
3434
</service>
@@ -52,7 +52,7 @@
5252
<argument type="service" id="sonata.admin.route.path_info_slashes" />
5353
</call>
5454

55-
<call method="setRouteRoot">
55+
<call method="setRootPath">
5656
<argument>%cmf_sonata_phpcr_admin_integration.routing.basepath%</argument>
5757
</call>
5858
</service>

0 commit comments

Comments
 (0)