class ObjectIdentity implements ObjectIdentityInterface

ObjectIdentity implementation

Methods

__construct(string $identifier, string $type)

Constructor.

static ObjectIdentity
fromDomainObject(object $domainObject)

Constructs an ObjectIdentity for the given domain object

string
getIdentifier()

Obtains a unique identifier for this object. The identifier must not be re-used for other objects with the same type.

string
getType()

Returns a type for the domain object. Typically, this is the PHP class name.

bool
equals(ObjectIdentityInterface $identity)

We specifically require this method so we can check for object equality explicitly, and do not have to rely on referencial equality instead.

string
__toString()

Returns a textual representation of this object identity

Details

at line line 37
__construct(string $identifier, string $type)

Constructor.

Parameters

string $identifier
string $type

Exceptions

InvalidArgumentException

at line line 57
static ObjectIdentity fromDomainObject(object $domainObject)

Constructs an ObjectIdentity for the given domain object

Parameters

object $domainObject

Return Value

ObjectIdentity

Exceptions

InvalidDomainObjectException

at line line 79
string getIdentifier()

Obtains a unique identifier for this object. The identifier must not be re-used for other objects with the same type.

Return Value

string cannot return null

at line line 87
string getType()

Returns a type for the domain object. Typically, this is the PHP class name.

Return Value

string cannot return null

at line line 95
bool equals(ObjectIdentityInterface $identity)

We specifically require this method so we can check for object equality explicitly, and do not have to rely on referencial equality instead.

Though in most cases, both checks should result in the same outcome.

Referential Equality: $object1 === $object2 Example for Object Equality: $object1->getId() === $object2->getId()

Parameters

ObjectIdentityInterface $identity

Return Value

bool

at line line 108
string __toString()

Returns a textual representation of this object identity

Return Value

string