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

Core/Persistence/Legacy/URL/Handler.php
Go to the documentation of this file.
1 <?php
2
7 namespace eZ\Publish\Core\Persistence\Legacy\URL;
8
9 use eZ\Publish\API\Repository\Values\URL\URLQuery;
10 use eZ\Publish\Core\Base\Exceptions\NotFoundException;
11 use eZ\Publish\SPI\Persistence\URL\Handler as HandlerInterface;
12 use eZ\Publish\SPI\Persistence\URL\URLUpdateStruct;
13
17 class Handler implements HandlerInterface
18 {
20 private $urlGateway;
21
23 private $urlMapper;
24
31 public function __construct(Gateway $gateway, Mapper $mapper)
32 {
33 $this->urlGateway = $gateway;
34 $this->urlMapper = $mapper;
35 }
36
40 public function updateUrl($id, URLUpdateStruct $urlUpdateStruct)
41 {
42 $url = $this->urlMapper->createURLFromUpdateStruct(
43 $urlUpdateStruct
44 );
45 $url->id = $id;
46
47 $this->urlGateway->updateUrl($url);
48
49 return $url;
50 }
51
55 public function find(URLQuery $query)
56 {
57 $results = $this->urlGateway->find(
58 $query->filter,
59 $query->offset,
60 $query->limit,
61 $query->sortClauses
62 );
63
64 return [
65 'count' => $results['count'],
66 'items' => $this->urlMapper->extractURLsFromRows($results['rows']),
67 ];
68 }
69
73 public function loadById($id)
74 {
75 $url = $this->urlMapper->extractURLsFromRows(
76 $this->urlGateway->loadUrlData($id)
77 );
78
79 if (count($url) < 1) {
80 throw new NotFoundException('URL', $id);
81 }
82
83 return reset($url);
84 }
85
89 public function loadByUrl($url)
90 {
91 $urls = $this->urlMapper->extractURLsFromRows(
92 $this->urlGateway->loadUrlDataByUrl($url)
93 );
94
95 if (count($urls) < 1) {
96 throw new NotFoundException('URL', $url);
97 }
98
99 return reset($urls);
100 }
101
105 public function findUsages($id)
106 {
107 $ids = $this->urlGateway->findUsages($id);
108
109 return $ids;
110 }
111 }
eZ\Publish\API\Repository\Values\URL\URLQuery
This class is used to perform a URL query.
Definition: URLQuery.php:15
eZ\Publish\Core\Base\Exceptions\NotFoundException
Not Found Exception implementation.
Definition: Core/Base/Exceptions/NotFoundException.php:21
eZ\Publish\Core\Persistence\Legacy\URL\Gateway
Definition: Persistence/Legacy/URL/Gateway.php:14
eZ\Publish\Core\Persistence\Legacy\URL\Handler
Storage Engine handler for URLs.
Definition: Core/Persistence/Legacy/URL/Handler.php:18
eZ\Publish\Core\Persistence\Legacy\URL\Handler\$urlMapper
$urlMapper
Definition: Core/Persistence/Legacy/URL/Handler.php:23
eZ\Publish\Core\Persistence\Legacy\URL\Handler\loadByUrl
loadByUrl($url)
{}
Definition: Core/Persistence/Legacy/URL/Handler.php:89
eZ\Publish\Core\Persistence\Legacy\URL\Handler\$urlGateway
$urlGateway
Definition: Core/Persistence/Legacy/URL/Handler.php:20
eZ\Publish\Core\Persistence\Legacy\URL\Handler\findUsages
findUsages($id)
{}
Definition: Core/Persistence/Legacy/URL/Handler.php:105
eZ\Publish\Core\Persistence\Legacy\URL\Handler\loadById
loadById($id)
{}
Definition: Core/Persistence/Legacy/URL/Handler.php:73
eZ\Publish\Core\Persistence\Legacy\URL\Handler\updateUrl
updateUrl($id, URLUpdateStruct $urlUpdateStruct)
{}
Definition: Core/Persistence/Legacy/URL/Handler.php:40
eZ\Publish\Core\Persistence\Legacy\URL\Handler\find
find(URLQuery $query)
{}
Definition: Core/Persistence/Legacy/URL/Handler.php:55
eZ\Publish\Core\Persistence\Legacy\URL\Handler\__construct
__construct(Gateway $gateway, Mapper $mapper)
Handler constructor.
Definition: Core/Persistence/Legacy/URL/Handler.php:31
eZ\Publish\Core\Persistence\Legacy\URL\Mapper
URL Mapper.
Definition: Publish/Core/Persistence/Legacy/URL/Mapper.php:16
eZ\Publish\SPI\Persistence\URL\URLUpdateStruct
Definition: SPI/Persistence/URL/URLUpdateStruct.php:12
eZ\Publish\SPI\Persistence\URL\Handler
The URL Handler interface defines operations on URLs in the storage engine.
Definition: SPI/Persistence/URL/Handler.php:15
Copyright © 1998 – 2026 7x. All rights reserved. Licensed under the GNU GPLv2+.