Skip to content

Commit

Permalink
Revert "IBX-6312: View matcher ParentContentType should not throw exe…
Browse files Browse the repository at this point in the history
…cption if parent is not available"

This reverts commit fd39333.
  • Loading branch information
vidarl committed Feb 7, 2024
1 parent fd39333 commit 19a4434
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 19 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -56,13 +56,9 @@ public function match(View $view)
if (!$view instanceof LocationValueView) {
return false;
}
try {
$parent = $this->loadParentLocation(
$view->getLocation()->parentLocationId
);
} catch (\eZ\Publish\API\Repository\Exceptions\NotFoundException $e) {
return false;
}
$parent = $this->loadParentLocation(
$view->getLocation()->parentLocationId
);

return isset($this->values[$parent->getContentInfo()->contentTypeId]);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,19 +25,15 @@ class ParentContentType extends MultipleValued
*/
public function matchLocation(APILocation $location)
{
try {
$parentContentType = $this->repository->sudo(
static function (Repository $repository) use ($location) {
$parent = $repository->getLocationService()->loadLocation($location->parentLocationId);
$parentContentType = $this->repository->sudo(
static function (Repository $repository) use ($location) {
$parent = $repository->getLocationService()->loadLocation($location->parentLocationId);

return $repository
->getContentTypeService()
->loadContentType($parent->getContentInfo()->contentTypeId);
}
);
} catch (\eZ\Publish\API\Repository\Exceptions\NotFoundException $e) {
return false;
}
return $repository
->getContentTypeService()
->loadContentType($parent->getContentInfo()->contentTypeId);
}
);

return isset($this->values[$parentContentType->identifier]);
}
Expand Down

0 comments on commit 19a4434

Please sign in to comment.