You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
namespace Entity;
interface Snapshotter
{
public function restoreToSnapshot(Entity $entity) : ?Entity;
public function takeSnapshot(Entity $entity) : void;
}
and
namespace Entity\AggregateRoot;
interface Snapshotter
{
public function restoreToSnapshot(AggregateRoot $aggregate) : ?AggregateRoot;
public function takeSnapshot(AggregateRoot $aggregate) : void;
}
class EntitySnapshotterAdapter implements AggregateRoot\Snapshotter
{
private $snapshotter;
public function __construct(Entity\Snapshotter $snasphotter)
{
$this->snapshotter = $snapshotter;
}
public function restoreToSnapshot(AggregateRoot $aggregate) : ?AggregateRoot
{
return $this->snapshotter->restoreToSnapshot($aggregate);
}
public function takeSnapshot(AggregateRoot $aggregate) : void
{
$this->snapshotter->takeSnapshot($aggregate);
}
}
Just an idea - needs some refinement.
The text was updated successfully, but these errors were encountered:
alanbem
changed the title
make snapshotter generic...
make snapshotter generic and add adapter for aggregate root
Jul 20, 2019
e.g.
and
Just an idea - needs some refinement.
The text was updated successfully, but these errors were encountered: