<?php
/*
* This file is part of the Sylius package.
*
* (c) Paweł Jędrzejewski
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
declare(strict_types=1);
namespace BitBag\OpenMarketplace\Form\Extension;
//use BitBag\OpenMarketplace\EventListener\CustomerRegistrationListener;
use phpDocumentor\Reflection\Types\Boolean;
use Sonata\Form\Type\BooleanType;
use Sylius\Bundle\CoreBundle\Form\Type\Customer\CustomerRegistrationType;
//use Sylius\Bundle\CoreBundle\Form\Type\Customer\CustomerSimpleRegistrationType;
use Symfony\Component\Form\AbstractType;
use Symfony\Component\Form\Extension\Core\Type\CheckboxType;
use Symfony\Component\Form\Extension\Core\Type\IntegerType;
use Symfony\Component\Form\Extension\Core\Type\TelType;
use Symfony\Component\Form\Extension\Core\Type\TextType;
use Symfony\Component\Form\FormTypeInterface;
use Symfony\Component\Form\AbstractTypeExtension;
use Symfony\Component\Form\FormBuilderInterface;
use Doctrine\ORM\EntityManager;
final class CustomerRegistrationTypeExtension extends AbstractTypeExtension implements FormTypeInterface
{
public function buildForm(FormBuilderInterface $builder, array $options = []): void
{
parent::buildForm($builder, $options);
$builder
->add('isVendor' , CheckboxType::class, ['mapped' => false])
->add('codePostal', TelType::class, [
'label' => 'Code Postal',
'required' => true,
'attr' => [
'maxlength' => '5'
],
])
->add('phoneNumber', TelType::class, [
'label' => 'sylius.form.customer.phone_number',
'required' => false,
'attr' => [
'maxlength' => '10'
],
])
->add('addressNumber', TelType::class, [
'label' => 'Numéro de l\'adresse',
'required' => true
])
->add('addressName', TextType::class, [
'label' => 'Nom de l\'adresse',
'required' => true
])
->add('city', TextType::class, [
'label' => 'Ville',
'required' => true
])
->add('region', TextType::class, [
'label' => 'Region',
'required' => true
])
->add('termsMangoPay', CheckboxType::class, [
'label' => 'Accepter les termes & les conditions de MangoPay',
'required' => true
])
->add('subscribedToNewsletter', CheckboxType::class, ['mapped' => false])
;
}
public static function getExtendedTypes(): iterable
{
return [CustomerRegistrationType::class];
}
public function getParent(): string
{
return CustomerRegistrationType::class;
}
public function getBlockPrefix(): string
{
return 'sylius_customer_registration';
}
}