PHP Class ZF\Apigility\DbConnectedResource

Inheritance: extends ZF\Rest\AbstractResourceListener
Mostrar archivo Open project: zfcampus/zf-apigility Class Usage Examples

Protected Properties

Property Type Description
$collectionClass Name of collection class
$identifierName Name of identifier field
$table Zend\Db\TableGateway\TableGatewayInterface

Public Methods

Method Description
__construct ( Zend\Db\TableGateway\TableGatewayInterface $table, string $identifierName, string $collectionClass )
create ( array | object $data ) : array | object Create a new resource.
delete ( integer | string $id ) : boolean Delete an existing resource.
fetch ( integer | string $id ) : array | object Fetch an existing resource.
fetchAll ( array | object $data = [] ) : Zend\Paginator\Paginator Fetch a paginated set of resources.
patch ( integer | string $id, array | object $data ) : array | object Update an existing resource.
update ( integer | string $id, array | object $data ) : array | object Replace an existing resource.

Protected Methods

Method Description
retrieveData ( mixed $data ) : array Retrieve data

Method Details

__construct() public method

public __construct ( Zend\Db\TableGateway\TableGatewayInterface $table, string $identifierName, string $collectionClass )
$table Zend\Db\TableGateway\TableGatewayInterface
$identifierName string
$collectionClass string

create() public method

Create a new resource.
public create ( array | object $data ) : array | object
$data array | object Data representing the resource to create.
return array | object Newly created resource.

delete() public method

Delete an existing resource.
public delete ( integer | string $id ) : boolean
$id integer | string Identifier of resource.
return boolean

fetch() public method

Fetch an existing resource.
public fetch ( integer | string $id ) : array | object
$id integer | string Identifier of resource.
return array | object Resource.

fetchAll() public method

Fetch a paginated set of resources.
public fetchAll ( array | object $data = [] ) : Zend\Paginator\Paginator
$data array | object Ignored.
return Zend\Paginator\Paginator

patch() public method

Update an existing resource.
public patch ( integer | string $id, array | object $data ) : array | object
$id integer | string Identifier of resource.
$data array | object Data with which to update the resource.
return array | object Updated resource.

retrieveData() protected method

Retrieve data from composed input filter, if any; if none, cast the data passed to the method to an array.
protected retrieveData ( mixed $data ) : array
$data mixed
return array

update() public method

Replace an existing resource.
public update ( integer | string $id, array | object $data ) : array | object
$id integer | string Identifier of resource.
$data array | object Data with which to replace the resource.
return array | object Updated resource.

Property Details

$collectionClass protected_oe property

Name of collection class
protected $collectionClass

$identifierName protected_oe property

Name of identifier field
protected $identifierName

$table protected_oe property

protected TableGatewayInterface,Zend\Db\TableGateway $table
return Zend\Db\TableGateway\TableGatewayInterface