mirror of
https://github.com/kevinveenbirkenbach/infinito.git
synced 2025-09-13 13:57:10 +02:00
Solved function tests
This commit is contained in:
@@ -33,8 +33,9 @@ final class ActionsResultsDAOService extends AbstractActionsDAO implements Actio
|
||||
private function isValidActionData(string $actionType, $data): bool
|
||||
{
|
||||
switch ($actionType) {
|
||||
case ActionType::READ:
|
||||
case ActionType::CREATE:
|
||||
return $data instanceof EntityInterface | null === $data;
|
||||
case ActionType::READ:
|
||||
case ActionType::UPDATE:
|
||||
return $data instanceof EntityInterface;
|
||||
case ActionType::DELETE:
|
||||
|
@@ -4,6 +4,8 @@ namespace Infinito\Domain\DataAccessManagement;
|
||||
|
||||
use Doctrine\Common\Collections\Collection;
|
||||
use Doctrine\Common\Collections\ArrayCollection;
|
||||
use Infinito\Domain\FormManagement\RequestedActionFormBuilderServiceInterface;
|
||||
use Infinito\DBAL\Types\ActionType;
|
||||
|
||||
/**
|
||||
* @author kevinfrantz
|
||||
@@ -15,12 +17,18 @@ final class ActionsViewsDAOService extends AbstractActionsDAO implements Actions
|
||||
*/
|
||||
private $actionsResultsDAO;
|
||||
|
||||
/**
|
||||
* @var RequestedActionFormBuilderServiceInterface
|
||||
*/
|
||||
private $requestedActionFormBuilderService;
|
||||
|
||||
/**
|
||||
* @param ActionsResultsDAOServiceInterface $actionsResultsDAO
|
||||
*/
|
||||
public function __construct(ActionsResultsDAOServiceInterface $actionsResultsDAO)
|
||||
public function __construct(ActionsResultsDAOServiceInterface $actionsResultsDAO, RequestedActionFormBuilderServiceInterface $requestedActionFormBuilderService)
|
||||
{
|
||||
$this->actionsResultsDAO = $actionsResultsDAO;
|
||||
$this->requestedActionFormBuilderService = $requestedActionFormBuilderService;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -50,6 +58,13 @@ final class ActionsViewsDAOService extends AbstractActionsDAO implements Actions
|
||||
return $storedData;
|
||||
}
|
||||
|
||||
private function getCreateForm()
|
||||
{
|
||||
return $this->requestedActionFormBuilderService->createByService()
|
||||
->getForm()
|
||||
->createView();
|
||||
}
|
||||
|
||||
/**
|
||||
* @todo Implement the mapping
|
||||
* {@inheritdoc}
|
||||
@@ -58,6 +73,11 @@ final class ActionsViewsDAOService extends AbstractActionsDAO implements Actions
|
||||
*/
|
||||
public function getData(string $actionType)
|
||||
{
|
||||
switch ($actionType) {
|
||||
case ActionType::CREATE:
|
||||
return $this->getCreateForm();
|
||||
}
|
||||
|
||||
return $this->actionsResultsDAO->getData($actionType);
|
||||
}
|
||||
}
|
||||
|
@@ -90,11 +90,8 @@ final class ProcessService implements ProcessServiceInterface
|
||||
} else {
|
||||
// @todo move to view
|
||||
// CREATE
|
||||
//$this->requestedActionService->getRequestedEntity()->setClass(TextSource::class);
|
||||
// $updateForm = $this->requestedActionFormBuilderService->createByService()
|
||||
// ->getForm()
|
||||
// ->createView();
|
||||
//$this->actionsResultsDAOService->setData(ActionType::CREATE, $updateForm);
|
||||
$this->requestedActionService->getRequestedEntity()->setClass(TextSource::class);
|
||||
$this->actionsResultsDAOService->setData(ActionType::CREATE, null);
|
||||
}
|
||||
|
||||
return $this->actionsResultsDAOService;
|
||||
|
@@ -3,7 +3,6 @@
|
||||
namespace Infinito\Domain\ViewManagement;
|
||||
|
||||
use FOS\RestBundle\View\View;
|
||||
use Infinito\Domain\RequestManagement\Action\RequestedActionInterface;
|
||||
use Infinito\Domain\ActionManagement\ActionServiceInterface;
|
||||
use Infinito\Domain\ActionManagement\ActionFactoryServiceInterface;
|
||||
use Infinito\Domain\TemplateManagement\TemplateNameServiceInterface;
|
||||
@@ -33,7 +32,7 @@ final class ViewBuilder implements ViewBuilderInterface
|
||||
private $view;
|
||||
|
||||
/**
|
||||
* @var RequestedActionInterface
|
||||
* @var ActionServiceInterface
|
||||
*/
|
||||
private $actionService;
|
||||
|
||||
@@ -91,8 +90,10 @@ final class ViewBuilder implements ViewBuilderInterface
|
||||
}
|
||||
|
||||
/**
|
||||
* @param ActionServiceInterface $actionService
|
||||
* @param ActionFactoryServiceInterface $actionFactoryService
|
||||
* @param ActionServiceInterface $actionService
|
||||
* @param ActionFactoryServiceInterface $actionFactoryService
|
||||
* @param TemplateNameServiceInterface $templateNameService
|
||||
* @param ValidGetParameterServiceInterface $validGetParameterService
|
||||
*/
|
||||
public function __construct(ActionServiceInterface $actionService, ActionFactoryServiceInterface $actionFactoryService, TemplateNameServiceInterface $templateNameService, ValidGetParameterServiceInterface $validGetParameterService)
|
||||
{
|
||||
@@ -108,6 +109,7 @@ final class ViewBuilder implements ViewBuilderInterface
|
||||
public function getView(): View
|
||||
{
|
||||
$template = $this->getTemplate();
|
||||
|
||||
$this->view->setTemplate($template);
|
||||
|
||||
return $this->view;
|
||||
|
Reference in New Issue
Block a user