Form Type
public function buildForm(FormBuilderInterface $builder, array $options)
{
$builder
......
->add('menores', 'collection', array(
'type' => new CotizacionMenorType(),
'allow_add' => true,
'allow_delete' => true,
'by_reference' => false,
'required' => false
))
......
;
}
Controller
public function editarAction(Cotizacion $cotizacion, Request $request)
{
$pageData['accion'] = 'Editar';
$objForm = $this->createForm(new EditarCotizacionType(), $cotizacion);
$objForm->handleRequest($request);
if ($objForm->isValid()) {
echo '<pre>';
echo \Doctrine\Common\Util\Debug::dump($cotizacion->getMenores());
die('</pre>');
.............
}
.......
}
When I render the form and remove form the DOM 1 element, then I submit the form and the elements still in the coleccion., when I print de $cotizacion->getMenores()
the removed element still there
Thanks
在您的关系注释中,请确保已设置orphanRemoval。
@ORM\OneToMany(targetEntity="Image", cascade={"persist"}, orphanRemoval=true)
此错误是由版本2.3.10 https://github.com/symfony/symfony/issues/10256中的错误引起的,感谢A6 Software提供的帮助。
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.