Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add NOT_EQUAL operator for StringOperatorType #6585

Merged
merged 1 commit into from
Nov 12, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions UPGRADE-3.x.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,10 @@ UPGRADE 3.x
UPGRADE FROM 3.x to 3.x
=======================

### Sonata\AdminBundle\Form\Type\Operator\StringOperatorType

Added "Not equal" in the default list for "choices" option in order to allow filtering by strings that are not equal to the model data.

### Deprecated `Sonata\AdminBundle\Model\ModelManagerInterface::modelTransform()`

This method has been deprecated without replacement.
Expand Down
2 changes: 2 additions & 0 deletions src/Form/Type/Operator/StringOperatorType.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ final class StringOperatorType extends AbstractType
public const TYPE_EQUAL = 3;
public const TYPE_STARTS_WITH = 4;
public const TYPE_ENDS_WITH = 5;
public const TYPE_NOT_EQUAL = 6;

/**
* @return void
Expand All @@ -39,6 +40,7 @@ public function configureOptions(OptionsResolver $resolver)
'label_type_equals' => self::TYPE_EQUAL,
'label_type_starts_with' => self::TYPE_STARTS_WITH,
'label_type_ends_with' => self::TYPE_ENDS_WITH,
'label_type_not_equals' => self::TYPE_NOT_EQUAL,
],
]);
}
Expand Down
1 change: 1 addition & 0 deletions tests/Form/Type/Operator/StringOperatorTypeTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ public function testConfigureOptions(): void
'label_type_equals' => StringOperatorType::TYPE_EQUAL,
'label_type_starts_with' => StringOperatorType::TYPE_STARTS_WITH,
'label_type_ends_with' => StringOperatorType::TYPE_ENDS_WITH,
'label_type_not_equals' => StringOperatorType::TYPE_NOT_EQUAL,
];
$formType->configureOptions($optionsResolver);
$options = $optionsResolver->resolve([]);
Expand Down