-
Notifications
You must be signed in to change notification settings - Fork 203
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
EZP-30951: Added missing support for searching (Not)Empty Field values (
#2821) * Added IsFieldEmpty Criterion * Added IsFieldEmpty Criterion support for LegacySearchEngine * Fixed tests * CS Fixups * Removed IsFieldNull test * Fixups after CR * CS Fixups * Fixups for FieldEmpty CriterionHandler * Postgres fix * Fixups after CR * Added IsEmptyFieldType interface * Fixups * Renamed IsEmptyFieldType to FieldType\IsEmptyValue * Dropped IsEmptyFieldType implementation in favor of FieldType * Refactored Field* Criterion handlers
- Loading branch information
1 parent
27af421
commit 31bd435
Showing
8 changed files
with
435 additions
and
39 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
37 changes: 37 additions & 0 deletions
37
eZ/Publish/API/Repository/Values/Content/Query/Criterion/IsFieldEmpty.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
<?php | ||
|
||
/** | ||
* File containing the eZ\Publish\API\Repository\Values\Content\Query\Criterion\IsFieldEmpty class. | ||
* | ||
* @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\API\Repository\Values\Content\Query\Criterion; | ||
|
||
use eZ\Publish\API\Repository\Values\Content\Query\Criterion; | ||
use eZ\Publish\API\Repository\Values\Content\Query\Criterion\Operator\Specifications; | ||
|
||
/** | ||
* A criterion that matches content based on if Field is empty. | ||
*/ | ||
class IsFieldEmpty extends Criterion | ||
{ | ||
/** | ||
* @param string $fieldDefinitionIdentifier | ||
* @param bool $value | ||
* @throws \eZ\Publish\API\Repository\Exceptions\InvalidArgumentException | ||
*/ | ||
public function __construct(string $fieldDefinitionIdentifier, bool $value = true) | ||
{ | ||
parent::__construct($fieldDefinitionIdentifier, null, $value); | ||
} | ||
|
||
public function getSpecifications() | ||
{ | ||
return [ | ||
new Specifications(Operator::EQ, Specifications::FORMAT_SINGLE, Specifications::TYPE_BOOLEAN), | ||
]; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.