|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
/** |
|
4
|
|
|
* File containing the URLAlias controller class. |
|
5
|
|
|
* |
|
6
|
|
|
* @copyright Copyright (C) eZ Systems AS. All rights reserved. |
|
7
|
|
|
* @license For full copyright and license information view LICENSE file distributed with this source code. |
|
8
|
|
|
* |
|
9
|
|
|
* @version //autogentag// |
|
10
|
|
|
*/ |
|
11
|
|
|
namespace eZ\Publish\Core\REST\Server\HttpCache\Controller; |
|
12
|
|
|
|
|
13
|
|
|
use eZ\Publish\API\Repository\Values\Content\URLAlias as URLAliasValue; |
|
14
|
|
|
use eZ\Publish\Core\REST\Server\Values\CachedValue; |
|
15
|
|
|
use Symfony\Component\HttpFoundation\Request; |
|
16
|
|
|
|
|
17
|
|
|
class URLAliasController extends AbstractController |
|
18
|
|
|
{ |
|
19
|
|
|
/** |
|
20
|
|
|
* @var \eZ\Publish\Core\REST\Server\Controller\URLAlias |
|
21
|
|
|
*/ |
|
22
|
|
|
protected $innerController; |
|
23
|
|
|
|
|
24
|
|
|
/** |
|
25
|
|
|
* @param \eZ\Publish\Core\REST\Server\Controller\Location $innerController |
|
26
|
|
|
*/ |
|
27
|
|
|
public function __construct($innerController) |
|
28
|
|
|
{ |
|
29
|
|
|
$this->innerController = $innerController; |
|
|
|
|
|
|
30
|
|
|
} |
|
31
|
|
|
|
|
32
|
|
|
public function loadURLAlias($urlAliasId) |
|
33
|
|
|
{ |
|
34
|
|
|
$urlAlias = $this->innerController->loadURLAlias($urlAliasId); |
|
35
|
|
|
|
|
36
|
|
|
return $urlAlias->type === URLAliasValue::LOCATION ? new CachedValue( |
|
37
|
|
|
$urlAlias, |
|
38
|
|
|
[ |
|
39
|
|
|
'location' => $urlAlias->destination |
|
40
|
|
|
] |
|
41
|
|
|
) : $urlAlias; |
|
42
|
|
|
} |
|
43
|
|
|
|
|
44
|
|
|
public function listGlobalURLAliases() |
|
45
|
|
|
{ |
|
46
|
|
|
return $this->innerController->listGlobalURLAliases(); |
|
47
|
|
|
} |
|
48
|
|
|
|
|
49
|
|
|
public function listLocationURLAliases($locationPath, Request $request) |
|
50
|
|
|
{ |
|
51
|
|
|
$aliasesRefList = $this->innerController->listLocationURLAliases($locationPath, $request); |
|
52
|
|
|
$pathArray = explode('/', trim($locationPath, '/')); |
|
53
|
|
|
|
|
54
|
|
|
return new CachedValue( |
|
55
|
|
|
$aliasesRefList, |
|
56
|
|
|
[ |
|
57
|
|
|
'location' => array_pop($pathArray), |
|
58
|
|
|
] |
|
59
|
|
|
); |
|
60
|
|
|
} |
|
61
|
|
|
|
|
62
|
|
|
public function createURLAlias(Request $request) |
|
63
|
|
|
{ |
|
64
|
|
|
return $this->innerController->createURLAlias($request); |
|
65
|
|
|
} |
|
66
|
|
|
|
|
67
|
|
|
public function deleteURLAlias($urlAliasId) |
|
68
|
|
|
{ |
|
69
|
|
|
return $this->innerController->deleteURLAlias($urlAliasId); |
|
70
|
|
|
} |
|
71
|
|
|
} |
|
72
|
|
|
|
Our type inference engine has found an assignment to a property that is incompatible with the declared type of that property.
Either this assignment is in error or the assigned type should be added to the documentation/type hint for that property..