I am trying the scenario below :
In myclassType
public function buildForm(FormBuilder $builder, array $options)
{
$builder
->add('day','hidden')
->add('date', 'hidden' )
->add('hours')
->add('comment','textarea')
;
}
In myclass
class myclass
{
//.. Other stuff
/**
* @ORM\Column(type="date")
*
* @var date $date
*/
protected $date;
}
While rendering I get this error :
An exception has been thrown during the rendering of a template ("Catchable Fatal Error:
Object of class DateTime could not be converted to string in
C:\wamp\www\PMI_sf2\app\cache\dev\twig\fb\40\8957f80f2358a6f4112c3427b387.php line 684") in
form_div_layout.html.twig at line 171.
Any idea how I can make a Date type field hidden !??
Form
$builder
->add('day','hidden')
->add('date',null,array( 'attr'=>array('style'=>'display:none;')) )
...
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With