I want to make a hidden value for my Foreign Key Entity in controller.
My previous controller is like this (works fine):
->add('id_grup', 'entity', array('class' => 'Sifo\AdminBundle\Entity\MstGrup'))
I want to assign a hidden value to my form like this:
->add('id_grup', 'hidden', array('data' => $id))
But it gives me an error:
ContextErrorException: Catchable Fatal Error: Argument 1 passed to Sifo\AdminBundle\Entity\DftGrupMapel::setIdGrup() must be an instance of Sifo\AdminBundle\Entity\MstGrup, string given, called in C:\Sifony\vendor\symfony\symfony\src\Symfony\Component\PropertyAccess\PropertyAccessor.php on line 360 and defined in C:\Sifony\src\Sifo\AdminBundle\Entity\DftGrupMapel.php line 179
How can I assign a value to a foreign key entity which is hidden?