PHP 클래스 Drest\Service

Is also injected into custom service actions
파일 보기 프로젝트 열기: leedavis81/drest 1 사용 예제들

보호된 프로퍼티들

프로퍼티 타입 설명
$dm drest\Manager Drest Manager
$error_handler DrestCommon\Error\Handler\AbstractHandler The error handler instance
$matched_route Drest\Mapping\RouteMetaData When a route object is matched, it's injected into the service class
$representation DrestCommon\Representation\AbstractRepresentation A representation instance determined either from configuration or client media accept type - can be null if none matched Note this will be present on both a fetch (GET) request and on a push (POST / PUT) request if using the drest client
$service_action_registry Drest\Service\Action\Registry Service Action Registry

공개 메소드들

메소드 설명
__construct ( drest\Manager $dm, Drest\Service\Action\Registry $service_action_registry ) Initialise a new instance of a Drest service
getDrestManager ( ) : drest\Manager Get the Drest Manager
getEntityManager ( ) : EntityManager Get the entity manager This will return the default manager, to choose a specific one use getEntityManagerRegistry()
getEntityManagerRegistry ( ) : drest\EntityManagerRegistry Get the entity manager registry
getMatchedRoute ( ) : RouteMetaData Get the route object that was matched
getRepresentation ( ) : DrestCommon\Representation\AbstractRepresentation Get the predetermined representation
getRequest ( ) : DrestCommon\Request\Request Get the request object
getResponse ( ) : DrestCommon\Response\Response Get the response object
getServiceActionRegistry ( ) : Drest\Service\Action\Registry Get the service action registry
handleError ( Exception $e, integer $defaultResponseCode = 500, DrestCommon\Error\Response\ResponseInterface $errorDocument = null ) : DrestCommon\ResultSet Handle an error - set the resulting error document to the response object
renderDeterminedRepresentation ( DrestCommon\ResultSet $resultSet ) Write out as result set on the representation object that was determined - if no representation has been determined - defaults to text
runCallMethod ( ) Run the call method required on this service object
setErrorHandler ( DrestCommon\Error\Handler\AbstractHandler $error_handler ) Set the error handler object
setMatchedRoute ( RouteMetaData $matched_route ) Set the matched route object
setRepresentation ( DrestCommon\Representation\AbstractRepresentation $representation ) Set any predetermined representation instance
setUpAndRunRequest ( ) Set up and run the required call method

보호된 메소드들

메소드 설명
getActionInstance ( ) : Drest\Service\Action\AbstractAction Get an instance of the action class to be used
getDefaultAction ( ) : Drest\Service\Action\AbstractAction Gets an instance of the "default" action based of request information
setupRequest ( ) : boolean Called on successful routing of a service call Prepares the service to a request to be rendered

메소드 상세

__construct() 공개 메소드

Initialise a new instance of a Drest service
public __construct ( drest\Manager $dm, Drest\Service\Action\Registry $service_action_registry )
$dm drest\Manager - The Drest Manager object
$service_action_registry Drest\Service\Action\Registry - registry use to look up service actions

getActionInstance() 보호된 메소드

Get an instance of the action class to be used
protected getActionInstance ( ) : Drest\Service\Action\AbstractAction
리턴 Drest\Service\Action\AbstractAction $action

getDefaultAction() 보호된 메소드

Gets an instance of the "default" action based of request information
protected getDefaultAction ( ) : Drest\Service\Action\AbstractAction
리턴 Drest\Service\Action\AbstractAction $action

getDrestManager() 공개 메소드

Get the Drest Manager
public getDrestManager ( ) : drest\Manager
리턴 drest\Manager $dm

getEntityManager() 공개 메소드

Get the entity manager This will return the default manager, to choose a specific one use getEntityManagerRegistry()
public getEntityManager ( ) : EntityManager
리턴 Doctrine\ORM\EntityManager $em

getEntityManagerRegistry() 공개 메소드

Get the entity manager registry
public getEntityManagerRegistry ( ) : drest\EntityManagerRegistry
리턴 drest\EntityManagerRegistry

getMatchedRoute() 공개 메소드

Get the route object that was matched
public getMatchedRoute ( ) : RouteMetaData
리턴 Drest\Mapping\RouteMetaData $matched_route

getRepresentation() 공개 메소드

Get the predetermined representation
public getRepresentation ( ) : DrestCommon\Representation\AbstractRepresentation
리턴 DrestCommon\Representation\AbstractRepresentation

getRequest() 공개 메소드

Get the request object
public getRequest ( ) : DrestCommon\Request\Request
리턴 DrestCommon\Request\Request $request

getResponse() 공개 메소드

Get the response object
public getResponse ( ) : DrestCommon\Response\Response
리턴 DrestCommon\Response\Response $response

getServiceActionRegistry() 공개 메소드

Get the service action registry
public getServiceActionRegistry ( ) : Drest\Service\Action\Registry
리턴 Drest\Service\Action\Registry $service_action_registry

handleError() 공개 메소드

Handle an error - set the resulting error document to the response object
public handleError ( Exception $e, integer $defaultResponseCode = 500, DrestCommon\Error\Response\ResponseInterface $errorDocument = null ) : DrestCommon\ResultSet
$e Exception
$defaultResponseCode integer the default response code to use if no match on exception type occurs
$errorDocument DrestCommon\Error\Response\ResponseInterface
리턴 DrestCommon\ResultSet the error result set

renderDeterminedRepresentation() 공개 메소드

Write out as result set on the representation object that was determined - if no representation has been determined - defaults to text
public renderDeterminedRepresentation ( DrestCommon\ResultSet $resultSet )
$resultSet DrestCommon\ResultSet

runCallMethod() 최종 공개 메소드

Run the call method required on this service object
final public runCallMethod ( )

setErrorHandler() 공개 메소드

Set the error handler object
public setErrorHandler ( DrestCommon\Error\Handler\AbstractHandler $error_handler )
$error_handler DrestCommon\Error\Handler\AbstractHandler

setMatchedRoute() 공개 메소드

Set the matched route object
public setMatchedRoute ( RouteMetaData $matched_route )
$matched_route Drest\Mapping\RouteMetaData

setRepresentation() 공개 메소드

Set any predetermined representation instance
public setRepresentation ( DrestCommon\Representation\AbstractRepresentation $representation )
$representation DrestCommon\Representation\AbstractRepresentation

setUpAndRunRequest() 공개 메소드

Set up and run the required call method
public setUpAndRunRequest ( )

setupRequest() 보호된 메소드

Called on successful routing of a service call Prepares the service to a request to be rendered
protected setupRequest ( ) : boolean
리턴 boolean $result - if false then fail fast no call to runCallMethod() should be made.

프로퍼티 상세

$dm 보호되어 있는 프로퍼티

Drest Manager
protected Manager,drest $dm
리턴 drest\Manager

$error_handler 보호되어 있는 프로퍼티

The error handler instance
protected AbstractHandler,DrestCommon\Error\Handler $error_handler
리턴 DrestCommon\Error\Handler\AbstractHandler

$matched_route 보호되어 있는 프로퍼티

When a route object is matched, it's injected into the service class
protected RouteMetaData,Drest\Mapping $matched_route
리턴 Drest\Mapping\RouteMetaData

$representation 보호되어 있는 프로퍼티

A representation instance determined either from configuration or client media accept type - can be null if none matched Note this will be present on both a fetch (GET) request and on a push (POST / PUT) request if using the drest client
protected AbstractRepresentation,DrestCommon\Representation $representation
리턴 DrestCommon\Representation\AbstractRepresentation

$service_action_registry 보호되어 있는 프로퍼티

Service Action Registry
protected Registry,Drest\Service\Action $service_action_registry
리턴 Drest\Service\Action\Registry