Implemented AbstractRequestedRightFacade

This commit is contained in:
Kevin Frantz
2019-01-20 12:54:39 +01:00
parent cc491f5707
commit b2d50e3cfd
6 changed files with 213 additions and 79 deletions

View File

@@ -26,11 +26,6 @@ class RequestedAction extends RequestedUser implements RequestedActionInterface
ActionType::LIST => CRUDType::READ,
];
/**
* @var RequestedRightInterface
*/
private $requestedRight;
/**
* @param RequestedRightInterface $requestedRight
*/

View File

@@ -0,0 +1,117 @@
<?php
namespace App\Domain\RequestManagement\Right;
use App\Domain\RequestManagement\Entity\RequestedEntityInterface;
use App\Entity\Source\SourceInterface;
/**
* Offers a facade to wrapp a requested right.
*
* @author kevinfrantz
*/
abstract class AbstractRequestedRightFacade implements RequestedRightInterface
{
/**
* @var RequestedRightInterface
*/
protected $requestedRight;
/**
* @param RequestedRightInterface $requestedRight
*/
public function __construct(RequestedRightInterface $requestedRight)
{
$this->requestedRight = $requestedRight;
}
/**
* {@inheritdoc}
*
* @see \App\Attribut\RecieverAttributInterface::getReciever()
*/
public function getReciever(): SourceInterface
{
return $this->requestedRight->getReciever();
}
/**
* {@inheritdoc}
*
* @see \App\Attribut\LayerAttributInterface::setLayer()
*/
public function setLayer(string $layer): void
{
$this->requestedRight->setLayer($layer);
}
/**
* @deprecated
* {@inheritdoc}
* @see \App\Domain\RequestManagement\Right\RequestedRightInterface::getSource()
*/
public function getSource(): SourceInterface
{
return $this->requestedRight->getSource();
}
/**
* {@inheritdoc}
*
* @see \App\Attribut\LayerAttributInterface::getLayer()
*/
public function getLayer(): string
{
return $this->requestedRight->getLayer();
}
/**
* {@inheritdoc}
*
* @see \App\Attribut\RequestedEntityAttributInterface::setRequestedEntity()
*/
public function setRequestedEntity(RequestedEntityInterface $requestedEntity): void
{
$this->requestedRight->setRequestedEntity($requestedEntity);
}
/**
* {@inheritdoc}
*
* @see \App\Attribut\CrudAttributInterface::setCrud()
*/
public function setCrud(string $crud): void
{
$this->requestedRight->setCrud($crud);
}
/**
* {@inheritdoc}
*
* @see \App\Attribut\CrudAttributInterface::getCrud()
*/
public function getCrud(): string
{
return $this->requestedRight->getCrud();
}
/**
* {@inheritdoc}
*
* @see \App\Attribut\RequestedEntityAttributInterface::getRequestedEntity()
*/
public function getRequestedEntity(): RequestedEntityInterface
{
return $this->requestedRight->getRequestedEntity();
}
/**
* {@inheritdoc}
*
* @see \App\Attribut\RecieverAttributInterface::setReciever()
*/
public function setReciever(SourceInterface $reciever): void
{
$this->requestedRight->setReciever($reciever);
}
}

View File

@@ -10,6 +10,7 @@ use App\Exception\PreconditionFailedException;
use App\Exception\NotSetException;
use App\Repository\Source\SourceRepositoryInterface;
use App\Domain\RequestManagement\Entity\RequestedEntityInterface;
use App\Attribut\RequestedEntityAttribut;
/**
* @author kevinfrantz
@@ -18,7 +19,7 @@ use App\Domain\RequestManagement\Entity\RequestedEntityInterface;
*/
class RequestedRight implements RequestedRightInterface
{
use CrudAttribut, LayerAttribut, RecieverAttribut;
use CrudAttribut, LayerAttribut, RecieverAttribut, RequestedEntityAttribut;
/**
* @var SourceRepositoryInterface

View File

@@ -6,18 +6,13 @@ use App\Attribut\CrudAttributInterface;
use App\Attribut\RecieverAttributInterface;
use App\Attribut\LayerAttributInterface;
use App\Entity\Source\SourceInterface;
use App\Domain\RequestManagement\Entity\RequestedEntityInterface;
use App\Attribut\RequestedEntityAttributInterface;
/**
* @author kevinfrantz
*/
interface RequestedRightInterface extends CrudAttributInterface, RecieverAttributInterface, LayerAttributInterface
interface RequestedRightInterface extends CrudAttributInterface, RecieverAttributInterface, LayerAttributInterface, RequestedEntityAttributInterface
{
/**
* @param RequestedEntityInterface $requestedSource
*/
public function setRequestedEntity(RequestedEntityInterface $requestedSource): void;
/**
* {@inheritdoc}
*

View File

@@ -6,30 +6,25 @@ use App\Entity\Source\SourceInterface;
use App\Domain\UserManagement\UserSourceDirectorInterface;
use App\Exception\SetNotPossibleException;
use App\Domain\RequestManagement\Right\RequestedRightInterface;
use App\Domain\RequestManagement\Entity\RequestedEntityInterface;
use App\Domain\RequestManagement\Right\AbstractRequestedRightFacade;
/**
* @author kevinfrantz
*/
class RequestedUser implements RequestedUserInterface
class RequestedUser extends AbstractRequestedRightFacade implements RequestedUserInterface
{
/**
* @var UserSourceDirectorInterface
*/
private $userSourceDirector;
/**
* @var RequestedRightInterface
*/
private $requestedRight;
/**
* @param UserSourceDirectorInterface $userSourceDirector
*/
public function __construct(UserSourceDirectorInterface $userSourceDirector, RequestedRightInterface $requestedRight)
{
$this->userSourceDirector = $userSourceDirector;
$this->requestedRight = $requestedRight;
parent::__construct($requestedRight);
}
/**
@@ -51,62 +46,4 @@ class RequestedUser implements RequestedUserInterface
{
return $this->userSourceDirector->getUser()->getSource();
}
/**
* {@inheritdoc}
*
* @see \App\Attribut\LayerAttributInterface::setLayer()
*/
public function setLayer(string $layer): void
{
$this->requestedRight->setLayer($layer);
}
/**
* {@inheritdoc}
*
* @see \App\Attribut\CrudAttributInterface::getCrud()
*/
public function getCrud(): string
{
return $this->requestedRight->getCrud();
}
/**
* {@inheritdoc}
*
* @see \App\Attribut\LayerAttributInterface::getLayer()
*/
public function getLayer(): string
{
return $this->requestedRight->getLayer();
}
/**
* {@inheritdoc}
*
* @see \App\Attribut\SourceAttributInterface::getSource()
*/
public function getSource(): SourceInterface
{
return $this->requestedRight->getSource();
}
/**
* {@inheritdoc}
*
* @see \App\Attribut\CrudAttributInterface::setCrud()
*/
public function setCrud(string $type): void
{
$this->requestedRight->setCrud($type);
}
/**
* @param RequestedEntityInterface $requestedSource
*/
public function setRequestedEntity(RequestedEntityInterface $requestedSource): void
{
$this->requestedRight->setRequestedEntity($requestedSource);
}
}