Skip to content

Commit

Permalink
[v5] Moved from Criterion to CriterionInterface (#2576)
Browse files Browse the repository at this point in the history
* [v5] Moved from Criterion to CriterionInterface
* Added PHPdoc
  • Loading branch information
mnocon authored Dec 12, 2024
1 parent 3c096b1 commit e9b50b8
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -4,18 +4,21 @@

namespace App\Query\Criterion\Elasticsearch;

use Ibexa\Contracts\Core\Repository\Values\Content\Query\Criterion;
use Ibexa\Contracts\Core\Repository\Values\Content\Query\CriterionInterface;
use Ibexa\Contracts\Elasticsearch\Query\CriterionVisitor;
use Ibexa\Contracts\Elasticsearch\Query\LanguageFilter;

final class CameraManufacturerVisitor implements CriterionVisitor
{
public function supports(Criterion $criterion, LanguageFilter $languageFilter): bool
public function supports(CriterionInterface $criterion, LanguageFilter $languageFilter): bool
{
return $criterion instanceof CameraManufacturerCriterion;
}

public function visit(CriterionVisitor $dispatcher, Criterion $criterion, LanguageFilter $languageFilter): array
/**
* @param \App\Query\Criterion\Elasticsearch\CameraManufacturerCriterion $criterion
*/
public function visit(CriterionVisitor $dispatcher, CriterionInterface $criterion, LanguageFilter $languageFilter): array
{
return [
'terms' => [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,17 +4,20 @@

namespace App\Query\Criterion\Solr;

use Ibexa\Contracts\Core\Repository\Values\Content\Query\Criterion;
use Ibexa\Contracts\Core\Repository\Values\Content\Query\CriterionInterface;
use Ibexa\Contracts\Solr\Query\CriterionVisitor;

final class CameraManufacturerVisitor extends CriterionVisitor
{
public function canVisit(Criterion $criterion)
public function canVisit(CriterionInterface $criterion)
{
return $criterion instanceof CameraManufacturerCriterion;
}

public function visit(Criterion $criterion, CriterionVisitor $subVisitor = null)
/**
* @param \App\Query\Criterion\Solr\CameraManufacturerCriterion $criterion
*/
public function visit(CriterionInterface $criterion, CriterionVisitor $subVisitor = null)
{
$expressions = array_map(
function ($value): string {
Expand Down

0 comments on commit e9b50b8

Please sign in to comment.