<?php
/**
 * Created by PhpStorm.
 * User: Olyanren
 * Date: 28.10.2016
 * Time: 12:22
 */


namespace AppBundle\Form;

use FOS\UserBundle\Util\LegacyFormHelper;
use Symfony\Component\Form\AbstractType;
use Symfony\Component\Form\FormBuilderInterface;

class RegistrationType extends AbstractType
{
    public function buildForm(FormBuilderInterface $builder, array $options)
    {
        $builder
            ->add('email', LegacyFormHelper::getType('Symfony\Component\Form\Extension\Core\Type\EmailType'), array('label' => 'E-Posta Adresi', 'translation_domain' => 'FOSUserBundle'))
            ->add('username', null, array('label' => 'Kullanıcı Adı', 'translation_domain' => 'FOSUserBundle'))
            ->add('plainPassword', LegacyFormHelper::getType('Symfony\Component\Form\Extension\Core\Type\RepeatedType'), array(
                'type' => LegacyFormHelper::getType('Symfony\Component\Form\Extension\Core\Type\PasswordType'),
                'options' => array('translation_domain' => 'FOSUserBundle'),
                'first_options' => array('label' => 'Şifre'),
                'second_options' => array('label' => 'Şifre (Tekrar)'),
                'invalid_message' => 'Şifreniz uyuşmamaktadır',
            ))
            ->add('name',null, array('label' => 'Ad'))
            ->add('surname',null, array('label' => 'Soyad'))
            ->add('telephone',null, array('label' => 'Telefon'))
            ->add('address',null, array('label' => 'Adres'))
            ->add('roles');
    }


    public function getBlockPrefix()
    {
        return 'app_user_registration';
    }

    // For Symfony 2.x
    public function getName()
    {
        return $this->getBlockPrefix();
    }
}