Skip to content

Commit

Permalink
feat(channels): allow removal of channels field by an other FormExten…
Browse files Browse the repository at this point in the history
…sion without throwing exception
  • Loading branch information
Etienne Gutbub committed Apr 17, 2024
1 parent 9bc95ca commit 778df3f
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions src/Form/Extension/FilteredChannelChoiceTypeExtension.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@

namespace MonsieurBiz\SyliusPlusAdapterPlugin\Form\Extension;

use DomainException;
use Sylius\Bundle\ChannelBundle\Form\Type\ChannelChoiceType;
use Sylius\Component\Channel\Model\ChannelsAwareInterface;
use Sylius\Component\Core\Model\ChannelInterface;
Expand Down Expand Up @@ -62,7 +61,7 @@ public static function getExtendedTypes(): iterable
public function buildForm(FormBuilderInterface $builder, array $options): void
{
if (false === $builder->has(self::CHANNELS) && false === $builder->has(self::CHANNEL)) {
throw new DomainException(sprintf('%s should always have channels field defined', self::$extendedTypes[0]));
return;
}

$code = false !== $builder->has(self::CHANNELS) ? self::CHANNELS : self::CHANNEL;
Expand Down

0 comments on commit 778df3f

Please sign in to comment.