eZ\Publish\Core\Search\Legacy\Content\Common\Gateway\CriterionHandler\Field::handle PHP Method

handle() public method

accept() must be called before calling this method.
public handle ( CriteriaConverter $converter, eZ\Publish\Core\Persistence\Database\SelectQuery $query, eZ\Publish\API\Repository\Values\Content\Query\Criterion $criterion, array $languageSettings ) : eZ\Publish\Core\Persistence\Database\Expression
$converter eZ\Publish\Core\Search\Legacy\Content\Common\Gateway\CriteriaConverter
$query eZ\Publish\Core\Persistence\Database\SelectQuery
$criterion eZ\Publish\API\Repository\Values\Content\Query\Criterion
$languageSettings array
return eZ\Publish\Core\Persistence\Database\Expression
    public function handle(CriteriaConverter $converter, SelectQuery $query, Criterion $criterion, array $languageSettings)
    {
        $fieldsInformation = $this->getFieldsInformation($criterion->target);
        $subSelect = $query->subSelect();
        $subSelect->select($this->dbHandler->quoteColumn('contentobject_id'))->from($this->dbHandler->quoteTable('ezcontentobject_attribute'));
        $whereExpressions = array();
        foreach ($fieldsInformation as $fieldTypeIdentifier => $fieldsInfo) {
            if ($fieldsInfo['column'] === false) {
                throw new NotImplementedException("A field of type '{$fieldTypeIdentifier}' is not searchable in the legacy search engine.");
            }
            $filter = $this->fieldValueConverter->convertCriteria($fieldTypeIdentifier, $subSelect, $criterion, $fieldsInfo['column']);
            $whereExpressions[] = $subSelect->expr->lAnd($subSelect->expr->in($this->dbHandler->quoteColumn('contentclassattribute_id'), $fieldsInfo['ids']), $filter);
        }
        $subSelect->where($subSelect->expr->lAnd($subSelect->expr->eq($this->dbHandler->quoteColumn('version', 'ezcontentobject_attribute'), $this->dbHandler->quoteColumn('current_version', 'ezcontentobject')), count($whereExpressions) > 1 ? $subSelect->expr->lOr($whereExpressions) : $whereExpressions[0], $this->getFieldCondition($subSelect, $languageSettings)));
        return $query->expr->in($this->dbHandler->quoteColumn('id', 'ezcontentobject'), $subSelect);
    }