Overview

Namespaces

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

Classes

  • AggregateDomainEvent
  • AggregateRoot
  • CubeBuilder
  • DomainEvent
  • GenericSearch
  • Identifiable
  • OlapCube
  • Repository
  • Search
  • Searchable
  • SearchBuilder
  • Snapshot
  • Specification
  • Templater

Interfaces

  • IDomainObject
  • IIdentifiable
  • Overview
  • Namespace
  • Class
  • Tree

Class AggregateRoot

Aggregate root is a meaningful object in the domain. It can be viewed as a write boundary for entities and value objects that will maintain write consistency.

Usually it represents a single table, but can span several tables and can be used like document or similar data structure. Since every aggregate is also an entity, it has a unique identification represented by its URI.

DSL example:

module Todo {
  aggregate Task {
    timestamp startedAt;
    timestamp? finishedAt;
    int? priority;
    List<Note> notes;
  }
  value Note {
    date entered;
    string remark;
  }
}
NGS\Patterns\Searchable implements NGS\Patterns\IDomainObject
Extended by NGS\Patterns\Identifiable implements NGS\Patterns\IIdentifiable
Extended by NGS\Patterns\AggregateRoot
Abstract
Namespace: NGS\Patterns
Located at Patterns/AggregateRoot.php
Methods summary
public NGS\Patterns\AggregateRoot
# persist( )

Persists object on the server. Insert is performed if object's URI is not set, otherwise, if URI is set, current object is updated.

Persists object on the server. Insert is performed if object's URI is not set, otherwise, if URI is set, current object is updated.

Returns

NGS\Patterns\AggregateRoot
Persisted object
public NGS\Patterns\AggregateRoot
# delete( )

Deletes object from the server

Deletes object from the server

Returns

NGS\Patterns\AggregateRoot
Deleted object

Throws

LogicException
If object instance was created, but not persisted
public NGS\Patterns\AggregateRoot
# apply( NGS\Patterns\AggregateDomainEvent $event )

Applies aggregate domain event on object

Applies aggregate domain event on object

Parameters

$event
NGS\Patterns\AggregateDomainEvent
$event

Returns

NGS\Patterns\AggregateRoot
New instance of AggregateRoot with updated values after applying event

Throws

LogicException
If object instance was created, but not persisted
Methods inherited from NGS\Patterns\Identifiable
exists(), find()
Methods inherited from NGS\Patterns\Searchable
count(), findAll()
Methods inherited from NGS\Patterns\IIdentifiable
getURI()
Methods inherited from NGS\Patterns\IDomainObject
toArray(), toJson()
API documentation generated by ApiGen 2.8.0