mirror of
https://github.com/kevinveenbirkenbach/infinito.git
synced 2025-09-13 13:57:10 +02:00
Optimized REST API and tests
This commit is contained in:
@@ -10,20 +10,22 @@ use Symfony\Component\HttpFoundation\Request;
|
||||
*/
|
||||
final class ActionHttpMethodMap extends AbstractMap implements ActionHttpMethodMapInterface
|
||||
{
|
||||
/**
|
||||
* @var array
|
||||
*/
|
||||
const ACTION_HTTP_METHOD_MAP = [
|
||||
ActionType::READ => [
|
||||
Request::METHOD_GET,
|
||||
],
|
||||
ActionType::CREATE => [
|
||||
Request::METHOD_POST,
|
||||
Request::METHOD_GET,
|
||||
Request::METHOD_HEAD,
|
||||
],
|
||||
ActionType::UPDATE => [
|
||||
Request::METHOD_PUT,
|
||||
Request::METHOD_GET,
|
||||
Request::METHOD_PATCH,
|
||||
],
|
||||
ActionType::DELETE => [
|
||||
Request::METHOD_GET,
|
||||
Request::METHOD_DELETE,
|
||||
],
|
||||
ActionType::EXECUTE => [
|
||||
|
@@ -13,11 +13,11 @@ use Infinito\Entity\Source\AbstractSource;
|
||||
use Infinito\Exception\NotSetException;
|
||||
use Infinito\Repository\RepositoryInterface;
|
||||
use Infinito\Entity\Source\SourceInterface;
|
||||
use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
|
||||
use Infinito\Attribut\ClassAttribut;
|
||||
use Infinito\Exception\AllreadyDefinedException;
|
||||
use Infinito\Domain\RequestManagement\Right\RequestedRightInterface;
|
||||
use Infinito\Domain\RepositoryManagement\LayerRepositoryFactoryService;
|
||||
use Infinito\Exception\EntityNotFoundHttpException;
|
||||
|
||||
/**
|
||||
* @author kevinfrantz
|
||||
@@ -51,12 +51,12 @@ class RequestedEntity extends AbstractEntity implements RequestedEntityInterface
|
||||
/**
|
||||
* @param EntityInterface|null $entity
|
||||
*
|
||||
* @throws NotFoundHttpException
|
||||
* @throws EntityNotFoundHttpException
|
||||
*/
|
||||
private function validateLoadedEntity(?EntityInterface $entity): void
|
||||
{
|
||||
if (!$entity) {
|
||||
throw new NotFoundHttpException('Entity with {id:"'.$this->id.'",slug:"'.$this->slug.'"} not found');
|
||||
throw new EntityNotFoundHttpException('Entity with {id:"'.$this->id.'",slug:"'.$this->slug.'"} not found');
|
||||
}
|
||||
}
|
||||
|
||||
@@ -97,7 +97,7 @@ class RequestedEntity extends AbstractEntity implements RequestedEntityInterface
|
||||
}
|
||||
|
||||
/**
|
||||
* @throws NotFoundHttpException
|
||||
* @throws NotSetException
|
||||
*/
|
||||
private function validateLayerRepositoryFactoryService(): void
|
||||
{
|
||||
|
Reference in New Issue
Block a user