Entity Class

class Entity

Represents an entity

__construct(string $name, ?string $alias = null)

Create a new instance of Entity

Parameters:
  • $name (string) –

    The entity name

    ..note::

    $name must begin with an alphabetic character or an underscore, and may also contain digits and hyphens

  • $alias (?string) – The entity alias (default: no alias)

Returns:

A new instance of Entity

Return type:

Entity

exception InvalidArgumentException

Thrown if $name is invalid

InvalidArgumentException::addAttribute(Attribute ...$attribute)

Add attribute(s) to an entity

Parameters:
  • ...$attribute (Attribute) – The attribute(s) to add

Returns:

A new instance of Entity with the attribute(s) added

Return type:

Entity

InvalidArgumentException::withAttribute(Attribute ...$attribute)

Set the attribute(s) of an entity

Parameters:
  • ...$attribute (Attribute) – The attribute(s)

Returns:

A new instance of Entity with the attribute(s)

Return type:

Entity