Skip to content

Commit

Permalink
add helper trait to build filter form
Browse files Browse the repository at this point in the history
  • Loading branch information
jcrombez committed Nov 20, 2023
1 parent 9eeba27 commit 0e14ef2
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions src/Controller/DatagridControllerHelper.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
<?php

namespace Kibatic\DatagridBundle\Controller;

use Symfony\Component\Form\FormBuilderInterface;

trait DatagridControllerHelper
{
public function createFilterFormBuilder(string $name = '', string $method = 'GET', bool $csrfProtection = false): FormBuilderInterface
{
return $this->container->get('form.factory')->createNamedBuilder($name, options: [
'method' => $method,
'csrf_protection' => $csrfProtection,
]);
}
}

0 comments on commit 0e14ef2

Please sign in to comment.