PHP Class lithium\data\source\Http

Inheritance: extends lithium\data\Source
显示文件 Open project: unionofrad/lithium Class Usage Examples

Public Properties

Property Type Description
$connection Service connection

Protected Properties

Property Type Description
$_autoConfig array The set of array keys which will be auto-populated in the object's protected properties from constructor parameters.
$_classes array Fully-namespaced class references
$_isConnected boolean Is Connected?
$_methods array List of methods and their corresponding HTTP method and path.

Public Methods

Method Description
__call ( string $method, array $params ) : mixed Pass methods to service connection. Path and method are determined from Http::$_method. If not set, a GET request with the $method as the path will be used.
__construct ( array $config = [] ) : void Constructor.
__get ( string $property ) : mixed Pass properties to service connection
connect ( ) : boolean Fake the connection since service is called for every method.
create ( object $query, array $options = [] ) : mixed Create function used to POST.
delete ( object $query, array $options = [] ) : string Used by model to DELETE.
describe ( string $entity, array $fields = [], array $meta = [] ) : array Describe data source.
disconnect ( ) : boolean Disconnect from socket.
read ( object $query, array $options = [] ) : string Read used by model to GET.
relationship ( string $class, string $type, string $name, array $options = [] ) : array Defines or modifies the default settings of a relationship between two models.
respondsTo ( string $method, boolean $internal = false ) : boolean Determines if a given method can be called.
send ( array $query = null, array $options = [] ) : mixed Method to send to a specific resource.
sources ( object $class = null ) : array Returns available data sources (typically a list of REST resources collections).
update ( object $query, array $options = [] ) : string Update used by model to PUT.

Protected Methods

Method Description
_init ( )

Method Details

__call() public method

Pass methods to service connection. Path and method are determined from Http::$_method. If not set, a GET request with the $method as the path will be used.
See also: lithium\data\source\Http::$_method
public __call ( string $method, array $params ) : mixed
$method string
$params array
return mixed

__construct() public method

Constructor.
public __construct ( array $config = [] ) : void
$config array
return void

__get() public method

Pass properties to service connection
public __get ( string $property ) : mixed
$property string
return mixed

_init() protected method

protected _init ( )

connect() public method

Fake the connection since service is called for every method.
public connect ( ) : boolean
return boolean

create() public method

Create function used to POST.
public create ( object $query, array $options = [] ) : mixed
$query object
$options array
return mixed

delete() public method

Used by model to DELETE.
public delete ( object $query, array $options = [] ) : string
$query object
$options array
return string

describe() public method

Describe data source.
public describe ( string $entity, array $fields = [], array $meta = [] ) : array
$entity string
$fields array
$meta array
return array - returns an empty array

disconnect() public method

Disconnect from socket.
public disconnect ( ) : boolean
return boolean

read() public method

Read used by model to GET.
public read ( object $query, array $options = [] ) : string
$query object
$options array
return string

relationship() public method

Defines or modifies the default settings of a relationship between two models.
public relationship ( string $class, string $type, string $name, array $options = [] ) : array
$class string
$type string
$name string
$options array
return array Returns an array containing the configuration for a model relationship.

respondsTo() public method

Determines if a given method can be called.
public respondsTo ( string $method, boolean $internal = false ) : boolean
$method string Name of the method.
$internal boolean Provide `true` to perform check from inside the class/object. When `false` checks also for public visibility; defaults to `false`.
return boolean Returns `true` if the method can be called, `false` otherwise.

send() public method

Method to send to a specific resource.
public send ( array $query = null, array $options = [] ) : mixed
$query array a query object
$options array array.
return mixed

sources() public method

Returns available data sources (typically a list of REST resources collections).
public sources ( object $class = null ) : array
$class object
return array

update() public method

Update used by model to PUT.
public update ( object $query, array $options = [] ) : string
$query object
$options array
return string

Property Details

$_autoConfig protected_oe property

The set of array keys which will be auto-populated in the object's protected properties from constructor parameters.
protected array $_autoConfig
return array

$_classes protected_oe property

Fully-namespaced class references
protected array $_classes
return array

$_isConnected protected_oe property

Is Connected?
protected bool $_isConnected
return boolean

$_methods protected_oe property

List of methods and their corresponding HTTP method and path.
protected array $_methods
return array

$connection public_oe property

Service connection
public $connection