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

API/Repository/Values/Content/Query/Criterion/Ancestor.php
Go to the documentation of this file.
1 <?php
2
7 namespace eZ\Publish\API\Repository\Values\Content\Query\Criterion;
8
9 use eZ\Publish\API\Repository\Values\Content\Query\Criterion;
10 use eZ\Publish\API\Repository\Values\Content\Query\Criterion\Operator\Specifications;
11 use InvalidArgumentException;
12
18 class Ancestor extends Criterion
19 {
28 public function __construct($value)
29 {
30 foreach ((array)$value as $pathString) {
31 if (preg_match('/^(\/\w+)+\/$/', $pathString) !== 1) {
32 throw new InvalidArgumentException(
33 "value '$pathString' must follow the pathString format, eg /1/2/"
34 );
35 }
36 }
37
38 parent::__construct(null, null, $value);
39 }
40
41 public function getSpecifications()
42 {
43 return [
44 new Specifications(
45 Operator::EQ,
46 Specifications::FORMAT_SINGLE,
47 Specifications::TYPE_STRING
48 ),
49 new Specifications(
50 Operator::IN,
51 Specifications::FORMAT_ARRAY,
52 Specifications::TYPE_STRING
53 ),
54 ];
55 }
56
60 public static function createFromQueryBuilder($target, $operator, $value)
61 {
62 @trigger_error('The ' . __METHOD__ . ' method is deprecated since version 7.2 and will be removed in 8.0.', E_USER_DEPRECATED);
63
64 return new self($value);
65 }
66 }
eZ\Publish\API\Repository\Values\Content\Query\Criterion\Ancestor
A criterion that matches content that is ancestor to the given Location path string.
Definition: API/Repository/Values/Content/Query/Criterion/Ancestor.php:19
eZ\Publish\API\Repository\Values\Content\Query\Criterion\Ancestor\getSpecifications
getSpecifications()
Criterion description function.
Definition: API/Repository/Values/Content/Query/Criterion/Ancestor.php:41
eZ\Publish\API\Repository\Values\Content\Query\Criterion\Ancestor\createFromQueryBuilder
static createFromQueryBuilder($target, $operator, $value)
Definition: API/Repository/Values/Content/Query/Criterion/Ancestor.php:60
eZ\Publish\API\Repository\Values\Content\Query\Criterion\Ancestor\__construct
__construct($value)
Creates a new Ancestor criterion.
Definition: API/Repository/Values/Content/Query/Criterion/Ancestor.php:28
eZ\Publish\API\Repository\Values\Content\Query\Criterion\Operator\Specifications
This class is used by Criteria to describe which operators they support.
Definition: Specifications.php:15
eZ\Publish\API\Repository\Values\Content\Query\Criterion\Operator\Specifications\FORMAT_ARRAY
const FORMAT_ARRAY
Definition: Specifications.php:20
eZ\Publish\API\Repository\Values\Content\Query\Criterion\Operator\Specifications\TYPE_STRING
const TYPE_STRING
Definition: Specifications.php:27
eZ\Publish\API\Repository\Values\Content\Query\Criterion\Operator\Specifications\FORMAT_SINGLE
const FORMAT_SINGLE
Criterion input type description constants.
Definition: Specifications.php:19
eZ\Publish\API\Repository\Values\Content\Query\Criterion\Operator\EQ
const EQ
Definition: API/Repository/Values/Content/Query/Criterion/Operator.php:16
eZ\Publish\API\Repository\Values\Content\Query\Criterion\Operator\IN
const IN
Definition: API/Repository/Values/Content/Query/Criterion/Operator.php:21
eZ\Publish\API\Repository\Values\Content\Query\Criterion
Definition: API/Repository/Values/Content/Query/Criterion.php:15
eZ\Publish\API\Repository\Values\Content\Query\Criterion\$target
$target
Definition: API/Repository/Values/Content/Query/Criterion.php:35
eZ\Publish\API\Repository\Values\Content\Query\Criterion\$operator
$operator
Definition: API/Repository/Values/Content/Query/Criterion.php:21
eZ\Publish\API\Repository\Values\Content\Query\Criterion\$value
$value
Definition: API/Repository/Values/Content/Query/Criterion.php:28
eZ\Publish\API\Repository\Values\Content\Query\Criterion
Definition: API/Repository/Values/Content/Query/Criterion/Ancestor.php:7
Copyright © 1998 – 2026 7x. All rights reserved. Licensed under the GNU GPLv2+.