/
RemoteId.php
54 lines (48 loc) · 1.71 KB
/
RemoteId.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
<?php
/**
* @copyright Copyright (C) Ibexa AS. All rights reserved.
* @license For full copyright and license information view LICENSE file distributed with this source code.
*/
declare(strict_types=1);
namespace Ibexa\Contracts\Core\Repository\Values\Content\Query\Criterion;
use Ibexa\Contracts\Core\Repository\Values\Content\Query\Criterion;
use Ibexa\Contracts\Core\Repository\Values\Content\Query\Criterion\Operator\Specifications;
use Ibexa\Contracts\Core\Repository\Values\Filter\FilteringCriterion;
/**
* A criterion that matches content based on its RemoteId.
*
* Supported operators:
* - IN: will match from a list of RemoteId
* - EQ: will match against one RemoteId
*/
class RemoteId extends Criterion implements FilteringCriterion
{
/**
* Creates a new remoteId criterion.
*
* @param string|string[] $value One or more remoteId that must be matched
*
* @throws \InvalidArgumentException if a non numeric id is given
* @throws \InvalidArgumentException if the value type doesn't match the operator
*/
public function __construct($value)
{
parent::__construct(null, null, $value);
}
public function getSpecifications(): array
{
return [
new Specifications(
Operator::IN,
Specifications::FORMAT_ARRAY,
Specifications::TYPE_INTEGER | Specifications::TYPE_STRING
),
new Specifications(
Operator::EQ,
Specifications::FORMAT_SINGLE,
Specifications::TYPE_INTEGER | Specifications::TYPE_STRING
),
];
}
}
class_alias(RemoteId::class, 'eZ\Publish\API\Repository\Values\Content\Query\Criterion\RemoteId');