Overview

Namespaces

  • NGS
    • Client
      • Exception
    • Converter
    • Patterns
  • PHP

Classes

  • ApplicationProxy
  • CrudProxy
  • DomainProxy
  • HttpRequest
  • QueryString
  • ReportingProxy
  • RestHttp
  • StandardProxy
  • Overview
  • Namespace
  • Class
  • Tree

Class DomainProxy

Proxy service to remote REST-like API for basic domain operations such as searching, counting and event sourcing. It is preferred to use domain patterns instead of this proxy service.

Namespace: NGS\Client
Located at Client/DomainProxy.php
Methods summary
public
# __construct( NGS\Client\RestHttp $http = null )

Create a new DomainProxy instance

Create a new DomainProxy 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\DomainProxy
# instance( )

Gets singleton instance of Domain.svc proxy

Gets singleton instance of Domain.svc proxy

Returns

NGS\Client\DomainProxy
public array
# find( string $class, array $uris )

Returns an array of domain objects uniquely represented with their URIs. Only found objects will be returned (array is empty if no objects are found).

Returns an array of domain objects uniquely represented with their URIs. Only found objects will be returned (array is empty if no objects are found).

Example:

$proxy = DomainProxy::instance();
$proxy->find('Test\\Item', array('uri1', 'uri2'));

Parameters

$class
string
$class Domain object class name or instance
$uris
array
$uris Array of string URIs

Returns

array
Array of found objects or empty array if none found
public array
# search( string $class, integer $limit = null, integer $offset = null, array $order = null )

Returns an array of all domain objects with up to $limit results.

Returns an array of all domain objects with up to $limit results.

Example:

$proxy = DomainProxy::instance();
$proxy->search('Test\\Item', 10, 20, array('title' => true));

Parameters

$class
string
$class Domain object class name or instance
$limit
integer
$limit Limits maximum number of returned results
$offset
integer
$offset Offset results by this number
$order
array
$order Array of key=>value pairs: keys are property names, values determine sorting direction: true=ascending, false=descending

Returns

array
Array of found objects or empty array if none found
public array
# searchWithSpecification( string $class, NGS\Patterns\Specification $specification, type $limit = null, type $offset = null, array $order = null )

Returns a list of domain objects satisfying NGS\Patterns\Specification with up to $limit results.

Returns a list of domain objects satisfying NGS\Patterns\Specification with up to $limit results.

Parameters

$class
string
$class
$specification
NGS\Patterns\Specification
$specification Specification instance used for searching
$limit
type
$limit
$offset
type
$offset
$order
array
$order

Returns

array
Array of found objects or empty array if none found
public type
# searchGeneric( string|NGS\Patterns\IDomainObject $class, array $filters = null, type $limit = null, type $offset = null, array $order = null )

Returns a list of domain objects satisfying conditions in NGS\Patterns\GenericSearch

Returns a list of domain objects satisfying conditions in NGS\Patterns\GenericSearch

Parameters

$class
string|NGS\Patterns\IDomainObject
$class
$filters
array
$filters
$limit
type
$limit
$offset
type
$offset
$order
array
$order

Returns

type
public type
# countGeneric( type $class, array $filters = null )

Count total number of domain objects satisfying conditions in NGS\Patterns\GenericSearch

Count total number of domain objects satisfying conditions in NGS\Patterns\GenericSearch

Parameters

$class
type
$class
$filters
array
$filters

Returns

type
public integer
# count( string $class )

Returns a total number of domain objects.

Returns a total number of domain objects.

Parameters

$class
string
$class

Returns

integer
Total number of objects
public integer
# countWithSpecification( NGS\Patterns\Specification $specification )

Count number of domain objects satisfying NGS\Patterns\Specification

Count number of domain objects satisfying NGS\Patterns\Specification

Parameters

$specification
NGS\Patterns\Specification
$specification

Returns

integer
Total number of objects
public string
# submitEvent( NGS\Patterns\DomainEvent $event )

Send domain event to the server. Server will return identity under which it was stored. Events can't be modified once they are submitted. Only new events can be created.

Send domain event to the server. Server will return identity under which it was stored. Events can't be modified once they are submitted. Only new events can be created.

Parameters

$event
NGS\Patterns\DomainEvent
$event Event to be executed

Returns

string
Event URI
public NGS\Patterns\AggregateRoot
# submitAggregateEvent( NGS\Patterns\AggregateDomainEvent $event, string $uri )

Apply domain event to a single aggregate. Server will return modified aggregate root. Events can't be modified once they are submitted. Only new events can be created.

Apply domain event to a single aggregate. Server will return modified aggregate root. Events can't be modified once they are submitted. Only new events can be created.

Parameters

$event
NGS\Patterns\AggregateDomainEvent
$event
$uri
string
$uri URI of aggregate root

Returns

NGS\Patterns\AggregateRoot
Aggregate on which event was applied
Constants summary
string DOMAIN_URI 'Domain.svc'
#
Properties summary
protected NGS\Client\RestHttp $http
#

Instance of RestHttp client

Instance of RestHttp client

protected static NGS\Client\DomainProxy $instance
#

Singleton instance

Singleton instance

API documentation generated by ApiGen 2.8.0