Class CrudProxy
Proxy service to remote CRUD REST-like API. Single aggregate root instance
can be used. New object instance will be returned when doing modifications. All
commands are performed on a single aggregate root. Use NGS\Client\StandardProxy
when
response is not required, or for bulk versions of CRUD commands. It is preferred
to use domain patterns instead of this proxy service.
Methods summary
public
|
#
__construct( NGS\Client\RestHttp $http = null )
Create a new CrudProxy instance
Create a new CrudProxy instance
Parameters
- $http
NGS\Client\RestHttp
$http RestHttp instance used for http request. Optionally specify an instance,
otherwise use a singleton instance
|
public static
NGS\Client\CrudProxy
|
#
instance( )
Gets singleton instance of Crud.svc proxy
Gets singleton instance of Crud.svc proxy
Returns
|
public
NGS\Patterns\AggregateRoot
|
#
create( NGS\Patterns\AggregateRoot $aggregate )
Create (insert) a single aggregate root on the remote server.
Created object will be returned with its identity and all calculated properties
evaluated.
Create (insert) a single aggregate root on the remote server. Created object
will be returned with its identity and all calculated properties evaluated.
Parameters
Returns
|
public
NGS\Patterns\AggregateRoot
|
#
update( NGS\Patterns\AggregateRoot $aggregate )
Modify existing aggregate root on the remote server. Aggregate root will be
saved and all calculated properties evaluated.
Modify existing aggregate root on the remote server. Aggregate root will be
saved and all calculated properties evaluated.
Parameters
Returns
|
public
NGS\Patterns\AggregateRoot
|
#
delete( string $class, string $uri )
Delete existing aggregate root from the remote server. If possible, aggregate
root will be deleted and it's instance will be provided.
Delete existing aggregate root from the remote server. If possible, aggregate
root will be deleted and it's instance will be provided.
Parameters
- $class
string $class
- $uri
string $uri
Returns
|
public
NGS\Patterns\AggregateRoot
|
#
read( string $class, string $uri )
Get domain object from remote server using provided identity. If domain
object is not found an exception will be thrown.
Get domain object from remote server using provided identity. If domain
object is not found an exception will be thrown.
Parameters
- $class
string $class
- $uri
string $uri
Returns
|
Constants summary
string |
CRUD_URI
|
'Crud.svc' |
|
Properties summary
protected
mixed
|
$http
|
|
|
protected static
mixed
|
$instance
|
|
|