beberlei/litecqrs-php — pull request #42 by mbadolato (2013-07-18 20:23:17+00:00)
Title: Add missing apply() method to Crud trait classes

The create() methods in the Plugin/CRUD/Crud* trait classes call out
to an apply method (which in turn calls the trait's applyResource*
methods), which does not exist in the trait class definition.

This means that the CRUD plugin cannot be used with entity objects
that extend DomainEventProvider, as that class doesn't provide an
apply method. Instead, Aggreagte Resource would need to be extended,
which extends AggregateRoot, which means the entity would no longer
have access to raise() events.

Since the Crud traits are near duplicate methods to versions in
CRUD/AggregateResource and AggregateRoot anyway, there's no point in
using the traits, when you could just extend AggregateResource instead.

But for when AggregateResource cannot be the extended class, the
traits are needed, therefore the entire call chain needs to be
available, so that we don't violate DRY by re-implementing apply() in
every Entity object that extends DomainEventProvider but needs the
create/update/delete crud traits