Skip to content

Commit

Permalink
Renaming and updating to standards
Browse files Browse the repository at this point in the history
  • Loading branch information
mattamon committed May 21, 2024
1 parent 55b911c commit 9e944ae
Show file tree
Hide file tree
Showing 14 changed files with 26 additions and 26 deletions.
6 changes: 3 additions & 3 deletions src/Workflow/ActionSubmitter/GlobalActionSubmitter.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
use Exception;
use Pimcore\Bundle\StudioBackendBundle\Exception\WorkflowActionNotFoundException;
use Pimcore\Bundle\StudioBackendBundle\Exception\WorkflowActionSubmissionException;
use Pimcore\Bundle\StudioBackendBundle\Workflow\Result\ActionSubmissionResult;
use Pimcore\Bundle\StudioBackendBundle\Workflow\Response\ActionSubmissionResponse;
use Pimcore\Bundle\StudioBackendBundle\Workflow\Schema\SubmitAction;
use Pimcore\Model\Element\ElementInterface;
use Pimcore\Workflow\Manager;
Expand All @@ -40,7 +40,7 @@ public function submit(
ElementInterface $element,
WorkflowInterface $workflow,
SubmitAction $parameters
): ActionSubmissionResult
): ActionSubmissionResponse
{
$workflowName = $parameters->getWorkflowName();
$actionName = $parameters->getTransition();
Expand All @@ -65,7 +65,7 @@ public function submit(
$globalAction->getSaveSubject()
);

return new ActionSubmissionResult(
return new ActionSubmissionResponse(
$workflowName,
$actionName,
$parameters->getActionType()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@

namespace Pimcore\Bundle\StudioBackendBundle\Workflow\ActionSubmitter;

use Pimcore\Bundle\StudioBackendBundle\Workflow\Result\ActionSubmissionResult;
use Pimcore\Bundle\StudioBackendBundle\Workflow\Response\ActionSubmissionResponse;
use Pimcore\Bundle\StudioBackendBundle\Workflow\Schema\SubmitAction;
use Pimcore\Model\Element\ElementInterface;
use Symfony\Component\Workflow\WorkflowInterface;
Expand All @@ -30,5 +30,5 @@ public function submit(
ElementInterface $element,
WorkflowInterface $workflow,
SubmitAction $parameters,
): ActionSubmissionResult;
): ActionSubmissionResponse;
}
6 changes: 3 additions & 3 deletions src/Workflow/ActionSubmitter/TransitionActionSubmitter.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
use Pimcore\Bundle\StudioBackendBundle\Exception\InvalidElementTypeException;
use Pimcore\Bundle\StudioBackendBundle\Exception\WorkflowActionNotAllowedException;
use Pimcore\Bundle\StudioBackendBundle\Exception\WorkflowActionSubmissionException;
use Pimcore\Bundle\StudioBackendBundle\Workflow\Result\ActionSubmissionResult;
use Pimcore\Bundle\StudioBackendBundle\Workflow\Response\ActionSubmissionResponse;
use Pimcore\Bundle\StudioBackendBundle\Workflow\Schema\SubmitAction;
use Pimcore\Model\Asset;
use Pimcore\Model\DataObject\Concrete;
Expand All @@ -44,7 +44,7 @@ public function submit(
ElementInterface $element,
WorkflowInterface $workflow,
SubmitAction $parameters,
): ActionSubmissionResult
): ActionSubmissionResponse
{
$element = $this->validateElementType($element);
$transitionName = $parameters->getTransition();
Expand All @@ -63,7 +63,7 @@ public function submit(
$parameters->getWorkflowOptions()
);

return new ActionSubmissionResult(
return new ActionSubmissionResponse(
$parameters->getWorkflowName(),
$transitionName,
$parameters->getActionType()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@

namespace Pimcore\Bundle\StudioBackendBundle\Workflow\ActionSubmitter;

use Pimcore\Bundle\StudioBackendBundle\Workflow\Result\ActionSubmissionResult;
use Pimcore\Bundle\StudioBackendBundle\Workflow\Response\ActionSubmissionResponse;
use Pimcore\Bundle\StudioBackendBundle\Workflow\Schema\SubmitAction;
use Pimcore\Model\Element\ElementInterface;
use Symfony\Component\Workflow\WorkflowInterface;
Expand All @@ -30,5 +30,5 @@ public function submit(
ElementInterface $element,
WorkflowInterface $workflow,
SubmitAction $parameters,
): ActionSubmissionResult;
): ActionSubmissionResponse;
}
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
* @license http://www.pimcore.org/license GPLv3 and PCL
*/

namespace Pimcore\Bundle\StudioBackendBundle\OpenApi\Attributes\Response\Content;
namespace Pimcore\Bundle\StudioBackendBundle\Workflow\Attributes\Response\Content;

use OpenApi\Attributes\JsonContent;
use OpenApi\Attributes\Property;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
* @license http://www.pimcore.org/license GPLv3 and PCL
*/

namespace Pimcore\Bundle\StudioBackendBundle\OpenApi\Attributes\Response\Property;
namespace Pimcore\Bundle\StudioBackendBundle\Workflow\Attributes\Response\Property;

use OpenApi\Attributes\Items;
use OpenApi\Attributes\Property;
Expand Down
6 changes: 3 additions & 3 deletions src/Workflow/Controller/DetailsCollectionController.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,11 +26,11 @@
use Pimcore\Bundle\StudioBackendBundle\OpenApi\Attributes\Response\Error\NotFoundResponse;
use Pimcore\Bundle\StudioBackendBundle\OpenApi\Attributes\Response\Error\UnauthorizedResponse;
use Pimcore\Bundle\StudioBackendBundle\OpenApi\Attributes\Response\Error\UnprocessableContentResponse;
use Pimcore\Bundle\StudioBackendBundle\OpenApi\Attributes\Response\Property\WorkflowDetailsCollection;
use Pimcore\Bundle\StudioBackendBundle\OpenApi\Attributes\Response\SuccessResponse;
use Pimcore\Bundle\StudioBackendBundle\OpenApi\Config\Tags;
use Pimcore\Bundle\StudioBackendBundle\Security\Service\SecurityServiceInterface;
use Pimcore\Bundle\StudioBackendBundle\Util\Traits\PaginatedResponseTrait;
use Pimcore\Bundle\StudioBackendBundle\Workflow\Attributes\Response\Property\WorkflowDetailsCollection;
use Pimcore\Bundle\StudioBackendBundle\Workflow\Request\WorkflowDetailsParameters;
use Pimcore\Bundle\StudioBackendBundle\Workflow\Service\WorkflowDetailsServiceInterface;
use Symfony\Component\HttpFoundation\JsonResponse;
Expand All @@ -55,7 +55,7 @@ public function __construct(

#[Route('/workflows/details', name: 'pimcore_studio_api_element_workflows_details', methods: ['GET'])]
//#[IsGranted('STUDIO_API')]
#[GET(
#[Get(
path: self::API_PATH . '/workflows/details',
operationId: 'getWorkflowsDetails',
description: 'Get details of the element workflows',
Expand All @@ -81,7 +81,7 @@ public function getDetails(#[MapQueryString] WorkflowDetailsParameters $paramete
{
$user = $this->securityService->getCurrentUser();
return $this->jsonResponse([
'items' => $this->workflowDetailsService->hydrateWorkflowDetails(
'items' => $this->workflowDetailsService->getWorkflowDetails(
$parameters,
$user
)
Expand Down
4 changes: 2 additions & 2 deletions src/Workflow/Controller/SubmitActionController.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@
use OpenApi\Attributes\Post;
use Pimcore\Bundle\StudioBackendBundle\Controller\AbstractApiController;
use Pimcore\Bundle\StudioBackendBundle\OpenApi\Attributes\Request\WorkflowActionRequestBody;
use Pimcore\Bundle\StudioBackendBundle\OpenApi\Attributes\Response\Content\WorkflowActionSubmissionJson;
use Pimcore\Bundle\StudioBackendBundle\OpenApi\Attributes\Response\Error\MethodNotAllowedResponse;
use Pimcore\Bundle\StudioBackendBundle\OpenApi\Attributes\Response\Error\NotFoundResponse;
use Pimcore\Bundle\StudioBackendBundle\OpenApi\Attributes\Response\Error\UnauthorizedResponse;
Expand All @@ -28,6 +27,7 @@
use Pimcore\Bundle\StudioBackendBundle\OpenApi\Attributes\Response\SuccessResponse;
use Pimcore\Bundle\StudioBackendBundle\OpenApi\Config\Tags;
use Pimcore\Bundle\StudioBackendBundle\Security\Service\SecurityServiceInterface;
use Pimcore\Bundle\StudioBackendBundle\Workflow\Attributes\Response\Content\WorkflowActionSubmissionJson;
use Pimcore\Bundle\StudioBackendBundle\Workflow\Schema\SubmitAction;
use Pimcore\Bundle\StudioBackendBundle\Workflow\Service\WorkflowActionServiceInterface;
use Symfony\Component\HttpFoundation\JsonResponse;
Expand All @@ -54,7 +54,7 @@ public function __construct(
methods: ['POST']
)]
//#[IsGranted('STUDIO_API')]
#[POST(
#[Post(
path: self::API_PATH . '/workflows/action',
operationId: 'submitWorkflowAction',
description: 'Submit action based on the workflow name, action name and action type',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,12 @@
* @license http://www.pimcore.org/license GPLv3 and PCL
*/

namespace Pimcore\Bundle\StudioBackendBundle\Workflow\Result;
namespace Pimcore\Bundle\StudioBackendBundle\Workflow\Response;

/**
* @internal
*/
final readonly class ActionSubmissionResult
final readonly class ActionSubmissionResponse
{
public function __construct(
private string $workflowName,
Expand Down
4 changes: 2 additions & 2 deletions src/Workflow/Service/WorkflowActionService.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
use Pimcore\Bundle\StudioBackendBundle\Security\Service\SecurityServiceInterface;
use Pimcore\Bundle\StudioBackendBundle\Util\Constants\ElementPermissions;
use Pimcore\Bundle\StudioBackendBundle\Util\Traits\ElementProviderTrait;
use Pimcore\Bundle\StudioBackendBundle\Workflow\Result\ActionSubmissionResult;
use Pimcore\Bundle\StudioBackendBundle\Workflow\Response\ActionSubmissionResponse;
use Pimcore\Bundle\StudioBackendBundle\Workflow\Schema\SubmitAction;
use Pimcore\Model\DataObject\Concrete;
use Pimcore\Model\DataObject\Folder;
Expand Down Expand Up @@ -55,7 +55,7 @@ public function __construct(
public function submitAction(
UserInterface $user,
SubmitAction $parameters
): ActionSubmissionResult
): ActionSubmissionResponse
{
$element = $this->getElement(
$this->serviceResolver,
Expand Down
4 changes: 2 additions & 2 deletions src/Workflow/Service/WorkflowActionServiceInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@

namespace Pimcore\Bundle\StudioBackendBundle\Workflow\Service;

use Pimcore\Bundle\StudioBackendBundle\Workflow\Result\ActionSubmissionResult;
use Pimcore\Bundle\StudioBackendBundle\Workflow\Response\ActionSubmissionResponse;
use Pimcore\Bundle\StudioBackendBundle\Workflow\Schema\SubmitAction;
use Pimcore\Model\DataObject\Concrete;
use Pimcore\Model\DataObject\Folder;
Expand All @@ -33,7 +33,7 @@ interface WorkflowActionServiceInterface
public function submitAction(
UserInterface $user,
SubmitAction $parameters
): ActionSubmissionResult;
): ActionSubmissionResponse;

public function enrichActionNotes(
Concrete|Folder $object,
Expand Down
2 changes: 1 addition & 1 deletion src/Workflow/Service/WorkflowDetailsService.php
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ public function __construct(
/**
* @return WorkflowDetails[]
*/
public function hydrateWorkflowDetails(
public function getWorkflowDetails(
WorkflowDetailsParameters $parameters,
UserInterface $user
): array
Expand Down
2 changes: 1 addition & 1 deletion src/Workflow/Service/WorkflowDetailsServiceInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ interface WorkflowDetailsServiceInterface
/**
* @return WorkflowDetails[]
*/
public function hydrateWorkflowDetails(
public function getWorkflowDetails(
WorkflowDetailsParameters $parameters,
UserInterface $user
): array;
Expand Down
2 changes: 1 addition & 1 deletion tests/Unit/Workflow/Service/WorkflowDetailsServiceTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ public function testHydrateWorkflowDetails(): void
$workflowDetailsService = $this->getWorkflowDetailsService();
$this->expectExceptionMessage('Element with ID 1 not found');
$this->expectException(ElementNotFoundException::class);
$workflowDetailsService->hydrateWorkflowDetails(
$workflowDetailsService->getWorkflowDetails(
$parameters,
$this->makeEmpty(UserInterface::class)
);
Expand Down

0 comments on commit 9e944ae

Please sign in to comment.