mirror of
https://github.com/kevinveenbirkenbach/infinito.git
synced 2025-04-16 10:16:22 +02:00
Refactored code
This commit is contained in:
parent
504f1e14ee
commit
88ce800478
@ -8,6 +8,7 @@ use Infinito\Domain\ActionManagement\ActionHandlerServiceInterface;
|
|||||||
use Infinito\Entity\Source\Primitive\Text\TextSource;
|
use Infinito\Entity\Source\Primitive\Text\TextSource;
|
||||||
use Infinito\Domain\DataAccessManagement\ActionsResultsDAOServiceInterface;
|
use Infinito\Domain\DataAccessManagement\ActionsResultsDAOServiceInterface;
|
||||||
use Infinito\Domain\ParameterManagement\ValidGetParameterServiceInterface;
|
use Infinito\Domain\ParameterManagement\ValidGetParameterServiceInterface;
|
||||||
|
use Symfony\Component\Finder\Exception\AccessDeniedException;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author kevinfrantz
|
* @author kevinfrantz
|
||||||
@ -54,6 +55,26 @@ final class ProcessService implements ProcessServiceInterface
|
|||||||
$this->validGetParameterService = $validGetParameterService;
|
$this->validGetParameterService = $validGetParameterService;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return mixed|null
|
||||||
|
*
|
||||||
|
* @throws AccessDeniedException
|
||||||
|
*/
|
||||||
|
private function getResult()
|
||||||
|
{
|
||||||
|
if ($this->requestedActionService->hasRequestedEntity() && $this->requestedActionService->getRequestedEntity()->hasIdentity()) {
|
||||||
|
// READ UPDATE DELETE EXECUTE
|
||||||
|
if ($this->secureRequestedRightCheckerService->check($this->requestedActionService)) {
|
||||||
|
return $this->actionHandlerService->handle();
|
||||||
|
}
|
||||||
|
throw new AccessDeniedException("The user doesn't have the permission to access this page!");
|
||||||
|
}
|
||||||
|
// CREATE
|
||||||
|
$this->requestedActionService->getRequestedEntity()->setClass(TextSource::class);
|
||||||
|
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @todo Move
|
* @todo Move
|
||||||
* {@inheritdoc}
|
* {@inheritdoc}
|
||||||
@ -62,17 +83,8 @@ final class ProcessService implements ProcessServiceInterface
|
|||||||
*/
|
*/
|
||||||
public function process()
|
public function process()
|
||||||
{
|
{
|
||||||
$result = null;
|
$result = $this->getResult();
|
||||||
$actionType = $this->requestedActionService->getActionType();
|
$actionType = $this->requestedActionService->getActionType();
|
||||||
if ($this->requestedActionService->hasRequestedEntity() && $this->requestedActionService->getRequestedEntity()->hasIdentity()) {
|
|
||||||
// READ UPDATE DELETE EXECUTE
|
|
||||||
if ($this->secureRequestedRightCheckerService->check($this->requestedActionService)) {
|
|
||||||
$result = $this->actionHandlerService->handle();
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
// CREATE
|
|
||||||
$this->requestedActionService->getRequestedEntity()->setClass(TextSource::class);
|
|
||||||
}
|
|
||||||
$this->actionsResultsDAOService->setData($actionType, $result);
|
$this->actionsResultsDAOService->setData($actionType, $result);
|
||||||
|
|
||||||
return $this->actionsResultsDAOService;
|
return $this->actionsResultsDAOService;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user