Skip to content

Commit

Permalink
Review fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
TheMilek committed May 22, 2024
1 parent 0a98422 commit ef3462d
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 22 deletions.
3 changes: 2 additions & 1 deletion src/Sylius/Bundle/AdminBundle/Form/Type/AddressType.php
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,8 @@ public function buildForm(FormBuilderInterface $builder, array $options): void
'auto_initialize' => false,
]);
}
});
})
;

$builder->addEventListener(
FormEvents::SUBMIT,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,23 +55,21 @@ public function getParent(): string
return BaseCatalogPromotionScopeType::class;
}

public function getBlockPrefix(): string
{
return 'sylius_admin_catalog_promotion_scope';
}

private function addScopeToForm(FormEvent $event): void
{
$data = $event->getData();

if ($data === null) {
return;
}
$form = $event->getForm();

$dataType = $data instanceof CatalogPromotionScopeInterface ? $data->getType() : $data['type'];

$scopeConfigurationType = $this->scopeConfigurationTypes[$dataType];
$form->add('configuration', $scopeConfigurationType);
}

public function getBlockPrefix(): string
{
return 'sylius_admin_catalog_promotion_scope';
$form = $event->getForm();
$form->add('configuration', $scopeConfigurationType);
}
}
13 changes: 7 additions & 6 deletions src/Sylius/Bundle/AdminBundle/Form/Type/CountryType.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
use Sylius\Component\Resource\Repository\RepositoryInterface;
use Symfony\Component\Form\AbstractType;
use Symfony\Component\Form\Extension\Core\Type\CheckboxType;
use Symfony\Component\Form\Extension\Core\Type\CountryType as SymfonyCountryType;
use Symfony\Component\Form\FormBuilderInterface;
use Symfony\Component\Form\FormEvent;
use Symfony\Component\Form\FormEvents;
Expand Down Expand Up @@ -49,7 +50,7 @@ public function buildForm(FormBuilderInterface $builder, array $options): void
}

$form = $event->getForm();
$form->add('code', \Symfony\Component\Form\Extension\Core\Type\CountryType::class, $options);
$form->add('code', SymfonyCountryType::class, $options);
});

$builder
Expand All @@ -73,6 +74,11 @@ public function getParent(): string
return BaseCountryType::class;
}

public function getBlockPrefix(): string
{
return 'sylius_admin_country';
}

private function getCountryName(string $code): string
{
return Countries::getName($code);
Expand All @@ -92,9 +98,4 @@ private function getAvailableCountries(): array

return $availableCountries;
}

public function getBlockPrefix(): string
{
return 'sylius_admin_country';
}
}
4 changes: 1 addition & 3 deletions src/Sylius/Bundle/AdminBundle/Form/Type/ProductType.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,7 @@

final class ProductType extends AbstractType
{
/**
* @param array<string, mixed> $options
*/
/** @param array<string, mixed> $options */
public function buildForm(FormBuilderInterface $builder, array $options): void
{
$builder
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,7 @@ public function __construct(private readonly array $types)
{
}

/**
* @param array<string, mixed> $options
*/
/** @param array<string, mixed> $options */
public function buildForm(FormBuilderInterface $builder, array $options): void
{
$builder
Expand Down

0 comments on commit ef3462d

Please sign in to comment.