Completed
Push — create_from_qb ( 323041 )
by
unknown
12:48
created

FieldRelation::createFromQueryBuilder()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 6

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
nc 1
nop 3
dl 0
loc 6
rs 10
c 0
b 0
f 0
1
<?php
2
3
/**
4
 * File containing the eZ\Publish\API\Repository\Values\Content\Query\Criterion\FieldRelation class.
5
 *
6
 * @copyright Copyright (C) eZ Systems AS. All rights reserved.
7
 * @license For full copyright and license information view LICENSE file distributed with this source code.
8
 */
9
namespace eZ\Publish\API\Repository\Values\Content\Query\Criterion;
10
11
use eZ\Publish\API\Repository\Values\Content\Query\Criterion;
12
use eZ\Publish\API\Repository\Values\Content\Query\Criterion\Operator\Specifications;
13
14
/**
15
 * A criterion that matches Content based on the relations in relation field.
16
 * This includes Relation and RelationList field types in standard installation, but also any
17
 * other field type storing {@link \eZ\Publish\API\Repository\Values\Content\Relation::FIELD}
18
 * type relation.
19
 *
20
 * Supported operators:
21
 * - IN: will match if Content relates to one or more of the given ids through given relation field
22
 * - CONTAINS: will match if Content relates to all of the given ids through given relation field
23
 */
24
class FieldRelation extends Criterion
25
{
26
    public function getSpecifications()
27
    {
28
        $types = Specifications::TYPE_INTEGER | Specifications::TYPE_STRING;
29
30
        return [
31
            new Specifications(Operator::CONTAINS, Specifications::FORMAT_SINGLE | Specifications::FORMAT_ARRAY, $types),
32
            new Specifications(Operator::IN, Specifications::FORMAT_ARRAY, $types),
33
        ];
34
    }
35
}
36