vendor/sylius/sylius/src/Sylius/Bundle/AddressingBundle/Form/Type/CountryCodeChoiceType.php line 28

Open in your IDE?
  1. <?php
  2. /*
  3.  * This file is part of the Sylius package.
  4.  *
  5.  * (c) Paweł Jędrzejewski
  6.  *
  7.  * For the full copyright and license information, please view the LICENSE
  8.  * file that was distributed with this source code.
  9.  */
  10. declare(strict_types=1);
  11. namespace Sylius\Bundle\AddressingBundle\Form\Type;
  12. use Sylius\Bundle\ResourceBundle\Form\DataTransformer\ResourceToIdentifierTransformer;
  13. use Sylius\Component\Resource\Repository\RepositoryInterface;
  14. use Symfony\Component\Form\AbstractType;
  15. use Symfony\Component\Form\FormBuilderInterface;
  16. use Symfony\Component\Form\ReversedTransformer;
  17. final class CountryCodeChoiceType extends AbstractType
  18. {
  19.     public function __construct(private RepositoryInterface $countryRepository)
  20.     {
  21.     }
  22.     public function buildForm(FormBuilderInterface $builder, array $options): void
  23.     {
  24.         $builder->addModelTransformer(new ReversedTransformer(new ResourceToIdentifierTransformer($this->countryRepository'code')));
  25.     }
  26.     public function getParent(): string
  27.     {
  28.         return CountryChoiceType::class;
  29.     }
  30.     public function getBlockPrefix(): string
  31.     {
  32.         return 'sylius_country_code_choice';
  33.     }
  34. }