Optimized RequestManagement

This commit is contained in:
Kevin Frantz
2019-02-03 01:01:26 +01:00
parent bd2318ab5b
commit f3c2286a64
10 changed files with 109 additions and 23 deletions

View File

@@ -6,7 +6,8 @@ use App\Attribut\ActionTypeAttribut;
use App\DBAL\Types\ActionType;
use App\DBAL\Types\Meta\Right\CRUDType;
use App\Domain\RequestManagement\User\RequestedUser;
use App\Domain\RequestManagement\Right\RequestedRightInterface;
use App\Domain\RequestManagement\User\RequestedUserInterface;
use App\Domain\UserManagement\UserSourceDirectorInterface;
/**
* @author kevinfrantz
@@ -27,11 +28,13 @@ class RequestedAction extends RequestedUser implements RequestedActionInterface
];
/**
* @param RequestedRightInterface $requestedRight
* {@inheritdoc}
*
* @see \App\Domain\RequestManagement\User\RequestedUser::__construct()
*/
public function __construct(RequestedRightInterface $requestedRight)
public function __construct(UserSourceDirectorInterface $userSourceDirector, RequestedUserInterface $requestedUser)
{
$this->requestedRight = $requestedRight;
parent::__construct($userSourceDirector, $requestedUser);
}
/**

View File

@@ -2,7 +2,8 @@
namespace App\Domain\RequestManagement\Action;
use App\Domain\RequestManagement\Right\RequestedRightServiceInterface;
use App\Domain\RequestManagement\User\RequestedUserServiceInterface;
use App\Domain\UserManagement\UserSourceDirectorInterface;
/**
* @author kevinfrantz
@@ -10,10 +11,11 @@ use App\Domain\RequestManagement\Right\RequestedRightServiceInterface;
final class RequestedActionService extends RequestedAction implements RequestedActionServiceInterface
{
/**
* @param RequestedRightServiceInterface $requestedRightService
* @param UserSourceDirectorInterface $userSourceDirector
* @param RequestedUserServiceInterface $requestedUserService
*/
public function __construct(RequestedRightServiceInterface $requestedRightService)
public function __construct(UserSourceDirectorInterface $userSourceDirector, RequestedUserServiceInterface $requestedUserService)
{
parent::__construct($requestedRightService);
parent::__construct($userSourceDirector, $requestedUserService);
}
}

View File

@@ -9,6 +9,6 @@ namespace App\Domain\RequestManagement\Action;
*
* @author kevinfrantz
*/
interface RequestedActionServiceInterface
interface RequestedActionServiceInterface extends RequestedActionInterface
{
}

View File

@@ -3,10 +3,13 @@ The request management works with different layers.
### Layers
Each layer contains out of __2 classes__ and __2 interfaces__ for it.
One class contains the __logic__ and the other class contains the __service__. This makes the classes easier testable and mockable and follows the [SOLID Design Principles](https://en.wikipedia.org/wiki/SOLID). The layer order you can keep in mind with the acronym __RUAE__: __R__ight__U__ser__A__ction__E__ntity.
One class contains the __logic__ and the other class contains the __service__. This makes the classes easier testable and mockable and follows the [SOLID Design Principles](https://en.wikipedia.org/wiki/SOLID).
#### Right
This is the basic request layer from which the other layers inhiere.
#### User
#### Action
#### Entity
A **requested entity** contains the attributes to manage the entity which should be handled by an action
#### Right
This is the basic request layer from which the other layers inhiere. The relation from a **requested right** to a **requested entity** is 1:0,1
#### User
A **requested user** contains is a parent of **requested action**.
#### Action
A **requested action** contains inhieres from **requested user**.

View File

@@ -7,6 +7,6 @@ namespace App\Domain\RequestManagement\Right;
*
* @author kevinfrantz
*/
final class RequestedRightService extends RequestedRight
final class RequestedRightService extends RequestedRight implements RequestedRightServiceInterface
{
}

View File

@@ -3,9 +3,9 @@
namespace App\Domain\UserManagement;
use App\Entity\UserInterface;
use App\DBAL\Types\SystemSlugType;
use App\Entity\User;
use App\Repository\Source\SourceRepositoryInterface;
use App\Domain\FixtureManagement\FixtureSource\GuestUserFixtureSource;
/**
* @author kevinfrantz
@@ -33,7 +33,7 @@ final class UserSourceDirector implements UserSourceDirectorInterface
return;
}
$this->user = new User();
$this->user->setSource($this->sourceRepository->findOneBySlug(SystemSlugType::GUEST_USER));
$this->user->setSource($this->sourceRepository->findOneBySlug(GuestUserFixtureSource::getSlug()));
}
/**