# Class CRUDControllerProvider

This is the ControllerProvider offering all CRUD pages.

It offers this routes:

"/resource/static" serving static resources

"/{entity}/create" creation page of the entity

"/{entity}" list page of the entity

"/{entity}/{id}" details page of a single entity instance

"/{entity}/{id}/edit" edit page of a single entity instance

"/{entity}/{id}/delete" POST only deletion route for an entity instance

"/{entity}/{id}/{field}/file" renders a file field of an entity instance

"/{entity}/{id}/{field}/delete" POST only deletion of a file field of an entity instance

  CRUDlex\CRUDControllerProvider implements Silex\ControllerProviderInterface

Namespace: CRUDlex
Located at CRUDControllerProvider.php

Methods summary
`protected Symfony\Component\HttpFoundation\Response` | # `getNotFoundPage( Silex\Application $app, string $error )` Generates the not found page. Generates the not found page. #### Parameters $app the Silex application $error the cause of the not found error #### Returns Symfony\Component\HttpFoundation\Response the rendered not found page with the status code 404
`protected Symfony\Component\HttpFoundation\Response` | # `modifyFilesAndSetFlashBag( Silex\Application $app, `CRUDlex\CRUDData` $crudData, `CRUDlex\CRUDEntity` $instance, string $entity, string $mode )` Postprocesses the entity after modification by handling the uploaded files and setting the flash. Postprocesses the entity after modification by handling the uploaded files and setting the flash. #### Parameters $app the current application $crudData the data instance of the entity $instance the entity $entity the name of the entity $mode whether to 'edit' or to 'create' the entity #### Returns Symfony\Component\HttpFoundation\Response the HTTP response of this modification
`protected` | # `setValidationFailedFlashes( Silex\Application $app, boolean $optimisticLocking, string $mode )` Sets the flashes of a failed entity modification. Sets the flashes of a failed entity modification. #### Parameters $app the current application $optimisticLocking whether the optimistic locking failed $mode the modification mode, either 'create' or 'edit'
`protected Symfony\Component\HttpFoundation\Response` | # `modifyEntity( Silex\Application $app, `CRUDlex\CRUDData` $crudData, `CRUDlex\CRUDEntity` $instance, string $entity, boolean $edit )` Validates and saves the new or updated entity and returns the appropriate HTTP response. Validates and saves the new or updated entity and returns the appropriate HTTP response. #### Parameters $app the current application $crudData the data instance of the entity $instance the entity $entity the name of the entity $edit whether to edit (true) or to create (false) the entity #### Returns Symfony\Component\HttpFoundation\Response the HTTP response of this modification
`protected array` | # `getAfterDeleteRedirectParameters( Silex\Application $app, string $entity, string & $redirectPage )` Gets the parameters for the redirection after deleting an entity. Gets the parameters for the redirection after deleting an entity. #### Parameters $app the current application $entity the entity name $redirectPage $redirectPage where the page to redirect to will be stored #### Returns array the parameters of the redirection, entity and id
`protected` | # `buildUpListFilter( Silex\Application $app, `CRUDlex\CRUDEntityDefinition` $definition, array & $filter, boolean & $filterActive, array & $filterToUse, array & $filterOperators )` Builds up the parameters of the list page filters. Builds up the parameters of the list page filters. #### Parameters $app the current application $definition the current entity definition $filter $filter will hold a map of fields to request parameters for the filters $filterActive $filterActive will be true if at least one filter is active $filterToUse $filterToUse will hold a map of fields to integers (0 or 1) which boolean filters are active $filterOperators $filterOperators will hold a map of fields to operators for CRUDData::listEntries()
`public SilexController\Collection` | # `connect( Silex\Application $app )` Implements ControllerProviderInterface::connect() connecting this controller. Implements ControllerProviderInterface::connect() connecting this controller. #### Parameters $app the Application instance of the Silex application #### Returns SilexController\Collection this method is expected to return the used ControllerCollection instance
`public Symfony\Component\HttpFoundation\Response` | # `create( Silex\Application $app, string $entity )` The controller for the "create" action. The controller for the "create" action. #### Parameters $app the Silex application $entity the current entity #### Returns Symfony\Component\HttpFoundation\Response the HTTP response of this action
`public Symfony\Component\HttpFoundation\Response` | # `showList( Silex\Application $app, string $entity )` The controller for the "show list" action. The controller for the "show list" action. #### Parameters $app the Silex application $entity the current entity #### Returns Symfony\Component\HttpFoundation\Response the HTTP response of this action or 404 on invalid input
`public Symfony\Component\HttpFoundation\Response` | # `show( Silex\Application $app, string $entity, string $id )` The controller for the "show" action. The controller for the "show" action. #### Parameters $app the Silex application $entity the current entity $id the instance id to show #### Returns Symfony\Component\HttpFoundation\Response the HTTP response of this action or 404 on invalid input
`public Symfony\Component\HttpFoundation\Response` | # `edit( Silex\Application $app, string $entity, string $id )` The controller for the "edit" action. The controller for the "edit" action. #### Parameters $app the Silex application $entity the current entity $id the instance id to edit #### Returns Symfony\Component\HttpFoundation\Response the HTTP response of this action or 404 on invalid input
`public Symfony\Component\HttpFoundation\Response` | # `delete( Silex\Application $app, string $entity, string $id )` The controller for the "delete" action. The controller for the "delete" action. #### Parameters $app the Silex application $entity the current entity $id the instance id to delete #### Returns Symfony\Component\HttpFoundation\Response redirects to the entity list page or 404 on invalid input
`public Symfony\Component\HttpFoundation\Response` | # `renderFile( Silex\Application $app, string $entity, string $id, string $field )` The controller for the "render file" action. The controller for the "render file" action. #### Parameters $app the Silex application $entity the current entity $id the instance id $field the field of the file to render of the instance #### Returns Symfony\Component\HttpFoundation\Response the rendered file
`public Symfony\Component\HttpFoundation\Response` | # `deleteFile( Silex\Application $app, string $entity, string $id, string $field )` The controller for the "delete file" action. The controller for the "delete file" action. #### Parameters $app the Silex application $entity the current entity $id the instance id $field the field of the file to delete of the instance #### Returns Symfony\Component\HttpFoundation\Response redirects to the instance details page or 404 on invalid input
`public Symfony\Component\HttpFoundation\Response` | # `staticFile( Silex\Application $app )` The controller for serving static files. The controller for serving static files. #### Parameters $app the Silex application #### Returns Symfony\Component\HttpFoundation\Response redirects to the instance details page or 404 on invalid input
`public Symfony\Component\HttpFoundation\Response` | # `setLocale( Silex\Application $app, string $locale )` The controller for setting the locale. The controller for setting the locale. #### Parameters $app the Silex application $locale the new locale #### Returns Symfony\Component\HttpFoundation\Response redirects to the instance details page or 404 on invalid input