# CRUDlex\ControllerInterface

- CRUDlex\Controller

interface `ControllerInterface`

  This represents the Controller offering all CRUD pages.

  It offers functions for 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

  `setLocaleAndCheckEntity`(Request $request)

    Transfers the locale from the translator to CRUDlex and

    Parameters: | $request (Request) – the current request
    Returns: | Response|null null if everything is ok, a 404 response else

  `create`(Request $request, $entity)

    The controller for the “create” action.

    Parameters: | $request (Request) – the current request $entity (string) – the current entity
    Returns: | Response the HTTP response of this action

  `showList`(Request $request, $entity)

    The controller for the “show list” action.

    Parameters: | $request (Request) – the current request $entity (string) – the current entity
    Returns: | Response the HTTP response of this action or 404 on invalid input

  `show`($entity, $id)

    The controller for the “show” action.

    Parameters: | $entity (string) – the current entity $id (string) – the instance id to show
    Returns: | Response the HTTP response of this action or 404 on invalid input

  `edit`(Request $request, $entity, $id)

    The controller for the “edit” action.

    Parameters: | $request (Request) – the current request $entity (string) – the current entity $id (string) – the instance id to edit
    Returns: | Response the HTTP response of this action or 404 on invalid input

  `delete`(Request $request, $entity, $id)

    The controller for the “delete” action.

    Parameters: | $request (Request) – the current request $entity (string) – the current entity $id (string) – the instance id to delete
    Returns: | Response redirects to the entity list page or 404 on invalid input

  `renderFile`($entity, $id, $field)

    The controller for the “render file” action.

    Parameters: | $entity (string) – the current entity $id (string) – the instance id $field (string) – the field of the file to render of the instance
    Returns: | Response the rendered file

  `deleteFile`($entity, $id, $field)

    The controller for the “delete file” action.

    Parameters: | $entity (string) – the current entity $id (string) – the instance id $field (string) – the field of the file to delete of the instance
    Returns: | Response redirects to the instance details page or 404 on invalid input

  `staticFile`(Request $request)

    The controller for serving static files.

    Parameters: | $request (Request) – the current request
    Returns: | Response redirects to the instance details page or 404 on invalid input

  `setLocale`(Request $request, $locale)

    The controller for setting the locale.

    Parameters: | $request (Request) – the current request $locale (string) – the new locale
    Returns: | Response redirects to the instance details page or 404 on invalid input