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

ParentLocation.php
Go to the documentation of this file.
1 <?php
2
7 namespace eZ\Publish\Core\MVC\Symfony\Matcher\ContentBased\Id;
8
9 use eZ\Publish\Core\MVC\Symfony\Matcher\ContentBased\MultipleValued;
10 use eZ\Publish\API\Repository\Repository;
11 use eZ\Publish\API\Repository\Values\Content\Location as APILocation;
12 use eZ\Publish\API\Repository\Values\Content\ContentInfo;
13 use eZ\Publish\Core\MVC\Symfony\View\LocationValueView;
14 use eZ\Publish\Core\MVC\Symfony\View\View;
15
16 class ParentLocation extends MultipleValued
17 {
25 public function matchLocation(APILocation $location)
26 {
27 return isset($this->values[$location->parentLocationId]);
28 }
29
37 public function matchContentInfo(ContentInfo $contentInfo)
38 {
39 $location = $this->repository->sudo(
40 function (Repository $repository) use ($contentInfo) {
41 return $repository->getLocationService()->loadLocation($contentInfo->mainLocationId);
42 }
43 );
44
45 return isset($this->values[$location->parentLocationId]);
46 }
47
48 public function match(View $view)
49 {
50 if (!$view instanceof LocationValueView) {
51 return false;
52 }
53
54 return isset($this->values[$view->getLocation()->parentLocationId]);
55 }
56 }
eZ\Publish\API\Repository\Values\Content\ContentInfo
Definition: API/Repository/Values/Content/ContentInfo.php:31
eZ\Publish\API\Repository\Values\Content\Location
Definition: API/Repository/Values/Content/Location.php:32
eZ\Publish\Core\MVC\RepositoryAware\$repository
$repository
Definition: RepositoryAware.php:14
eZ\Publish\Core\MVC\Symfony\Matcher\ContentBased\Id\ParentLocation
Definition: ParentLocation.php:17
eZ\Publish\Core\MVC\Symfony\Matcher\ContentBased\Id\ParentLocation\matchLocation
matchLocation(APILocation $location)
Checks if a Location object matches.
Definition: ParentLocation.php:25
eZ\Publish\Core\MVC\Symfony\Matcher\ContentBased\Id\ParentLocation\matchContentInfo
matchContentInfo(ContentInfo $contentInfo)
Checks if a ContentInfo object matches.
Definition: ParentLocation.php:37
eZ\Publish\Core\MVC\Symfony\Matcher\ContentBased\Id\ParentLocation\match
match(View $view)
Matches the $view against a set of matchers.
Definition: ParentLocation.php:48
eZ\Publish\Core\MVC\Symfony\Matcher\ContentBased\MultipleValued
Abstract class for basic matchers, accepting multiple values to match against.
Definition: ContentBased/MultipleValued.php:15
eZ\Publish\API\Repository\Repository
Repository interface.
Definition: API/Repository/Repository.php:16
eZ\Publish\Core\MVC\Symfony\View\LocationValueView
Definition: LocationValueView.php:10
eZ\Publish\Core\MVC\Symfony\View\View
Main interface for Views of Value objects (content, block...).
Definition: Publish/Core/MVC/Symfony/View/View.php:16
eZ\Publish\Core\MVC\Symfony\Matcher\ContentBased\Id
Definition: Publish/Core/MVC/Symfony/Matcher/ContentBased/Id/Content.php:7
Copyright © 1998 – 2026 7x. All rights reserved. Licensed under the GNU GPLv2+.