symfony - Is it possible to implement sonata_type_collection within sonata_type_collection? -
viewing post believe possible, don't know how has configured entities.
sonata admin bundle type collection customisation
i have admin files identical him. these other post found capability not supported sonata.
https://github.com/sonata-project/sonataadminbundle/issues/262
https://github.com/sonata-project/sonataadminbundle/issues/802
please, suggest figure out it!
update: (dour high arch)
.../simbundle/admin/empleadoadmin.php protected function configureformfields(formmapper $formmapper) { $formmapper ->with('tecnico') ->add('empleadotecnico', 'sonata_type_collection'), array('edit' => 'inline','sortable'=>'pos','inline' => 'table')) ->end() ; } .../simbundle/admin/tecnicoadmin.php protected function configureformfields(formmapper $formmapper) { $formmapper ->add('salariohora',null,array('label'=>'salario por hora:')) ->with('experiencia') ->add('experiencialaboral', 'sonata_type_collection', array('label'=>'experiencia laboral:'), array('edit' => 'inline','sortable'=>'pos','inline' => 'table')) ->end() ; } .../simbundle/admin/empexperiencialaboraladmin.php protected function configureformfields(formmapper $formmapper) { $formmapper ->add('nombrejefeinmediato',null,array('label'=>'nombre jefe inmediato:')) ; }
entities
...\simbundle\entity;
class empempleado {
/** * * @orm\onetomany(targetentity="tecnico", mappedby="idempleado", cascade={"all"}, orphanremoval=true) * */ private $empleadotecnico;
}
...\simbundle\entity;
class tecnico {
/** * @var \empempleado * * @orm\onetoone(targetentity="empempleado", inversedby="empleadotecnico") * @orm\joincolumns({ * @orm\joincolumn(name="id_empleado", referencedcolumnname="id") * }) */ private $idempleado; /** * * @orm\onetomany(targetentity="empexperiencialaboral", mappedby="idempleado", cascade={"all"}, orphanremoval=true) * */ private $experiencialaboral;
}
...\simbundle\entity;
class empexperiencialaboral {
/** * @var \tecnico * * @orm\manytoone(targetentity="tecnico", inversedby="experiencialaboral") * @orm\joincolumns({ * @orm\joincolumn(name="id_empleado", referencedcolumnname="id") * }) */ private $idempleado;
}
when i'm trying add experiencialaboral, it's faild: fatal error: call member function getname() on non-object in
schema looks this:
empempleado --> (onetomany) --> tecnico --> (onetomany) --> empexperiencialaboral
(sorry, can't put image, first question , don't have 10 reputations)
no cannot have nested collection... limitation due how admin uniqid works. unique id used avoid clash between element sharing same admin.
for adminid not stack, have adminid , childadminid... in case need have childchildadminid ...
Comments
Post a Comment