I have a problem using inline collection forms because I want to filter the data displayed in the given collection. i.e.
<?php
Class Parent
{
... some attributes ...
private $children;
... some setters & getters ...
}
Class Child
{
private $attribute1;
private $attribute2;
private $parent;
... some setters & getters ...
}
Then I create the form using:
class ParentChildType extends AbstractType
{
public function buildForm(FormBuilder $builder, array $options)
{
$builder
->add('children', 'collection', array(
'type' => ChildrenType(),
'allow_add' => true,
));
}
}
...
On controller:
$parent = $this->getDoctrine()->getEntityManager()->getRepository('AcmeBundle:Parent')->find( $id );
$forms = $this->createForm( new ParentChildType(), $parent)->createView();
and then..
return array('forms' => $forms->crateView());
My problem is when I want to filter a collection using $attribute1and / or a $attribute2model class Child.
Is there a way to filter by criteria for these collection forms?
source
share