|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
/* |
|
4
|
|
|
* This file is part of the Sonata package. |
|
5
|
|
|
* |
|
6
|
|
|
* (c) Thomas Rabaix <[email protected]> |
|
7
|
|
|
* |
|
8
|
|
|
* For the full copyright and license information, please view the LICENSE |
|
9
|
|
|
* file that was distributed with this source code. |
|
10
|
|
|
* |
|
11
|
|
|
*/ |
|
12
|
|
|
|
|
13
|
|
|
namespace Sonata\DoctrinePHPCRAdminBundle\Route; |
|
14
|
|
|
|
|
15
|
|
|
use Sonata\AdminBundle\Builder\RouteBuilderInterface; |
|
16
|
|
|
use Sonata\AdminBundle\Admin\AdminInterface; |
|
17
|
|
|
use Sonata\AdminBundle\Route\RouteCollection; |
|
18
|
|
|
|
|
19
|
|
|
class PathInfoBuilderSlashes implements RouteBuilderInterface |
|
20
|
|
|
{ |
|
21
|
|
|
/** |
|
22
|
|
|
* RouteBuilder that allows slashes in the ids. |
|
23
|
|
|
* |
|
24
|
|
|
* {@inheritDoc} |
|
25
|
|
|
*/ |
|
26
|
|
|
function build(AdminInterface $admin, RouteCollection $collection) |
|
|
|
|
|
|
27
|
|
|
{ |
|
28
|
|
|
|
|
29
|
|
|
$collection->add('list'); |
|
30
|
|
|
$collection->add('create'); |
|
31
|
|
|
$collection->add('batch', null, array(), array('_method' => 'POST')); |
|
32
|
|
|
$collection->add('edit', $admin->getRouterIdParameter().'/edit', array(), array('id' => '.+')); |
|
33
|
|
|
$collection->add('delete', $admin->getRouterIdParameter().'/delete', array(), array('id' => '.+')); |
|
34
|
|
|
$collection->add('export'); |
|
35
|
|
|
$collection->add('show', $admin->getRouterIdParameter().'/show', array(), array('id' => '.+', '_method' => 'GET')); |
|
36
|
|
|
|
|
37
|
|
|
if ($admin->isAclEnabled()) { |
|
38
|
|
|
$collection->add('acl', $admin->getRouterIdParameter().'/acl', array(), array('id' => '.+')); |
|
39
|
|
|
} |
|
40
|
|
|
|
|
41
|
|
|
// add children urls |
|
42
|
|
|
foreach ($admin->getChildren() as $children) { |
|
43
|
|
|
$collection->addCollection($children->getRoutes()); |
|
44
|
|
|
} |
|
45
|
|
|
} |
|
46
|
|
|
} |
|
47
|
|
|
|
Adding explicit visibility (
private,protected, orpublic) is generally recommend to communicate to other developers how, and from where this method is intended to be used.