diff --git a/UPGRADE.md b/UPGRADE.md index faff63af2..cc345ba96 100644 --- a/UPGRADE.md +++ b/UPGRADE.md @@ -1,3 +1,8 @@ +### UPGRADE FROM 1.0.0-RC.9 TO 1.0.0-RC.10 + +1. `Sylius\RefundPlugin\Grid\Filter\ChannelFilter` and `Sylius\RefundPlugin\Form\Type\ChannelFilterType` services +have been removed and channel filter configuration in grid has been replaced by entity filter. + ### UPGRADE FROM 1.0.0-RC.7 TO 1.0.0-RC.8 1. The `fully_refunded` state and the `refund` transition have been removed from `sylius_order` state machine. diff --git a/features/filtering_credit_memos.feature b/features/filtering_credit_memos.feature index 1f653c4dc..ad8f5ee02 100644 --- a/features/filtering_credit_memos.feature +++ b/features/filtering_credit_memos.feature @@ -35,4 +35,3 @@ Feature: Filtering credit memos And I filter credit memos by "Web-US" channel Then there should be 1 credit memo generated And the only credit memo should be generated for order "#00000001" - diff --git a/spec/Grid/Filter/ChannelFilterSpec.php b/spec/Grid/Filter/ChannelFilterSpec.php deleted file mode 100644 index 6cd040e2d..000000000 --- a/spec/Grid/Filter/ChannelFilterSpec.php +++ /dev/null @@ -1,35 +0,0 @@ -restrict(Argument::any())->shouldNotBeCalled(); - - $this->apply($dataSource, 'test', ['channel' => ''], []); - } - - function it_restricts_data_for_specific_channel( - DataSourceInterface $dataSource, - ExpressionBuilderInterface $expressionBuilder, - Comparison $comparison - ): void { - $dataSource->getExpressionBuilder()->willReturn($expressionBuilder); - $expressionBuilder->equals('o.channel.code', 'DEFAULT')->willReturn($comparison); - - $dataSource->restrict($comparison)->shouldBeCalled(); - - $this->apply($dataSource, 'test', ['channel' => 'DEFAULT'], []); - } -} diff --git a/src/Form/Type/ChannelFilterType.php b/src/Form/Type/ChannelFilterType.php deleted file mode 100644 index 10f284754..000000000 --- a/src/Form/Type/ChannelFilterType.php +++ /dev/null @@ -1,43 +0,0 @@ -channelRepository = $channelRepository; - } - - public function buildForm(FormBuilderInterface $builder, array $options): void - { - $builder->add('channel', ChoiceType::class, [ - 'choices' => $this->getChannelsList(), - 'label' => false, - 'placeholder' => 'sylius.ui.all', - ]); - } - - private function getChannelsList(): array - { - $channels = []; - - /** @var ChannelInterface $channel */ - foreach ($this->channelRepository->findBy(['enabled' => true]) as $channel) { - $channels[$channel->getName()] = $channel->getCode(); - } - - return $channels; - } -} diff --git a/src/Grid/Filter/ChannelFilter.php b/src/Grid/Filter/ChannelFilter.php deleted file mode 100644 index 0c41807c5..000000000 --- a/src/Grid/Filter/ChannelFilter.php +++ /dev/null @@ -1,20 +0,0 @@ -restrict($dataSource->getExpressionBuilder()->equals('o.channel.code', $data['channel'])); - } -} diff --git a/src/Resources/config/app/config.yml b/src/Resources/config/app/config.yml index 52f8d6c1c..139214f37 100644 --- a/src/Resources/config/app/config.yml +++ b/src/Resources/config/app/config.yml @@ -48,9 +48,6 @@ winzou_state_machine: to: completed sylius_grid: - templates: - filter: - credit_memo_channel: '@SyliusRefundPlugin/Grid/Filter/channel.html.twig' grids: sylius_refund_credit_memo: driver: @@ -125,8 +122,10 @@ sylius_grid: type: date label: sylius_refund.ui.issued_at channel: - type: credit_memo_channel + type: entity label: sylius.ui.channel + form_options: + class: "%sylius.model.channel.class%" doctrine: dbal: diff --git a/src/Resources/config/services.xml b/src/Resources/config/services.xml index b27801ca2..ecdd68294 100644 --- a/src/Resources/config/services.xml +++ b/src/Resources/config/services.xml @@ -124,15 +124,6 @@ - - - - - - - - - diff --git a/src/Resources/views/Grid/Filter/channel.html.twig b/src/Resources/views/Grid/Filter/channel.html.twig deleted file mode 100644 index 81480fcdb..000000000 --- a/src/Resources/views/Grid/Filter/channel.html.twig +++ /dev/null @@ -1,3 +0,0 @@ -{% form_theme form '@SyliusUi/Form/theme.html.twig' %} - -{{ form_row(form) }} diff --git a/tests/Behat/Page/Admin/CreditMemoIndexPage.php b/tests/Behat/Page/Admin/CreditMemoIndexPage.php index d5987b40d..0866c9d8b 100644 --- a/tests/Behat/Page/Admin/CreditMemoIndexPage.php +++ b/tests/Behat/Page/Admin/CreditMemoIndexPage.php @@ -19,7 +19,7 @@ public function downloadCreditMemo(int $index): void public function filterByChannel(string $channelName): void { - $this->getDocument()->find('css', '#criteria_channel_channel')->selectOption($channelName); + $this->getDocument()->find('css', '#criteria_channel')->selectOption($channelName); } public function hasCreditMemoWithOrderNumber(int $index, string $orderNumber): bool