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

Search/Legacy/Content/Gateway/CriterionHandler/PermissionSubtree.php
Go to the documentation of this file.
1 <?php
2
7 namespace eZ\Publish\Core\Search\Legacy\Content\Gateway\CriterionHandler;
8
9 use eZ\Publish\Core\Search\Legacy\Content\Common\Gateway\CriterionHandler;
10 use eZ\Publish\Core\Search\Legacy\Content\Common\Gateway\CriteriaConverter;
11 use eZ\Publish\API\Repository\Values\Content\Query\Criterion;
12 use eZ\Publish\Core\Persistence\Database\SelectQuery;
13 use eZ\Publish\Core\Repository\Values\Content\Query\Criterion\PermissionSubtree as PermissionSubtreeCriterion;
14
18 class PermissionSubtree extends CriterionHandler
19 {
27 public function accept(Criterion $criterion)
28 {
29 return $criterion instanceof PermissionSubtreeCriterion;
30 }
31
44 public function handle(
45 CriteriaConverter $converter,
46 SelectQuery $query,
47 Criterion $criterion,
48 array $languageSettings
49 ) {
50 $table = 'permission_subtree';
51
52 $statements = [];
53 foreach ($criterion->value as $pattern) {
54 $statements[] = $query->expr->like(
55 $this->dbHandler->quoteColumn('path_string', $table),
56 $query->bindValue($pattern . '%')
57 );
58 }
59
60 // Check if ezcontentobject_tree was already joined, if it was there is no need to join
61 // with it again - first join will be reused by all other PermissionSubtree criteria
63 if (!$query->permissionSubtreeJoinAdded) {
64 $query
65 ->leftJoin(
66 $query->alias(
67 $this->dbHandler->quoteTable('ezcontentobject_tree'),
68 $this->dbHandler->quoteIdentifier($table)
69 ),
70 $query->expr->eq(
71 $this->dbHandler->quoteColumn('contentobject_id', $table),
72 $this->dbHandler->quoteColumn('id', 'ezcontentobject')
73 )
74 );
75
76 // Set joined state to true
77 $query->permissionSubtreeJoinAdded = true;
78 }
79
80 return $query->expr->lOr(
81 $statements
82 );
83 }
84 }
eZ\Publish\API\Repository\Values\Content\Query\Criterion
Definition: API/Repository/Values/Content/Query/Criterion.php:15
eZ\Publish\Core\Repository\Values\Content\Query\Criterion\PermissionSubtree
Criterion that matches content that belongs to a given (list of) Subtree(s).
Definition: Repository/Values/Content/Query/Criterion/PermissionSubtree.php:24
eZ\Publish\Core\Search\Legacy\Content\Common\Gateway\CriteriaConverter
Content locator gateway implementation using the DoctrineDatabase.
Definition: Search/Legacy/Content/Common/Gateway/CriteriaConverter.php:17
eZ\Publish\Core\Search\Legacy\Content\Common\Gateway\CriterionHandler
Definition: Search/Legacy/Content/Common/Gateway/CriterionHandler.php:15
eZ\Publish\Core\Search\Legacy\Content\Common\Gateway\CriterionHandler\handle
handle(CriteriaConverter $converter, SelectQuery $query, Criterion $criterion, array $languageSettings)
Generate query expression for a Criterion this handler accepts.
eZ\Publish\Core\Search\Legacy\Content\Gateway\CriterionHandler\PermissionSubtree
PermissionSubtree criterion handler.
Definition: Search/Legacy/Content/Gateway/CriterionHandler/PermissionSubtree.php:19
eZ\Publish\Core\Search\Legacy\Content\Gateway\CriterionHandler\PermissionSubtree\accept
accept(Criterion $criterion)
Check if this criterion handler accepts to handle the given criterion.
Definition: Search/Legacy/Content/Gateway/CriterionHandler/PermissionSubtree.php:27
eZ\Publish\Core\Persistence\Database\Query\bindValue
bindValue($value, $placeHolder=null, $type=PDO::PARAM_STR)
Binds the value $value to the specified variable name $placeHolder.
eZ\Publish\Core\Persistence\Database\SelectQuery
Definition: SelectQuery.php:16
eZ\Publish\Core\Persistence\Database\SelectQuery\leftJoin
leftJoin()
Returns the SQL for a left join or prepares $fromString for a left join.
eZ\Publish\Core\Persistence\Database\SelectQuery\alias
alias($name, $alias)
Returns SQL to create an alias.
eZ\Publish\API\Repository\Values\Content\Query\Criterion
Definition: API/Repository/Values/Content/Query/Criterion/Ancestor.php:7
eZ\Publish\Core\Search\Legacy\Content\Common\Gateway\CriterionHandler
Definition: Core/Search/Legacy/Content/Common/Gateway/CriterionHandler/ContentId.php:7
eZ\Publish\Core\Search\Legacy\Content\Gateway\CriterionHandler
Definition: Core/Search/Legacy/Content/Gateway/CriterionHandler/Ancestor.php:7
Copyright © 1998 – 2026 7x. All rights reserved. Licensed under the GNU GPLv2+.