Implemented injection of RequestedEntityService to RequestedRightService

This commit is contained in:
Kevin Frantz
2019-02-13 16:26:32 +01:00
parent 6563a9fb5a
commit aafde4c0f9
9 changed files with 408 additions and 337 deletions

File diff suppressed because it is too large Load Diff

Before

Width:  |  Height:  |  Size: 296 KiB

After

Width:  |  Height:  |  Size: 297 KiB

View File

@@ -11,6 +11,7 @@ use App\Domain\RequestManagement\Entity\RequestedEntityInterface;
use App\Attribut\RequestedEntityAttribut;
use App\Entity\Meta\MetaInterface;
use App\Exception\NotCorrectInstanceException;
use App\Domain\RequestManagement\Entity\RequestedEntity;
/**
* @author kevinfrantz
@@ -56,6 +57,16 @@ class RequestedRight implements RequestedRightInterface
throw new PreconditionFailedException(get_class($this->requestedEntity).' needs to have a defined attribut id or slug!');
}
/**
* @param RequestedEntity|null $requestedEntity
*/
public function __construct(?RequestedEntity $requestedEntity = null)
{
if ($requestedEntity) {
$this->setRequestedEntity($requestedEntity);
}
}
/**
* Uses some kind of Lazy loading.
*

View File

@@ -2,6 +2,8 @@
namespace App\Domain\RequestManagement\Right;
use App\Domain\RequestManagement\Entity\RequestedEntityServiceInterface;
/**
* Allows to use a right as a Service.
*
@@ -9,4 +11,11 @@ namespace App\Domain\RequestManagement\Right;
*/
final class RequestedRightService extends RequestedRight implements RequestedRightServiceInterface
{
/**
* @param RequestedEntityServiceInterface $requestedEntityService
*/
public function __construct(RequestedEntityServiceInterface $requestedEntityService)
{
parent::__construct($requestedEntityService);
}
}