PHP Class Volkszaehler\Router

This class acts as a frontcontroller to route incomming requests
Author: Steffen Vogel ([email protected])
Show file Open project: volkszaehler/volkszaehler.org Class Usage Examples

Public Properties

Property Type Description
$controllerMapping context => controller mapping
$em Doctrine EntityManager
$operationMapping HTTP-method => operation mapping
$view output view
$viewMapping format => view mapping

Public Methods

Method Description
__construct ( ) Constructor
createEntityManager ( $admin = FALSE ) Factory method for Doctrine EntityManager
handle ( Request $request, integer $type = HttpKernelInterface::MASTER_REQUEST, boolean $catch = true ) : Response Handle the request Source: Symfony\Component\HttpKernel\HttpKernel
handleRaw ( Request $request, integer $type = HttpKernelInterface::MASTER_REQUEST ) : Response Determine context, format and uuid of the raw request
handler ( Request $request, $context, $uuid ) Processes the request

Private Methods

Method Description
handleException ( Exception $e, Request $request, integer $type ) : Response Handles an exception by trying to convert it to a Response Source: Symfony\Component\HttpKernel\HttpKernel

Method Details

__construct() public method

Constructor
public __construct ( )

createEntityManager() public static method

Factory method for Doctrine EntityManager
public static createEntityManager ( $admin = FALSE )

handle() public method

Handle the request Source: Symfony\Component\HttpKernel\HttpKernel
public handle ( Request $request, integer $type = HttpKernelInterface::MASTER_REQUEST, boolean $catch = true ) : Response
$request Symfony\Component\HttpFoundation\Request A Request instance
$type integer The type of the request (for Symfony compatibility, not implemented)
$catch boolean Whether to catch exceptions or not
return Symfony\Component\HttpFoundation\Response A Response instance

handleRaw() public method

Determine context, format and uuid of the raw request
public handleRaw ( Request $request, integer $type = HttpKernelInterface::MASTER_REQUEST ) : Response
$request Symfony\Component\HttpFoundation\Request A Request instance
$type integer The type of the request (for Symfony compatibility, not implemented)
return Symfony\Component\HttpFoundation\Response A Response instance

handler() public method

Example: http://sub.domain.local/middleware.php/channel/550e8400-e29b-11d4-a716-446655440000/data.json?operation=edit&title=New Title
public handler ( Request $request, $context, $uuid )
$request Symfony\Component\HttpFoundation\Request

Property Details

$controllerMapping public static property

context => controller mapping
public static $controllerMapping

$em public property

Doctrine EntityManager
public $em

$operationMapping public static property

HTTP-method => operation mapping
public static $operationMapping

$view public property

output view
public $view

$viewMapping public static property

format => view mapping
public static $viewMapping