Declared setActionType as immutable for RequestedRight

This commit is contained in:
Kevin Frantz
2019-02-26 19:49:19 +01:00
parent 9d63f34a7b
commit 776a7fe282
3 changed files with 32 additions and 3 deletions

View File

@@ -31,12 +31,13 @@ final class LayerController extends AbstractAPIController
* ".{_format}",
* methods={"GET","POST"}
* )
*
* @todo Mayber create an own controller for sources, because they have some special logic!
*/
public function create(Request $request,MVCRoutineServiceInterface $mvcRoutineService, RequestedActionServiceInterface $requestedActionService, string $layer): Response
public function create(Request $request, MVCRoutineServiceInterface $mvcRoutineService, RequestedActionServiceInterface $requestedActionService, string $layer): Response
{
//Not implemented yet in MVC routine. This is just a draft!
if($request->query->has(ClassAttributInterface::CLASS_ATTRIBUT_NAME)){
if ($request->query->has(ClassAttributInterface::CLASS_ATTRIBUT_NAME)) {
$class = $request->query->get(ClassAttributInterface::CLASS_ATTRIBUT_NAME);
$requestedActionService->getRequestedEntity()->setClass($class);
}

View File

@@ -12,6 +12,7 @@ use Infinito\Entity\Meta\MetaInterface;
use Infinito\Exception\NotCorrectInstanceException;
use Infinito\Domain\RequestManagement\Entity\RequestedEntity;
use Infinito\Attribut\ActionTypeAttribut;
use Infinito\Exception\AllreadySetException;
/**
* @author kevinfrantz
@@ -20,7 +21,9 @@ use Infinito\Attribut\ActionTypeAttribut;
*/
class RequestedRight implements RequestedRightInterface
{
use ActionTypeAttribut, LayerAttribut, RecieverAttribut, RequestedEntityAttribut;
use LayerAttribut, RecieverAttribut, RequestedEntityAttribut, ActionTypeAttribut{
setActionType as private setActionTypeTrait;
}
/**
* @var SourceInterface
@@ -67,6 +70,20 @@ class RequestedRight implements RequestedRightInterface
}
}
/**
* This function declares the attribute actionType as inmutable
* {@inheritdoc}
*
* @see \Infinito\Attribut\ActionTypeAttributInterface::setActionType()
*/
public function setActionType(string $actionType): void
{
if (isset($this->actionType)) {
throw new AllreadySetException("The action type is allready set! Origine: $this->actionType New: $actionType");
}
$this->setActionTypeTrait($actionType);
}
/**
* Uses some kind of Lazy loading.
*