Ubiquity 2.5.2
php rapid development framework
Loading...
Searching...
No Matches
DynamicResourceTrait Class Reference
+ Inheritance diagram for DynamicResourceTrait:

Public Member Functions

 _setResponseCode ($value)
 
 _format ($arrayMessage)
 
 _getAll ()
 
 _getRelationShip ($id, $member)
 
 _getOne ($keyValues, $include=false, $useCache=false)
 
 _delete (... $keyValues)
 
 getAll_ ($resource)
 Returns all the instances from the model $resource.
 
 getRelationShip_ ($resource, $id, $member)
 Returns an associated member value(s).
 
 getOne_ ($resource, $id)
 Returns an instance of $resource, by primary key $id.
 
 add_ ($resource)
 Inserts a new instance of $resource.
 
 update_ ($resource,... $id)
 Updates an existing instance of $resource.
 
 delete_ ($resource,... $id)
 Deletes an existing instance of $resource.
 

Protected Member Functions

 _getResponseFormatter ()
 
 getRequestParam ($param, $default)
 
 hasErrors ()
 
 displayErrors ()
 
 updateOperation ($instance, $datas, $updateMany=false)
 
 addOperation ($instance, $datas, $insertMany=false)
 
 _setResource ($resource)
 
 _checkResource ($resource, $callback)
 

Detailed Description

Definition at line 20 of file DynamicResourceTrait.php.

Member Function Documentation

◆ _checkResource()

_checkResource (   $resource,
  $callback 
)
protected

Definition at line 57 of file DynamicResourceTrait.php.

◆ _delete()

_delete (   $keyValues)
abstract

◆ _format()

_format (   $arrayMessage)
abstract

◆ _getAll()

_getAll ( )
abstract

◆ _getOne()

_getOne (   $keyValues,
  $include = false,
  $useCache = false 
)
abstract

◆ _getRelationShip()

_getRelationShip (   $id,
  $member 
)
abstract

◆ _getResponseFormatter()

_getResponseFormatter ( )
abstractprotected

◆ _setResource()

_setResource (   $resource)
protected

Definition at line 52 of file DynamicResourceTrait.php.

◆ _setResponseCode()

_setResponseCode (   $value)
abstract

◆ add_()

add_ (   $resource)

Inserts a new instance of $resource.

Data attributes are send in data[attributes] request body (in JSON format)

Parameters
string$resourceThe resource (model) to use

Definition at line 111 of file DynamicResourceTrait.php.

◆ addOperation()

addOperation (   $instance,
  $datas,
  $insertMany = false 
)
protected

Definition at line 47 of file DynamicResourceTrait.php.

◆ delete_()

delete_ (   $resource,
  $id 
)

Deletes an existing instance of $resource.

Parameters
string$resourceThe resource (model) to use
string$idsThe primary key value(s), if the primary key is composite, use a comma to separate the values (e.g. 1,115,AB)

Definition at line 141 of file DynamicResourceTrait.php.

◆ displayErrors()

displayErrors ( )
abstractprotected

◆ getAll_()

getAll_ (   $resource)

Returns all the instances from the model $resource.

Definition at line 71 of file DynamicResourceTrait.php.

◆ getOne_()

getOne_ (   $resource,
  $id 
)

Returns an instance of $resource, by primary key $id.

Parameters
string$resourceThe resource (model) to use
string$idThe primary key value(s), if the primary key is composite, use a comma to separate the values (e.g. 1,115,AB)

Definition at line 99 of file DynamicResourceTrait.php.

◆ getRelationShip_()

getRelationShip_ (   $resource,
  $id,
  $member 
)

Returns an associated member value(s).

Query parameters:

  • include: A string of associated members to load, comma separated (e.g. users,groups,organization...), or a boolean: true for all members, false for none (default: true).
Parameters
string$resourceThe resource (model) to use
string$idThe primary key value(s), if the primary key is composite, use a comma to separate the values (e.g. 1,115,AB)
string$memberThe member to load

Definition at line 86 of file DynamicResourceTrait.php.

◆ getRequestParam()

getRequestParam (   $param,
  $default 
)
abstractprotected

◆ hasErrors()

hasErrors ( )
abstractprotected

◆ update_()

update_ (   $resource,
  $id 
)

Updates an existing instance of $resource.

Data attributes are send in data[attributes] request body (in JSON format)

Parameters
string$resourceThe resource (model) to use

Definition at line 124 of file DynamicResourceTrait.php.

◆ updateOperation()

updateOperation (   $instance,
  $datas,
  $updateMany = false 
)
protected

Definition at line 42 of file DynamicResourceTrait.php.


The documentation for this class was generated from the following file: