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\Core\Persistence\Database\SelectQuery; |
12
|
|
|
use eZ\Publish\Core\Persistence\Legacy\URL\Query\CriterionHandler; |
13
|
|
|
|
14
|
|
|
abstract class Base implements CriterionHandler |
15
|
|
|
{ |
16
|
|
|
/** |
17
|
|
|
* Inner join `ezurl_object_link` table if not joined yet. |
18
|
|
|
* |
19
|
|
|
* @param \eZ\Publish\Core\Persistence\Database\SelectQuery $query |
20
|
|
|
*/ |
21
|
|
|
protected function joinContentObjectLink(SelectQuery $query): void |
22
|
|
|
{ |
23
|
|
|
if (strpos($query->getQuery(), 'INNER JOIN ezurl_object_link ') === false) { |
24
|
|
|
$query->innerJoin( |
25
|
|
|
'ezurl_object_link', |
26
|
|
|
$query->expr->eq('ezurl.id', 'ezurl_object_link.url_id') |
27
|
|
|
); |
28
|
|
|
} |
29
|
|
|
} |
30
|
|
|
|
31
|
|
|
/** |
32
|
|
|
* Inner join `ezcontentobject` table if not joined yet. |
33
|
|
|
* |
34
|
|
|
* @param \eZ\Publish\Core\Persistence\Database\SelectQuery $query |
35
|
|
|
*/ |
36
|
|
|
protected function joinContentObject(SelectQuery $query): void |
37
|
|
|
{ |
38
|
|
|
if (strpos($query->getQuery(), 'INNER JOIN ezcontentobject ') === false) { |
39
|
|
|
$query->innerJoin( |
40
|
|
|
'ezcontentobject', |
41
|
|
|
$query->expr->eq('ezcontentobject.id', 'ezcontentobject_attribute.contentobject_id') |
42
|
|
|
); |
43
|
|
|
} |
44
|
|
|
} |
45
|
|
|
|
46
|
|
|
/** |
47
|
|
|
* Inner join `ezcontentobject_attribute` table if not joined yet. |
48
|
|
|
* |
49
|
|
|
* @param \eZ\Publish\Core\Persistence\Database\SelectQuery $query |
50
|
|
|
*/ |
51
|
|
|
protected function joinContentObjectAttribute(SelectQuery $query): void |
52
|
|
|
{ |
53
|
|
|
if (strpos($query->getQuery(), 'INNER JOIN ezcontentobject_attribute ') === false) { |
54
|
|
|
$query->innerJoin('ezcontentobject_attribute', $query->expr->lAnd( |
55
|
|
|
$query->expr->eq( |
56
|
|
|
'ezurl_object_link.contentobject_attribute_id', |
57
|
|
|
'ezcontentobject_attribute.id' |
58
|
|
|
), |
59
|
|
|
$query->expr->eq( |
60
|
|
|
'ezurl_object_link.contentobject_attribute_version', |
61
|
|
|
'ezcontentobject_attribute.version' |
62
|
|
|
) |
63
|
|
|
)); |
64
|
|
|
} |
65
|
|
|
} |
66
|
|
|
} |
67
|
|
|
|