PHP Class PhalconRest\Api\ApiCollection

Inheritance: extends Phalcon\Mvc\Micro\Collection, implements PhalconApi\Acl\MountableInterface, implements Phalcon\Mvc\Micro\CollectionInterface
Show file Open project: olivierandriessen/phalcon-rest Class Usage Examples

Protected Properties

Property Type Description
$allowedRoles
$deniedRoles
$description
$endpointsByName
$name
$postedDataMethod

Public Methods

Method Description
__construct ( $prefix )
allow ( ) : static Allows access to this collection for role with the given names. This can be overwritten on the Endpoint level.
deny ( ) * Denies access to this collection for role with the given names. This can be overwritten on the Endpoint level.
description ( string $description ) : static
endpoint ( ApiEndpoint $endpoint ) : static Mounts endpoint to the collection
expectsJsonData ( ) : static Sets the posted data method to JSON_BODY
expectsPostData ( ) : static Sets the posted data method to POST
factory ( string $prefix, string $name = null ) : static Returns collection with default values
getAclResources ( )
getAclRules ( array $roles )
getAllowedRoles ( ) : string[]
getDeniedRoles ( ) : string[]
getDescription ( ) : string
getEndpoint ( string $name ) : ApiEndpoint | null
getEndpoints ( ) : ApiEndpoint[]
getIdentifier ( ) : string
getName ( ) : string | null
getPostedDataMethod ( ) : string
handler ( $handler, $lazy = true )
mount ( ApiEndpoint $endpoint ) : static Mounts endpoint to the collection
name ( string $name ) : static
postedDataMethod ( string $method ) : static
setPrefix ( $prefix )

Protected Methods

Method Description
createRouteName ( ApiEndpoint $endpoint )
initialize ( ) Use this method when you extend this class in order to define the collection

Method Details

__construct() public method

public __construct ( $prefix )

allow() public method

Allows access to this collection for role with the given names. This can be overwritten on the Endpoint level.
public allow ( ) : static
return static

createRouteName() protected method

protected createRouteName ( ApiEndpoint $endpoint )
$endpoint ApiEndpoint

deny() public method

* Denies access to this collection for role with the given names. This can be overwritten on the Endpoint level.
public deny ( )

description() public method

public description ( string $description ) : static
$description string Description of the collection
return static

endpoint() public method

Mounts endpoint to the collection
public endpoint ( ApiEndpoint $endpoint ) : static
$endpoint ApiEndpoint Endpoint to mount
return static

expectsJsonData() public method

Sets the posted data method to JSON_BODY
public expectsJsonData ( ) : static
return static

expectsPostData() public method

Sets the posted data method to POST
public expectsPostData ( ) : static
return static

factory() public static method

Returns collection with default values
public static factory ( string $prefix, string $name = null ) : static
$prefix string Prefix for the collection (e.g. /auth)
$name string Name for the collection (e.g. authentication) (optional)
return static

getAclResources() public method

public getAclResources ( )

getAclRules() public method

public getAclRules ( array $roles )
$roles array

getAllowedRoles() public method

public getAllowedRoles ( ) : string[]
return string[] Array of allowed role-names

getDeniedRoles() public method

public getDeniedRoles ( ) : string[]
return string[] Array of denied role-names

getDescription() public method

public getDescription ( ) : string
return string Description of the collection

getEndpoint() public method

public getEndpoint ( string $name ) : ApiEndpoint | null
$name string Name for the endpoint to return
return ApiEndpoint | null Endpoint with the given name

getEndpoints() public method

public getEndpoints ( ) : ApiEndpoint[]
return ApiEndpoint[] Array of all mounted endpoints

getIdentifier() public method

public getIdentifier ( ) : string
return string Unique identifier for this collection (returns the prefix)

getName() public method

public getName ( ) : string | null
return string | null Name of the collection

getPostedDataMethod() public method

public getPostedDataMethod ( ) : string
return string $method One of the method constants defined in PostedDataMethods

handler() public method

public handler ( $handler, $lazy = true )

initialize() protected method

Use this method when you extend this class in order to define the collection
protected initialize ( )

mount() public method

Mounts endpoint to the collection
public mount ( ApiEndpoint $endpoint ) : static
$endpoint ApiEndpoint Endpoint to mount (shortcut for endpoint function)
return static

name() public method

public name ( string $name ) : static
$name string Name for the collection
return static

postedDataMethod() public method

public postedDataMethod ( string $method ) : static
$method string One of the method constants defined in PostedDataMethods
return static

setPrefix() public method

public setPrefix ( $prefix )

Property Details

$allowedRoles protected property

protected $allowedRoles

$deniedRoles protected property

protected $deniedRoles

$description protected property

protected $description

$endpointsByName protected property

protected $endpointsByName

$name protected property

protected $name

$postedDataMethod protected property

protected $postedDataMethod