diff --git a/src/Form/Extension/OrderTypeExtension.php b/src/Form/Extension/OrderTypeExtension.php index ecd22af..a38c9a5 100644 --- a/src/Form/Extension/OrderTypeExtension.php +++ b/src/Form/Extension/OrderTypeExtension.php @@ -24,7 +24,7 @@ public function buildForm(FormBuilderInterface $builder, array $options): void $form ->add('items', OrderItemCollectionType::class, [ - 'entry_options' => ['currency_code' => $order->getCurrencyCode()] + 'entry_options' => ['currency_code' => $order->getCurrencyCode()], ]) ; diff --git a/src/Form/Type/OrderItemType.php b/src/Form/Type/OrderItemType.php index 11b0d72..6b09406 100644 --- a/src/Form/Type/OrderItemType.php +++ b/src/Form/Type/OrderItemType.php @@ -5,7 +5,6 @@ namespace Setono\SyliusOrderEditPlugin\Form\Type; use Sylius\Bundle\ResourceBundle\Form\Type\AbstractResourceType; -use Sylius\Component\Core\Model\OrderInterface; use Sylius\Component\Core\Model\OrderItemInterface; use Sylius\Component\Core\Model\ProductVariant; use Sylius\Component\Order\Modifier\OrderItemQuantityModifierInterface; @@ -14,8 +13,6 @@ use Symfony\Component\Form\FormBuilderInterface; use Symfony\Component\Form\FormEvent; use Symfony\Component\Form\FormEvents; -use Symfony\Component\Form\FormInterface; -use Symfony\Component\Form\FormView; use Symfony\Component\OptionsResolver\OptionsResolver; final class OrderItemType extends AbstractResourceType @@ -47,6 +44,7 @@ public function buildForm(FormBuilderInterface $builder, array $options): void ]) ; + /** @var string $currencyCode */ $currencyCode = $options['currency_code']; $builder->addEventListener(FormEvents::PRE_SET_DATA, function (FormEvent $event) use ($currencyCode): void { @@ -75,5 +73,6 @@ public function configureOptions(OptionsResolver $resolver): void parent::configureOptions($resolver); $resolver->setRequired('currency_code'); + $resolver->setAllowedTypes('currency_code', 'string'); } }