Last active
August 29, 2015 14:22
-
-
Save amsolucionesweb/1725c4959a1eb3200820 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
namespace AM\AppBundle\Entity; | |
use Doctrine\ORM\Mapping as ORM; | |
use Symfony\Component\Validator\Constraints as Assert; | |
/** | |
* DatosContacto | |
* | |
* @ORM\Table("avisosb_datos_contacto") | |
* @ORM\Entity | |
*/ | |
class DatosContacto | |
{ | |
..... | |
/** | |
* @var boolean | |
* | |
* @ORM\Column(name="mostrar_email", type="boolean") | |
*/ | |
private $mostrarEmail; | |
...... | |
/** | |
* Set mostrarEmail | |
* | |
* @param boolean $mostrarEmail | |
* | |
* @return \TEM\AvisosBundle\Entity\DatosContacto | |
*/ | |
public function setMostrarEmail($mostrarEmail) | |
{ | |
$this->mostrarEmail = $mostrarEmail; | |
return $this; | |
} | |
/** | |
* Get mostrarEmail | |
* | |
* @return boolean | |
*/ | |
public function getMostrarEmail() | |
{ | |
return $this->mostrarEmail; | |
} | |
.... | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
namespace AM\AppBundle\Form\Type; | |
use Symfony\Component\Form\AbstractType; | |
use Symfony\Component\Form\FormBuilderInterface; | |
use Symfony\Component\OptionsResolver\OptionsResolver; | |
class DatosContactoType extends AbstractType | |
{ | |
/** | |
* @param FormBuilderInterface $builder | |
* @param array $options | |
*/ | |
public function buildForm(FormBuilderInterface $builder, array $options) | |
{ | |
$builder | |
... | |
->add('mostrarEmail', 'choice', array( | |
'choices' => array( | |
'Sí' => true, | |
'No' => false, | |
), | |
'choices_as_values' => true, | |
'required' => true, | |
'expanded' => true, | |
'placeholder' => false, | |
'label' => '¿Mostrar email?' | |
)) | |
... | |
; | |
} | |
/** | |
* @param OptionsResolverInterface $resolver | |
*/ | |
public function configureOptions(OptionsResolver $resolver) | |
{ | |
$resolver->setDefaults(array( | |
'data_class' => 'TEM\AvisosBundle\Entity\DatosContacto' | |
)); | |
} | |
/** | |
* @return string | |
*/ | |
public function getName() | |
{ | |
return 'datos_contacto'; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment