for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
/*
* This file is part of the Borobudur-Cqrs package.
*
* (c) Hexacodelabs <http://hexacodelabs.com>
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Borobudur\Cqrs;
use Borobudur\Cqrs\Exception\InvalidArgumentException;
/**
* @author Iqbal Maulana <[email protected]>
* @created 8/18/15
abstract class AbstractEntity implements EntityInterface
{
* @var AggregateRootInterface
protected $aggregateRoot;
* {@inheritdoc}
final public function setAggregateRoot(AggregateRootInterface $aggregateRoot)
if (null !== $this->aggregateRoot && $aggregateRoot !== $this->aggregateRoot) {
throw new InvalidArgumentException(sprintf(
'Aggregate root "%s" already registered on "%s".',
get_class($aggregateRoot),
get_called_class()
));
}
$this->aggregateRoot = $aggregateRoot;