The Symfony Bundle for validation request query string parameters in the controllers.
composer require ekreative/query-parameter-bundle
The Bundle required sensio/framework-extra-bundle
, Symfony components OptionResolver
and PropertyAccess
.
app/AppKernel.php
...
public function registerBundles()
{
$bundles = array(
...
new Ekreative\QueryParameterBundle\EkreativeQueryParameterBundle(),
...
);
...
return $bundles;
}
...
src/AppBundle/Controller/DefaultController.php
...
/**
* @Route("/")
* @QueryParameter("test", type="boolean", options={"required" = false})
*/
public function indexAction($test)
...
src/AppBundle/Controller/DefaultController.php
...
/**
* @Route("/")
* @QueryModel("testFilter", class="AppBundle\Filter\Filter", options={"required" = false, types={"test" = "boolean"}})
*/
public function indexAction(Filter $testFilter)
...
- integer
- datetime
- double
- boolean