Skip to content

Instantly share code, notes, and snippets.

@juanwilde
Created November 19, 2015 00:37
Show Gist options
  • Save juanwilde/41d633282f50ba2093cb to your computer and use it in GitHub Desktop.
Save juanwilde/41d633282f50ba2093cb to your computer and use it in GitHub Desktop.
Formulario de fichas de clientes
<?php
namespace Ourentec\CustomersBundle\Form;
use Symfony\Component\Form\AbstractType;
use Symfony\Component\Form\FormBuilderInterface;
use Symfony\Component\OptionsResolver\OptionsResolverInterface;
class CustomerType extends AbstractType
{
/**
* @param FormBuilderInterface $builder
* @param array $options
*/
public function buildForm(FormBuilderInterface $builder, array $options)
{
$builder
->add('name', 'text', array(
'label' => 'Nombre *',
'required' => true,
'max_length' => 20,
))
->add('lastname', 'text', array(
'label' => 'Apellido',
'required' => false
))
->add('address', 'textarea', array(
'label' => 'Dirección',
'required' => false
))
->add('phone', 'text', array(
'label' => 'Teléfono *',
'required' => true
))
->add('pass', 'text', array(
'label' => 'Contraseña *',
'required' => true
))
->add('tasks', 'text', array(
'label' => 'Tareas',
'required' => false
))
->add('email', 'text', array(
'label' => 'Email',
'required' => false
))
->add('status', 'choice', array(
'label' => 'Estado',
'required' => true,
'choices' => array(
'' => 'Selecciona un estado',
'Pendiente' => 'Pendiente',
'En Curso' => 'En Curso',
'Terminado' => 'Terminado'
)
))
->add('location', 'choice', array(
'label' => 'Ubicación',
'required' => true,
'choices' => array(
'' => 'Selecciona una ubicación',
'Taller' => 'Taller',
'Tienda' => 'Tienda',
'Servicio Técnico Oficial' => 'Servicio Técnico Oficial',
'Entregado' => 'Entregado'
)
))
->add('save', 'submit',array(
'label' => 'Añadir'
));
}
/**
* @return string
*/
public function getName()
{
return 'ourentec_customersbundle_customer';
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment