PHP Class ZF\Apigility\Doctrine\Server\Resource\DoctrineResource

Inheritance: extends ZF\Rest\AbstractResourceListener, implements DoctrineModule\Persistence\ObjectManagerAwareInterface, implements Zend\EventManager\EventManagerAwareInterface, implements Zend\Stdlib\Hydrator\HydratorAwareInterface
Mostrar archivo Open project: zfcampus/zf-apigility-doctrine Class Usage Examples

Protected Properties

Property Type Description
$entityIdentifierName entityIdentifierName
$eventIdentifier array
$events Zend\EventManager\EventManagerInterface
$hydrator Zend\Hydrator\HydratorInterface
$multiKeyDelimiter string
$objectManager Doctrine\Common\Persistence\ObjectManager
$queryCreateFilter ZF\Apigility\Doctrine\Server\Query\CreateFilter\QueryCreateFilterInterface
$queryProviders array | ZF\Apigility\Doctrine\Server\Query\Provider\QueryProviderInterface
$routeIdentifierName string
$sharedEventManager Interface

Public Methods

Method Description
create ( mixed $data ) : ZF\ApiProblem\ApiProblem | mixed Create a resource
delete ( mixed $id ) : ZF\ApiProblem\ApiProblem | mixed Delete a resource
deleteList ( mixed $data ) : ZF\ApiProblem\ApiProblem | mixed Delete a list of entities
fetch ( mixed $id ) : ZF\ApiProblem\ApiProblem | mixed Fetch a resource
fetchAll ( array $data = [] ) : ZF\ApiProblem\ApiProblem | mixed Fetch all or a subset of resources
getEntityIdentifierName ( ) : string
getEventManager ( ) : Zend\EventManager\EventManagerInterface Retrieve the event manager
getHydrator ( ) : Zend\Hydrator\HydratorInterface
getMultiKeyDelimiter ( ) : string
getObjectManager ( ) : Doctrine\Common\Persistence\ObjectManager | Doctrine\ORM\EntityManagerInterface Get the object manager
getQueryCreateFilter ( ) : ZF\Apigility\Doctrine\Server\Query\CreateFilter\QueryCreateFilterInterface
getQueryProvider ( $method ) : ZF\Apigility\Doctrine\Server\Query\Provider\QueryProviderInterface
getQueryProviders ( ) : array | ZF\Apigility\Doctrine\Server\Query\Provider\QueryProviderInterface[]
getRouteIdentifierName ( ) : string
getSharedEventManager ( ) : Zend\EventManager\SharedEventManager
patch ( mixed $id, mixed $data ) : ZF\ApiProblem\ApiProblem | mixed Patch (partial in-place update) a resource
patchList ( array $data ) : array Respond to the PATCH method (partial update of existing entity) on a collection, i.e. update multiple entities in a collection.
replaceList ( mixed $data ) : ZF\ApiProblem\ApiProblem | mixed Replace a collection or members of a collection
setEntityIdentifierName ( $value )
setEventManager ( Zend\EventManager\EventManagerInterface $events ) Set the event manager instance used by this context.
setHydrator ( Zend\Hydrator\HydratorInterface $hydrator )
setMultiKeyDelimiter ( string $value )
setObjectManager ( Doctrine\Common\Persistence\ObjectManager $objectManager ) Set the object manager
setQueryCreateFilter ( ZF\Apigility\Doctrine\Server\Query\CreateFilter\QueryCreateFilterInterface $value )
setQueryProviders ( $queryProviders )
setRouteIdentifierName ( string $routeIdentifierName )
setSharedEventManager ( Zend\EventManager\SharedEventManager $sharedEventManager )
update ( mixed $id, mixed $data ) : ZF\ApiProblem\ApiProblem | mixed Update a resource

Protected Methods

Method Description
findEntity ( $id, $method, null | array $data = null ) : object Gets an entity by route params and/or the specified id
triggerDoctrineEvent ( $name, $entity, $data = null ) : Zend\EventManager\ResponseCollection This method will give custom listeners te chance to alter entities / collections.

Method Details

create() public method

Create a resource
public create ( mixed $data ) : ZF\ApiProblem\ApiProblem | mixed
$data mixed
return ZF\ApiProblem\ApiProblem | mixed

delete() public method

Delete a resource
public delete ( mixed $id ) : ZF\ApiProblem\ApiProblem | mixed
$id mixed
return ZF\ApiProblem\ApiProblem | mixed

deleteList() public method

Delete a list of entities
public deleteList ( mixed $data ) : ZF\ApiProblem\ApiProblem | mixed
$data mixed
return ZF\ApiProblem\ApiProblem | mixed

fetch() public method

If the extractCollections array contains a collection for this resource expand that collection instead of returning a link to the collection
public fetch ( mixed $id ) : ZF\ApiProblem\ApiProblem | mixed
$id mixed
return ZF\ApiProblem\ApiProblem | mixed

fetchAll() public method

Fetch all or a subset of resources
public fetchAll ( array $data = [] ) : ZF\ApiProblem\ApiProblem | mixed
$data array
return ZF\ApiProblem\ApiProblem | mixed

findEntity() protected method

Gets an entity by route params and/or the specified id
protected findEntity ( $id, $method, null | array $data = null ) : object
$id
$method
$data null | array parameters
return object

getEntityIdentifierName() public method

public getEntityIdentifierName ( ) : string
return string

getEventManager() public method

Lazy-loads an EventManager instance if none registered.
public getEventManager ( ) : Zend\EventManager\EventManagerInterface
return Zend\EventManager\EventManagerInterface

getHydrator() public method

public getHydrator ( ) : Zend\Hydrator\HydratorInterface
return Zend\Hydrator\HydratorInterface

getMultiKeyDelimiter() public method

public getMultiKeyDelimiter ( ) : string
return string

getObjectManager() public method

Get the object manager
public getObjectManager ( ) : Doctrine\Common\Persistence\ObjectManager | Doctrine\ORM\EntityManagerInterface
return Doctrine\Common\Persistence\ObjectManager | Doctrine\ORM\EntityManagerInterface

getQueryCreateFilter() public method

public getQueryCreateFilter ( ) : ZF\Apigility\Doctrine\Server\Query\CreateFilter\QueryCreateFilterInterface
return ZF\Apigility\Doctrine\Server\Query\CreateFilter\QueryCreateFilterInterface

getQueryProvider() public method

public getQueryProvider ( $method ) : ZF\Apigility\Doctrine\Server\Query\Provider\QueryProviderInterface
$method
return ZF\Apigility\Doctrine\Server\Query\Provider\QueryProviderInterface

getQueryProviders() public method

public getQueryProviders ( ) : array | ZF\Apigility\Doctrine\Server\Query\Provider\QueryProviderInterface[]
return array | ZF\Apigility\Doctrine\Server\Query\Provider\QueryProviderInterface[]

getRouteIdentifierName() public method

public getRouteIdentifierName ( ) : string
return string

getSharedEventManager() public method

public getSharedEventManager ( ) : Zend\EventManager\SharedEventManager
return Zend\EventManager\SharedEventManager

patch() public method

Patch (partial in-place update) a resource
public patch ( mixed $id, mixed $data ) : ZF\ApiProblem\ApiProblem | mixed
$id mixed
$data mixed
return ZF\ApiProblem\ApiProblem | mixed

patchList() public method

Respond to the PATCH method (partial update of existing entity) on a collection, i.e. update multiple entities in a collection.
public patchList ( array $data ) : array
$data array
return array

replaceList() public method

Replace a collection or members of a collection
public replaceList ( mixed $data ) : ZF\ApiProblem\ApiProblem | mixed
$data mixed
return ZF\ApiProblem\ApiProblem | mixed

setEntityIdentifierName() public method

public setEntityIdentifierName ( $value )

setEventManager() public method

For convenience, this method will also set the class name / LSB name as identifiers, in addition to any string or array of strings set to the $this->eventIdentifier property.
public setEventManager ( Zend\EventManager\EventManagerInterface $events )
$events Zend\EventManager\EventManagerInterface

setHydrator() public method

public setHydrator ( Zend\Hydrator\HydratorInterface $hydrator )
$hydrator Zend\Hydrator\HydratorInterface

setMultiKeyDelimiter() public method

public setMultiKeyDelimiter ( string $value )
$value string

setObjectManager() public method

Set the object manager
public setObjectManager ( Doctrine\Common\Persistence\ObjectManager $objectManager )
$objectManager Doctrine\Common\Persistence\ObjectManager

setQueryCreateFilter() public method

public setQueryCreateFilter ( ZF\Apigility\Doctrine\Server\Query\CreateFilter\QueryCreateFilterInterface $value )
$value ZF\Apigility\Doctrine\Server\Query\CreateFilter\QueryCreateFilterInterface

setQueryProviders() public method

public setQueryProviders ( $queryProviders )

setRouteIdentifierName() public method

public setRouteIdentifierName ( string $routeIdentifierName )
$routeIdentifierName string

setSharedEventManager() public method

public setSharedEventManager ( Zend\EventManager\SharedEventManager $sharedEventManager )
$sharedEventManager Zend\EventManager\SharedEventManager

triggerDoctrineEvent() protected method

Listeners can also return an ApiProblem, which will be returned immediately. It is also possible to throw Exceptions, which will result in an ApiProblem eventually.
protected triggerDoctrineEvent ( $name, $entity, $data = null ) : Zend\EventManager\ResponseCollection
$name
$entity
$data mixed The original data supplied to the resource method, if any
return Zend\EventManager\ResponseCollection

update() public method

Update a resource
public update ( mixed $id, mixed $data ) : ZF\ApiProblem\ApiProblem | mixed
$id mixed
$data mixed
return ZF\ApiProblem\ApiProblem | mixed

Property Details

$entityIdentifierName protected_oe property

entityIdentifierName
protected $entityIdentifierName

$eventIdentifier protected_oe property

protected array $eventIdentifier
return array

$events protected_oe property

protected EventManagerInterface,Zend\EventManager $events
return Zend\EventManager\EventManagerInterface

$hydrator protected_oe property

protected HydratorInterface,Zend\Hydrator $hydrator
return Zend\Hydrator\HydratorInterface

$multiKeyDelimiter protected_oe property

protected string $multiKeyDelimiter
return string

$objectManager protected_oe property

protected ObjectManager,Doctrine\Common\Persistence $objectManager
return Doctrine\Common\Persistence\ObjectManager

$queryCreateFilter protected_oe property

protected QueryCreateFilterInterface,ZF\Apigility\Doctrine\Server\Query\CreateFilter $queryCreateFilter
return ZF\Apigility\Doctrine\Server\Query\CreateFilter\QueryCreateFilterInterface

$queryProviders protected_oe property

protected array|QueryProviderInterface,ZF\Apigility\Doctrine\Server\Query\Provider $queryProviders
return array | ZF\Apigility\Doctrine\Server\Query\Provider\QueryProviderInterface

$routeIdentifierName protected_oe property

protected string $routeIdentifierName
return string

$sharedEventManager protected_oe property

Interface
protected $sharedEventManager