mirror of
https://github.com/kevinveenbirkenbach/infinito.git
synced 2025-09-13 13:57:10 +02:00
Implemented draft for CRUD management
This commit is contained in:
@@ -0,0 +1,11 @@
|
||||
<?php
|
||||
|
||||
namespace App\Domain\SecureCRUDManagement;
|
||||
|
||||
/**
|
||||
* @author kevinfrantz
|
||||
* @todo Implement!
|
||||
*/
|
||||
abstract class AbstractSecureCRUD implements SecureCRUDInterface
|
||||
{
|
||||
}
|
@@ -0,0 +1,11 @@
|
||||
<?php
|
||||
|
||||
namespace App\Domain\SecureCRUDManagement\Create;
|
||||
|
||||
/**
|
||||
* @author kevinfrantz
|
||||
* @todo Implement!
|
||||
*/
|
||||
abstract class AbstractSecureCreator implements SecureCreatorInterface
|
||||
{
|
||||
}
|
@@ -0,0 +1,19 @@
|
||||
<?php
|
||||
|
||||
namespace App\Domain\SecureCRUDManagement\Create;
|
||||
|
||||
use App\Domain\SecureCRUDManagement\SecureCRUDInterface;
|
||||
use App\Entity\EntityInterface;
|
||||
|
||||
/**
|
||||
* @todo Implement!
|
||||
* @author kevinfrantz
|
||||
*
|
||||
*/
|
||||
interface SecureCreatorInterface extends SecureCRUDInterface
|
||||
{
|
||||
/**
|
||||
* @return EntityInterface The created entity
|
||||
*/
|
||||
public function create(): EntityInterface;
|
||||
}
|
@@ -0,0 +1,28 @@
|
||||
<?php
|
||||
|
||||
namespace App\Domain\SecureCRUDManagement\Create;
|
||||
|
||||
use App\Entity\EntityInterface;
|
||||
use Symfony\Component\HttpFoundation\Request;
|
||||
use Symfony\Component\Security\Core\Security;
|
||||
use App\Entity\Source\Primitive\Text\TextSource;
|
||||
|
||||
/**
|
||||
* @author kevinfrantz
|
||||
*
|
||||
* @todo Implement!
|
||||
*/
|
||||
class SecureSourceCreator extends AbstractSecureCreator implements SecureSourceCreatorInterface
|
||||
{
|
||||
public function __construct(Request $request, Security $security)
|
||||
{
|
||||
}
|
||||
|
||||
public function create(): EntityInterface
|
||||
{
|
||||
$source = new TextSource();
|
||||
$source->setText('Hello World!');
|
||||
|
||||
return $source;
|
||||
}
|
||||
}
|
@@ -0,0 +1,11 @@
|
||||
<?php
|
||||
|
||||
namespace App\Domain\SecureCRUDManagement\Create;
|
||||
|
||||
/**
|
||||
* @author kevinfrantz
|
||||
* @todo Implement!
|
||||
*/
|
||||
interface SecureSourceCreatorInterface extends SecureCreatorInterface
|
||||
{
|
||||
}
|
@@ -0,0 +1,42 @@
|
||||
<?php
|
||||
|
||||
namespace App\Domain\SecureCRUDManagement;
|
||||
|
||||
use App\Entity\Meta\RightInterface;
|
||||
use App\Domain\SecureCRUDManagement\Create\SecureSourceCreator;
|
||||
use Symfony\Component\HttpFoundation\Request;
|
||||
use Symfony\Component\Security\Core\Security;
|
||||
use Symfony\Component\HttpFoundation\RequestStack;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author kevinfrantz
|
||||
* @todo Implement!
|
||||
* @todo substitute through child classes!
|
||||
*/
|
||||
class SecureCRUDFactoryService
|
||||
{
|
||||
/**
|
||||
* @var Request
|
||||
*/
|
||||
private $request;
|
||||
|
||||
/**
|
||||
* @var Security
|
||||
*/
|
||||
private $security;
|
||||
|
||||
public function __construct(RequestStack $requestStack, Security $security)
|
||||
{
|
||||
$this->request = $requestStack->getCurrentRequest();
|
||||
$this->security = $security;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param RightInterface $requestedRight
|
||||
*/
|
||||
public function create(?RightInterface $requestedRight = null)
|
||||
{
|
||||
return new SecureSourceCreator($this->request, $this->security);
|
||||
}
|
||||
}
|
@@ -0,0 +1,12 @@
|
||||
<?php
|
||||
|
||||
namespace App\Domain\SecureCRUDManagement;
|
||||
|
||||
/**
|
||||
* @todo Implement!
|
||||
* @author kevinfrantz
|
||||
*
|
||||
*/
|
||||
interface SecureCRUDInterface
|
||||
{
|
||||
}
|
Reference in New Issue
Block a user