This is form i use:
$form = $this->createForm(new NewsType(), $news)
->add('edit', SubmitType::class, array('label' => 'edit'))
->add('delete', SubmitType::class, array('label' => 'delete'))
->add('comments', CollectionType::class, array('entry_type' => CommentType::class));
CommentType:
public function buildForm(FormBuilderInterface $builder, array $options)
{
$builder
->add('author', TextType::class)
->add('text', TextType::class)
->add('remove', SubmitType::class);
}
public function configureOptions(OptionsResolver $resolver)
{
$resolver->setDefaults(array(
'data_class' => 'AppBundle\Entity\Comment'));
}
Is it possible to access remove button from CommentType so when its clicked to delete comment entry. Everything is mapped properly, i can see comment objects displayed on my page, but when i use $form->get('remove')
i get "Child "remove" does not exist."
Is it even possible to do this way?