Skip to content

Commit

Permalink
Fixups after CR
Browse files Browse the repository at this point in the history
  • Loading branch information
mateuszbieniek committed Oct 21, 2019
1 parent d8e6ac6 commit 50ba114
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 9 deletions.
Original file line number Diff line number Diff line change
@@ -1,8 +1,11 @@
<?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 EzSystems\EzPlatformSolrSearchEngine\FieldMapper\ContentTranslationFieldMapper;

use eZ\Publish\Core\Persistence\FieldTypeRegistry;
Expand Down Expand Up @@ -80,10 +83,10 @@ public function mapFields(Content $content, $languageCode)
}

foreach ($contentType->fieldDefinitions as $fieldDefinition) {
if ($fieldDefinition->id !== $field->fieldDefinitionId) {
if ($fieldDefinition->isRequired) {
continue;
}
if ($fieldDefinition->isRequired) {
if ($fieldDefinition->id !== $field->fieldDefinitionId) {
continue;
}

Expand Down
16 changes: 9 additions & 7 deletions lib/Query/Common/CriterionVisitor/Field/FieldEmpty.php
Original file line number Diff line number Diff line change
@@ -1,19 +1,18 @@
<?php

/**
* This file is part of the eZ Platform Solr Search Engine package.
*
* @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 EzSystems\EzPlatformSolrSearchEngine\Query\Common\CriterionVisitor\Field;

use eZ\Publish\SPI\Search\FieldType\BooleanField;
use EzSystems\EzPlatformSolrSearchEngine\FieldMapper\ContentTranslationFieldMapper\ContentDocumentEmptyFields;
use EzSystems\EzPlatformSolrSearchEngine\Query\CriterionVisitor;
use EzSystems\EzPlatformSolrSearchEngine\Query\Common\CriterionVisitor\Field;
use eZ\Publish\API\Repository\Values\Content\Query\Criterion;
use eZ\Publish\API\Repository\Values\Content\Query\Criterion\Operator;
use eZ\Publish\Core\Base\Exceptions\InvalidArgumentException;
use eZ\Publish\Core\Search\Common\FieldValueMapper;
use eZ\Publish\Core\Search\Common\FieldNameResolver;
Expand All @@ -34,8 +33,11 @@ class FieldEmpty extends Field
* @param \eZ\Publish\Core\Search\Common\FieldValueMapper $fieldValueMapper
* @param \eZ\Publish\Core\Search\Common\FieldNameGenerator $fieldNameGenerator
*/
public function __construct(FieldNameResolver $fieldNameResolver, FieldValueMapper $fieldValueMapper, FieldNameGenerator $fieldNameGenerator)
{
public function __construct(
FieldNameResolver $fieldNameResolver,
FieldValueMapper $fieldValueMapper,
FieldNameGenerator $fieldNameGenerator
) {
parent::__construct($fieldNameResolver, $fieldValueMapper);

$this->fieldNameGenerator = $fieldNameGenerator;
Expand All @@ -50,13 +52,13 @@ public function __construct(FieldNameResolver $fieldNameResolver, FieldValueMapp
*/
public function canVisit(Criterion $criterion)
{
return $criterion instanceof Criterion\IsFieldEmpty && Operator::EQ;
return $criterion instanceof Criterion\IsFieldEmpty;
}

/**
* Map field value to a proper Solr representation.
*
* @throws \eZ\Publish\Core\Base\Exceptions\InvalidArgumentException If no searchable fields are found for the given criterion target.
* @throws \eZ\Publish\API\Repository\Exceptions\InvalidArgumentException If no searchable fields are found for the given criterion target.
*
* @param \eZ\Publish\API\Repository\Values\Content\Query\Criterion $criterion
* @param \EzSystems\EzPlatformSolrSearchEngine\Query\CriterionVisitor $subVisitor
Expand Down

0 comments on commit 50ba114

Please sign in to comment.