in this table i want to display in the "reponse" field "yes" or "no" instead of "1" and " " this is the picture show my table : this picture shows my table :
i'm using symfony2.8,in my entity "typeQuestion" i have this :
/**
* @var boolean
* @ORM\Column(name="reponse", type="boolean")
*/
private $reponse;
/**
* Set reponse
*
* @param boolean $reponse
* @return TypeQuestion
*/
public function setReponse($reponse)
{
$this->reponse = $reponse;
return $this;
}
/**
* Get reponse
*
* @return boolean
*/
public function getReponse()
{
return $this->reponse;
}
public function __toString() {
return $this->libelle;
}
}
in the form i have:
->add('reponse', 'choice', array(
'label' => 'Reponse',
'choices' => array("true" => 'Oui', false => 'Non'),
'expanded' => true,
'multiple' => false,
'required' => true
));
}
and i have this in my view:
<td class="center">{{TypeQuestion.libelle}}</td>
<td class="center">{{TypeQuestion.description}}</td>
<td class="center">{{TypeQuestion.reponse}}</td>
in phpmyadmin this is what i get : in phpmyadmin this is what i get :2
You can add if statement {% if TypeQuestion.reponse %}yes{% else %}no{% endif%}