Property | Type | Description | |
---|---|---|---|
$allowed_option_request | integer | Whether this route is open to allow OPTION requests to detail available $verbs -1 = not set 0 = not allowed 1 = allowed | |
$class_metadata | Drest\Mapping\ClassMetaData | This route objects parent | |
$collection | boolean | Whether get requests to this route should be exposed / handled as collections | |
$disable_expose | boolean | Prevent expose settings lookup | |
$expose | array | An array of fields to be exposed to the end client | |
$handle_call | string | A handle function call for this route (if one is configured) | |
$name | string | The route name (must be unique) | |
$param_names | array | Key-value array of URL parameter names | |
$param_names_path | array | Key-value array of URL parameters with + at the end | |
$route_conditions | array | Eg array('year' => '(19|20)\d\d') | |
$route_params | array | Key-value array of URL parameters populated after a match has been successful - or directly by using available setter | |
$route_pattern | string | A string route pattern to be matched on. eg /user/:id | |
$unmapped_route_params | array | The value id => 1 will go into $route_params All the rest will go in here. | |
$verbs | array | They match the constant values defined in DrestCommon\Request\Request eg array('GET', 'POST') |
Method | Description | |
---|---|---|
getClassMetaData ( ) : Drest\Mapping\ClassMetaData | Get this classes metadata object | |
getExpose ( ) : array | Get the field exposure on this route | |
getHandleCall ( ) : string | Get the handle call function | |
getName ( ) : string | Get the name of this route | |
getNamedRoute ( ) : string | The unique named route to reference this route by Note that is should use the entities fully qualified class names | |
getOriginLocation ( object $object, string $url, |
Generate the location string from the provided object | |
getRouteConditions ( ) : array | null | Get the route conditions | |
getRouteParams ( ) : array | Get any params that were set after a successful match | |
getRoutePattern ( ) : string | Get this routes route pattern | |
getVerbs ( ) : array | Get an array of verbs that are allowed on this route | |
hasHandleCall ( ) | Does this route have an annotated handle call | |
isAllowedOptionRequest ( ) : integer | Is this route allowed to expose its verbs to OPTIONS requests | |
isCollection ( ) | Should this route be handled as a collection | |
isExposeDisabled ( ) : boolean | Is the expose lookup disabled | |
matches ( DrestCommon\Request\Request $request, boolean $matchVerb = true, string $basePath = null ) : boolean | Does this request match the route pattern | |
needsHandleCall ( ) : boolean | Does this route need a handle call? Required for POST/PUT/PATCH verbs | |
serialize ( ) : string | Serialise this object | |
setAllowedOptionRequest ( integer | boolean $value = true ) | Set whether we would like to expose this route (and its verbs) to OPTIONS requests | |
setClassMetaData ( Drest\Mapping\ClassMetaData $class_metadata ) | Set this objects parent metadata class | |
setCollection ( boolean $value = true ) | Whether requests to this route should be handled as collections | |
setDisableExpose ( boolean $flag = true ) | Set disable expose flag | |
setExpose ( array $expose ) | An array of fields we're allowed to expose to the client | |
setHandleCall ( string $handle_call ) | Set the handle function call | |
setName ( string $name ) | Sets a unique reference name for the resource. | |
setRouteConditions ( array $route_conditions ) | Add an array of route conditions | |
setRouteParams ( array $params = [] ) | Inject route params onto this object without performing a match. Useful when calling a named route directly | |
setRoutePattern ( string $route_pattern ) | Add the route path. eg '/users/:id' | |
setUnmappedRouteParams ( array $params = [] ) | Inject unmapped route params onto this object without performing a match. | |
setVerbs ( mixed $verbs ) | Add verbs that are to be allowed on this route. | |
unserialize ( string $string ) | Un-serialise this object and reestablish it's state | |
usesHttpVerbs ( ) | Is this route specific to defined HTTP verbs |
public getClassMetaData ( ) : Drest\Mapping\ClassMetaData | ||
return | Drest\Mapping\ClassMetaData | $class_metadata |
public getHandleCall ( ) : string | ||
return | string | $handle_call |
public getNamedRoute ( ) : string | ||
return | string |
public getOriginLocation ( object $object, string $url, |
||
$object | object | |
$url | string | - the Url to be prepended to the location |
$em | - Optionally pass the entity manager to assist in determining a GET origin location | |
return | string | false |
public getRouteConditions ( ) : array | null | ||
return | array | null |
public getRouteParams ( ) : array | ||
return | array | $params |
public getRoutePattern ( ) : string | ||
return | string | $route_pattern |
public hasHandleCall ( ) |
public isAllowedOptionRequest ( ) : integer | ||
return | integer | $result -1 if not set, 0 if no and 1 if yes |
public isExposeDisabled ( ) : boolean | ||
return | boolean |
public matches ( DrestCommon\Request\Request $request, boolean $matchVerb = true, string $basePath = null ) : boolean | ||
$request | DrestCommon\Request\Request | |
$matchVerb | boolean | - Whether you want to match the route using the request HTTP verb - useful for OPTIONS requests to provide route info |
$basePath | string | - add a base path to the route pattern |
return | boolean | $result |
public needsHandleCall ( ) : boolean | ||
return | boolean | $response |
public setAllowedOptionRequest ( integer | boolean $value = true ) | ||
$value | integer | boolean | - if using integer -1 to unset, 0 for no and 1 if yes |
public setClassMetaData ( Drest\Mapping\ClassMetaData $class_metadata ) | ||
$class_metadata | Drest\Mapping\ClassMetaData |
public setCollection ( boolean $value = true ) | ||
$value | boolean |
public setDisableExpose ( boolean $flag = true ) | ||
$flag | boolean |
public setHandleCall ( string $handle_call ) | ||
$handle_call | string |
public setRouteConditions ( array $route_conditions ) | ||
$route_conditions | array |
public setRouteParams ( array $params = [] ) | ||
$params | array | - should be an associative array. keyed values are ignored |
public setRoutePattern ( string $route_pattern ) | ||
$route_pattern | string |
public setUnmappedRouteParams ( array $params = [] ) | ||
$params | array | - should be a keyed array. associative values are ignored |
public unserialize ( string $string ) | ||
$string | string |
protected int $allowed_option_request | ||
return | integer |
protected ClassMetaData,Drest\Mapping $class_metadata | ||
return | Drest\Mapping\ClassMetaData |
protected bool $collection | ||
return | boolean |
protected bool $disable_expose | ||
return | boolean |
protected array $expose | ||
return | array |
protected string $handle_call | ||
return | string |
protected array $param_names | ||
return | array |
protected array $param_names_path | ||
return | array |
protected array $route_conditions | ||
return | array |
protected array $route_params | ||
return | array |
protected string $route_pattern | ||
return | string |
protected array $unmapped_route_params | ||
return | array |
protected array $verbs | ||
return | array |