Skip to content

Commit

Permalink
Add missing operator type (#766)
Browse files Browse the repository at this point in the history
  • Loading branch information
VincentLanglet committed Jul 22, 2022
1 parent 52d1e7f commit 8c447e1
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 3 deletions.
5 changes: 2 additions & 3 deletions src/Filter/ChoiceFilter.php
Expand Up @@ -14,7 +14,6 @@
namespace Sonata\DoctrineMongoDBAdminBundle\Filter;

use Sonata\AdminBundle\Filter\Model\FilterData;
use Sonata\AdminBundle\Form\Type\Operator\ContainsOperatorType;
use Sonata\AdminBundle\Form\Type\Operator\EqualOperatorType;
use Sonata\DoctrineMongoDBAdminBundle\Datagrid\ProxyQueryInterface;

Expand Down Expand Up @@ -57,7 +56,7 @@ protected function filter(ProxyQueryInterface $query, string $field, FilterData
return;
}

if ($data->isType(ContainsOperatorType::TYPE_NOT_CONTAINS)) {
if ($data->isType(EqualOperatorType::TYPE_NOT_EQUAL)) {
$queryBuilder->field($field)->notIn($value);
} else {
$queryBuilder->field($field)->in($value);
Expand All @@ -69,7 +68,7 @@ protected function filter(ProxyQueryInterface $query, string $field, FilterData
return;
}

if ($data->isType(ContainsOperatorType::TYPE_NOT_CONTAINS)) {
if ($data->isType(EqualOperatorType::TYPE_NOT_EQUAL)) {
$queryBuilder->field($field)->notEqual($value);
} else {
$queryBuilder->field($field)->equals($value);
Expand Down
1 change: 1 addition & 0 deletions src/Filter/NumberFilter.php
Expand Up @@ -42,6 +42,7 @@ public function getFormOptions(): array
'field_type' => $this->getFieldType(),
'field_options' => $this->getFieldOptions(),
'label' => $this->getLabel(),
'operator_type' => NumberOperatorType::class,
];
}

Expand Down
1 change: 1 addition & 0 deletions src/Filter/StringFilter.php
Expand Up @@ -40,6 +40,7 @@ public function getFormOptions(): array
'field_type' => $this->getFieldType(),
'field_options' => $this->getFieldOptions(),
'label' => $this->getLabel(),
'operator_type' => ContainsOperatorType::class,
];
}

Expand Down

0 comments on commit 8c447e1

Please sign in to comment.