I have a problem binding forms with relational objects.
I work with Doctrine and Phalcon2
In the entity I have a getter that returns and object and not and id or string.
/**
* @return Laboratorio
*/
public function getLaboratorioSangrePositivoTKI()
{
return $this->laboratorioSangrePositivoTKI;
}
And when phalcon try to bind the entity to the form it returns this error:
Catchable fatal error: Object of class DoctrineProxies__CG__\Identify\Entities\Laboratorio could not be converted to string in /var/www/clients/client1/web1/web/app/common/cache/volt/app/backend/views/hospital/formHospitalInterno.phtml on line 64
I know that problem is that phalcon try to set a default value with the object, but it doesn't work because I need to get the id.
I try to solve adding using to select attribute, but it doesn't work:
$this->add(new Select('laboratorioTejido', $laboratoriosTejido, [
'class' => 'form-control filter',
'using' => ['id','nombre'],
'useEmpty' => true,
'emptyText' => 'Selecciona ...',
]));
1. Can I change the binding for one element?
2. If no, also i'm thinking if can I to setup a blacklist to the binding?
3. What's the best way to solve this issue?
Thanks a lot! Fidel