for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
/**
* @copyright Copyright (C) eZ Systems AS. All rights reserved.
* @license For full copyright and license information view LICENSE file distributed with this source code.
*/
declare(strict_types=1);
namespace eZ\Publish\Core\Search\Legacy\Content\Common\Gateway\CriterionHandler;
use eZ\Publish\Core\Search\Legacy\Content\Common\Gateway\CriterionHandler;
use eZ\Publish\Core\Search\Legacy\Content\Common\Gateway\CriteriaConverter;
use eZ\Publish\API\Repository\Values\Content\Query\Criterion;
use eZ\Publish\Core\Persistence\Database\SelectQuery;
class IsUserBased extends CriterionHandler
{
public function accept(Criterion $criterion): bool
return $criterion instanceof Criterion\IsUserBased;
}
public function handle(
CriteriaConverter $converter,
SelectQuery $query,
Criterion $criterion,
array $languageSettings
) {
$isUserBased = (bool) reset($criterion->value);
$subSelect = $query->subSelect();
$subSelect
->select(
$this->dbHandler->quoteColumn('contentobject_id')
)->from(
$this->dbHandler->quoteTable('ezuser')
);
$queryExpression = $query->expr->in(
$this->dbHandler->quoteColumn('id', 'ezcontentobject'),
return $isUserBased
? $queryExpression
: $query->expr->not($queryExpression);