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