Completed
Push — ezp_30973 ( 1b82fd...a5777c )
by
unknown
12:50
created

SectionIdentifier::handle()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 15

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 2
nc 2
nop 3
dl 0
loc 15
rs 9.7666
c 0
b 0
f 0
1
<?php
2
3
/**
4
 * @copyright Copyright (C) eZ Systems AS. All rights reserved.
5
 * @license For full copyright and license information view LICENSE file distributed with this source code.
6
 */
7
declare(strict_types=1);
8
9
namespace eZ\Publish\Core\Persistence\Legacy\URL\Query\CriterionHandler;
10
11
use eZ\Publish\API\Repository\Values\URL\Query\Criterion;
12
use eZ\Publish\Core\Persistence\Database\SelectQuery;
13
use eZ\Publish\Core\Persistence\Legacy\URL\Query\CriteriaConverter;
14
15
class SectionIdentifier extends Base
16
{
17
    /**
18
     * {@inheritdoc}
19
     */
20
    public function accept(Criterion $criterion): bool
21
    {
22
        return $criterion instanceof Criterion\SectionIdentifier;
23
    }
24
25
    /**
26
     * {@inheritdoc}
27
     */
28
    public function handle(CriteriaConverter $converter, SelectQuery $query, Criterion $criterion): string
29
    {
30
        $this->joinContentObjectLink($query);
31
        $this->joinContentObjectAttribute($query);
32
        $this->joinContentObject($query);
33
34
        if (strpos($query->getQuery(), 'INNER JOIN ezsection ') === false) {
35
            $query->innerJoin(
36
                'ezsection',
37
                $query->expr->eq('ezcontentobject.section_id', 'ezsection.id')
38
            );
39
        }
40
41
        return $query->expr->in('ezsection.identifier', $criterion->sectionIdentifiers);
0 ignored issues
show
Bug introduced by
The property sectionIdentifiers does not seem to exist in eZ\Publish\API\Repositor...ues\URL\Query\Criterion.

An attempt at access to an undefined property has been detected. This may either be a typographical error or the property has been renamed but there are still references to its old name.

If you really want to allow access to undefined properties, you can define magic methods to allow access. See the php core documentation on Overloading.

Loading history...
42
    }
43
}
44