Exponential 5.x Kernel 7.5.40 Exponential New Stack (Symfony-based) Kernel — PHP Class Reference

Core/REST/Server/Controller/URLWildcard.php
Go to the documentation of this file.
1 <?php
2
7 namespace eZ\Publish\Core\REST\Server\Controller;
8
9 use eZ\Publish\Core\REST\Server\Exceptions\ForbiddenException;
10 use eZ\Publish\API\Repository\Exceptions\InvalidArgumentException;
11 use eZ\Publish\Core\REST\Common\Message;
12 use eZ\Publish\Core\REST\Server\Values;
13 use eZ\Publish\Core\REST\Server\Controller as RestController;
14 use eZ\Publish\API\Repository\URLWildcardService;
15 use Symfony\Component\HttpFoundation\Request;
16
20 class URLWildcard extends RestController
21 {
27 protected $urlWildcardService;
28
34 public function __construct(URLWildcardService $urlWildcardService)
35 {
36 $this->urlWildcardService = $urlWildcardService;
37 }
38
46 public function loadURLWildcard($urlWildcardId)
47 {
48 return $this->urlWildcardService->load($urlWildcardId);
49 }
50
56 public function listURLWildcards()
57 {
58 return new Values\URLWildcardList(
59 $this->urlWildcardService->loadAll()
60 );
61 }
62
70 public function createURLWildcard(Request $request)
71 {
72 $urlWildcardCreate = $this->inputDispatcher->parse(
73 new Message(
74 ['Content-Type' => $request->headers->get('Content-Type')],
75 $request->getContent()
76 )
77 );
78
79 try {
80 $createdURLWildcard = $this->urlWildcardService->create(
81 $urlWildcardCreate['sourceUrl'],
82 $urlWildcardCreate['destinationUrl'],
83 $urlWildcardCreate['forward']
84 );
85 } catch (InvalidArgumentException $e) {
86 throw new ForbiddenException($e->getMessage());
87 }
88
89 return new Values\CreatedURLWildcard(
90 [
91 'urlWildcard' => $createdURLWildcard,
92 ]
93 );
94 }
95
103 public function deleteURLWildcard($urlWildcardId)
104 {
105 $this->urlWildcardService->remove(
106 $this->urlWildcardService->load($urlWildcardId)
107 );
108
109 return new Values\NoContent();
110 }
111 }
eZ\Publish\API\Repository\Exceptions\InvalidArgumentException
This exception is thrown if a service method is called with an illegal or non appropriate value.
Definition: API/Repository/Exceptions/InvalidArgumentException.php:13
eZ\Publish\Core\Base\Exceptions\ForbiddenException
Forbidden Exception implementation.
Definition: Core/Base/Exceptions/ForbiddenException.php:17
eZ\Publish\Core\REST\Common\Message
Simple response struct.
Definition: Core/REST/Common/Message.php:13
eZ\Publish\Core\REST\Server\Controller\URLWildcard
URLWildcard controller.
Definition: Core/REST/Server/Controller/URLWildcard.php:21
eZ\Publish\Core\REST\Server\Controller\URLWildcard\deleteURLWildcard
deleteURLWildcard($urlWildcardId)
The given URL wildcard is deleted.
Definition: Core/REST/Server/Controller/URLWildcard.php:103
eZ\Publish\Core\REST\Server\Controller\URLWildcard\createURLWildcard
createURLWildcard(Request $request)
Creates a new URL wildcard.
Definition: Core/REST/Server/Controller/URLWildcard.php:70
eZ\Publish\Core\REST\Server\Controller\URLWildcard\listURLWildcards
listURLWildcards()
Returns the list of URL wildcards.
Definition: Core/REST/Server/Controller/URLWildcard.php:56
eZ\Publish\Core\REST\Server\Controller\URLWildcard\__construct
__construct(URLWildcardService $urlWildcardService)
Construct controller.
Definition: Core/REST/Server/Controller/URLWildcard.php:34
eZ\Publish\Core\REST\Server\Controller\URLWildcard\$urlWildcardService
$urlWildcardService
Definition: Core/REST/Server/Controller/URLWildcard.php:27
eZ\Publish\Core\REST\Server\Controller\URLWildcard\loadURLWildcard
loadURLWildcard($urlWildcardId)
Returns the URL wildcard with the given id.
Definition: Core/REST/Server/Controller/URLWildcard.php:46
eZ\Publish\Core\REST\Server\Exceptions\ForbiddenException
Exception thrown if the request is forbidden.
Definition: Core/REST/Server/Exceptions/ForbiddenException.php:15
eZ\Publish\Core\REST\Server\Values\CreatedURLWildcard
Struct representing a freshly created URLWildcard.
Definition: Values/CreatedURLWildcard.php:15
eZ\Publish\Core\REST\Server\Values\NoContent
Definition: Values/NoContent.php:12
eZ\Publish\Core\REST\Server\Values\URLWildcardList
URLWildcard list view model.
Definition: Values/URLWildcardList.php:15
eZ\Publish\API\Repository\URLWildcardService
Definition: API/Repository/URLWildcardService.php:17
eZ\Publish\Core\REST\Server\Controller
Definition: BinaryContent.php:7
eZ\Publish\Core\REST\Server\Values
Definition: Core/REST/Server/Values/BookmarkList.php:9
Copyright © 1998 – 2026 7x. All rights reserved. Licensed under the GNU GPLv2+.