protected function createForm(
        CollectionInterface $filterCollection,
        $name = null,
        array $rootFormBuilderOptions = [],
        array $filterFormBuilderOptions = []

    ) {
        // Create the root form builder, which is used as the container for all filter forms.
        $rootFormBuilder = $this->createFormBuilder($name, 'form', null, $rootFormBuilderOptions);

        if ($filterCollection->hasFilters()) {
            foreach ($filterCollection as $filter) {
                if (!($filter instanceof FilterHasFormInterface) || $filter->hasForm() !== true) {
                    // Create a form for only filters, which have a form representation.
                    continue;
                }

                // Create the filter form builder itself.
                $filterFormBuilder = $this->createFormBuilder(
                    $filter->getName(),
                    $this->createFilterFormType(),
                    $filter,
                    array_merge($filterFormBuilderOptions, ['data_class' => get_class($filter)])
                );

                // Append the filter to the filter form.
                $this->appendFormField($filter, $filterFormBuilder);

                // Finally, add the filter form builder to the root form builder.
                $rootFormBuilder->add($filterFormBuilder);
            }
        }

        return $rootFormBuilder->getForm();
    }
protected function createForm(
        CollectionInterface $filterCollection,
        $name = null,
        array $rootFormBuilderOptions = [],
        array $filterFormBuilderOptions = []

    ) {
        // Create the root form builder, which is used as the container for all filter forms.
        $rootFormBuilder = $this->createFormBuilder($name, 'form', null, $rootFormBuilderOptions);

        if ($filterCollection->hasFilters()) {
            foreach ($filterCollection as $filter) {
                if (!($filter instanceof FilterHasFormInterface) || $filter->hasForm() !== true) {
                    // Create a form for only filters, which have a form representation.
                    continue;
                }

                // Create the filter form builder itself.
                $filterFormBuilder = $this->createFormBuilder(
                    $filter->getName(),
                    $this->createFilterFormType(),
                    $filter,
                    array_merge($filterFormBuilderOptions, ['data_class' => get_class($filter)])
                );

                // Append the filter to the filter form.
                $this->appendFormField($filter, $filterFormBuilder);

                // Finally, add the filter form builder to the root form builder.
                $rootFormBuilder->add($filterFormBuilder);
            }
        }

        return $rootFormBuilder->getForm();
    }
protected function createForm ( CollectionInterface $ filterCollection , $ name = null , array $ rootFormBuilderOptions = [ ] , array $ filterFormBuilderOptions = [ ] ) { // Create the root form builder, which is used as the container for all filter forms.
 $ rootFormBuilder = $ this -> createFormBuilder ( $ name , 'form' , null , $ rootFormBuilderOptions ) ; if ( $ filterCollection -> hasFilters ( ) ) { foreach ( $ filterCollection as $ filter ) { if ( ! ( $ filter instanceof FilterHasFormInterface ) || $ filter -> hasForm ( ) !== true ) { // Create a form for only filters, which have a form representation.
 continue ; } // Create the filter form builder itself.
 $ filterFormBuilder = $ this -> createFormBuilder ( $ filter -> getName ( ) , $ this -> createFilterFormType ( ) , $ filter , array_merge ( $ filterFormBuilderOptions , [ 'data_class' => get_class ( $ filter ) ] ) ) ; // Append the filter to the filter form.
 $ this -> appendFormField ( $ filter , $ filterFormBuilder ) ; // Finally, add the filter form builder to the root form builder.
 $ rootFormBuilder -> add ( $ filterFormBuilder ) ; } } return $ rootFormBuilder -> getForm ( ) ; }
Creates the filtration form.

@param CollectionInterface $filterCollection         The collection of the filters
@param null|string         $name                     (Optional) The name of the root form
@param array               $rootFormBuilderOptions   (Optional) The options for the root form
@param array               $filterFormBuilderOptions (Optional) The options for each filter form

@return FormInterface The form with one root element, which contains as many sub-forms, as many filters there
are in the collection (only considering filters, which have a form representations).
Creates the filtration form .