2017 © Pedro Peláez
 

library entity-behaviours

A set of behaviours and interfaces for use with entities

image

somnambulist/entity-behaviours

A set of behaviours and interfaces for use with entities

  • Wednesday, October 18, 2017
  • by dredfern
  • Repository
  • 1 Watchers
  • 0 Stars
  • 318 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 6 Versions
  • 36 % Grown

The README.md

Moved to https://github.com/dave-redfern/somnambulist-domain

This repository has been archived. Please update to the combined package.s, (*1)

Entity Behaviours

Provides some useful interfaces and traits that can be used with entities. The traits implement on basic methods, and still require e.g. publish/unpublish to be implemented., (*2)

Requirements

  • PHP 7+

Installation

Install using composer, or checkout / pull the files from github.com., (*3)

  • composer require somnambulist/entity-behaviours

Behaviours

Unlike the somnambulist/laravel-doctrine-behaviours package, these behaviours are intended to be used in a much more controlled and DDD based system. As such they do not implement setters and in some cases even the methods defined in the interfaces as these are core domain methods that should raise events within your system., (*4)

  1. Activatable, (*5)

    Adds activate()/deactivate() methods to an entity controlling if it is active or not. The entity should implement activate/deactivate methods so that Events can be raised., (*6)

  2. GloballyTrackable, (*7)

    A collection of other interfaces: Identifiable, Nameable, Timestampable, UniversallyIdentifiable., (*8)

  3. Identifiable, (*9)

    Adds an id() method that returns the primary identifier (int, string, object), (*10)

  4. IdentifiableWithTimestamps, (*11)

    A combination of Identifiable and Timestampable, (*12)

  5. Nameable, (*13)

    Adds a name() method that returns the entity name component., (*14)

  6. NumericallySortable, (*15)

    Adds an ordinal() and update method for adding a numerical sorting index to an entity., (*16)

  7. Publishable, (*17)

    Adds publish()/unpublish() for controlling if an Entity is "published". Uses the DateTime value object. publish/unpublish are not implemented as they should raise events when used., (*18)

  8. Stringable, (*19)

    Adds __toString() and a toString() method that will use try the following methods:, (*20)

    • displayAs()
    • title()
    • name()

    If none are present an empty string is returned., (*21)

  9. Timestampable, (*22)

    Adds createdAt()/updatedAt() methods. Not setters are not defined as the entity should update the updatedAt when it is changed through update calls and not rely on database behaviour., (*23)

  10. Trackable, (*24)

    A collection of other interfaces: Identifiable, Nameable, Timestampable, (*25)

  11. UniversallyIdentifiable, (*26)

    Adds a uuid() method that returns a Uuid value object., (*27)

  12. Versionable, (*28)

    Adds a version() and incrementVersion() methods for defining the current entity version. incrementVersion should be hooked in appropriate update methods when the entity is modified., (*29)

Utilities

  • EntityAccessor, (*30)

    Helper class for accessing property methods/properties. Intended to be used in unit tests only., (*31)

The Versions

18/10 2017

dev-master

9999999-dev

A set of behaviours and interfaces for use with entities

  Sources   Download

MIT

The Requires

 

ddd entities behaviours

18/10 2017

1.2.1

1.2.1.0

A set of behaviours and interfaces for use with entities

  Sources   Download

MIT

The Requires

 

ddd entities behaviours

02/09 2017

1.2.0

1.2.0.0

A set of behaviours and interfaces for use with entities

  Sources   Download

MIT

The Requires

 

ddd entities behaviours

28/07 2017

1.1.0

1.1.0.0

A set of behaviours and interfaces for use with entities

  Sources   Download

MIT

The Requires

 

ddd entities behaviours

13/07 2017

1.0.1

1.0.1.0

A set of behaviours and interfaces for use with entities

  Sources   Download

MIT

The Requires

 

ddd entities behaviours

13/07 2017

1.0.0

1.0.0.0

A set of behaviours and interfaces for use with entities

  Sources   Download

MIT

The Requires

 

ddd entities behaviours