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

Core/Search/Legacy/Content/Common/Gateway/CriterionHandler/UserMetadata.php
Go to the documentation of this file.
1 <?php
2
7 namespace eZ\Publish\Core\Search\Legacy\Content\Common\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 RuntimeException;
14
18 class UserMetadata extends CriterionHandler
19 {
27 public function accept(Criterion $criterion)
28 {
29 return $criterion instanceof Criterion\UserMetadata;
30 }
31
44 public function handle(
45 CriteriaConverter $converter,
46 SelectQuery $query,
47 Criterion $criterion,
48 array $languageSettings
49 ) {
50 switch ($criterion->target) {
51 case Criterion\UserMetadata::MODIFIER:
52 return $query->expr->in(
53 $this->dbHandler->quoteColumn('creator_id', 'ezcontentobject_version'),
54 $criterion->value
55 );
56
57 case Criterion\UserMetadata::GROUP:
58 $subSelect = $query->subSelect();
59 $subSelect
60 ->select(
61 $this->dbHandler->quoteColumn('contentobject_id', 't1')
62 )->from(
63 $query->alias(
64 $this->dbHandler->quoteTable('ezcontentobject_tree'),
65 't1'
66 )
67 )->innerJoin(
68 $query->alias(
69 $this->dbHandler->quoteTable('ezcontentobject_tree'),
70 't2'
71 ),
72 $query->expr->like(
73 't1.path_string',
74 $query->expr->concat(
75 't2.path_string',
76 $query->bindValue('%')
77 )
78 )
79 )->where(
80 $query->expr->in(
81 $this->dbHandler->quoteColumn('contentobject_id', 't2'),
82 $criterion->value
83 )
84 );
85
86 return $query->expr->in(
87 $this->dbHandler->quoteColumn('owner_id', 'ezcontentobject'),
88 $subSelect
89 );
90
91 case Criterion\UserMetadata::OWNER:
92 return $query->expr->in(
93 $this->dbHandler->quoteColumn('owner_id', 'ezcontentobject'),
94 $criterion->value
95 );
96 }
97
98 throw new RuntimeException("Invalid target criterion encountered:'" . $criterion->target . "'");
99 }
100 }
eZ\Publish\API\Repository\Values\Content\Query\Criterion\UserMetadata
A criterion that matches content based on one of the user metadata (owner, group, modifier).
Definition: API/Repository/Values/Content/Query/Criterion/UserMetadata.php:30
eZ\Publish\API\Repository\Values\Content\Query\Criterion
Definition: API/Repository/Values/Content/Query/Criterion.php:15
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\UserMetadata\handle
handle(CriteriaConverter $converter, SelectQuery $query, Criterion $criterion, array $languageSettings)
Generate query expression for a Criterion this handler accepts.
Definition: Core/Search/Legacy/Content/Common/Gateway/CriterionHandler/UserMetadata.php:44
eZ\Publish\Core\Search\Legacy\Content\Common\Gateway\CriterionHandler\UserMetadata\accept
accept(Criterion $criterion)
Check if this criterion handler accepts to handle the given criterion.
Definition: Core/Search/Legacy/Content/Common/Gateway/CriterionHandler/UserMetadata.php:27
eZ\Publish\Core\Search\Legacy\Content\Common\Gateway\CriterionHandler
Definition: Search/Legacy/Content/Common/Gateway/CriterionHandler.php:15
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\Query\subSelect
subSelect()
Create a subselect used with the current query.
eZ\Publish\Core\Persistence\Database\SelectQuery
Definition: SelectQuery.php:16
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
Copyright © 1998 – 2026 7x. All rights reserved. Licensed under the GNU GPLv2+.