Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
"php": "~8.3.0 || ~8.4.0",
"league/csv": "^9.22",
"nesbot/carbon": "^3.8.4",
"pimcore/static-resolver-bundle": "^3.4.0 || ^2026.1",
"pimcore/static-resolver-bundle": "^3.5.0 || ^2026.1",
"pimcore/generic-data-index-bundle": "^2.4.0 || ^2026.1",
"pimcore/pimcore": "^12.3 || ^2026.1",
"zircote/swagger-php": "^4.8 || ^5.0",
Expand Down
13 changes: 11 additions & 2 deletions config/class.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,11 @@ services:
Pimcore\Bundle\StudioBackendBundle\Class\Service\IdentifierServiceInterface:
class: Pimcore\Bundle\StudioBackendBundle\Class\Service\IdentifierService

Pimcore\Bundle\StudioBackendBundle\Class\Service\SelectOptionServiceInterface:
class: Pimcore\Bundle\StudioBackendBundle\Class\Service\SelectOptionService
Pimcore\Bundle\StudioBackendBundle\Class\Service\SelectOptions\TreeServiceInterface:
class: Pimcore\Bundle\StudioBackendBundle\Class\Service\SelectOptions\TreeService

Pimcore\Bundle\StudioBackendBundle\Class\Service\SelectOptions\SelectOptionServiceInterface:
class: Pimcore\Bundle\StudioBackendBundle\Class\Service\SelectOptions\SelectOptionService

Pimcore\Bundle\StudioBackendBundle\Class\Service\ClassDefinitionTreeServiceInterface:
class: Pimcore\Bundle\StudioBackendBundle\Class\Service\ClassDefinitionTreeService
Expand Down Expand Up @@ -72,6 +75,9 @@ services:
Pimcore\Bundle\StudioBackendBundle\Class\Repository\CustomLayoutRepositoryInterface:
class: Pimcore\Bundle\StudioBackendBundle\Class\Repository\CustomLayoutRepository

Pimcore\Bundle\StudioBackendBundle\Class\Repository\SelectOptionRepositoryInterface:
class: Pimcore\Bundle\StudioBackendBundle\Class\Repository\SelectOptionRepository

#
# Hydrators
#
Expand Down Expand Up @@ -146,3 +152,6 @@ services:

Pimcore\Bundle\StudioBackendBundle\Class\Hydrator\SelectOption\TreeFolderHydratorInterface:
class: Pimcore\Bundle\StudioBackendBundle\Class\Hydrator\SelectOption\TreeFolderHydrator

Pimcore\Bundle\StudioBackendBundle\Class\Hydrator\SelectOption\DetailHydratorInterface:
class: Pimcore\Bundle\StudioBackendBundle\Class\Hydrator\SelectOption\DetailHydrator
2 changes: 2 additions & 0 deletions doc/05_Additional_Custom_Attributes.md
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,9 @@ final class AssetEvent extends AbstractPreResponseEvent
- `pre_response.recycle_bin.item`
- `pre_response.role_tree_node`
- `pre_response.schedule`
- `pre_response.select_option.detail`
- `pre_response.select_option.tree`
- `pre_response.select_option.usage_item`
- `pre_response.settings.active_bundle`
- `pre_response.settings.available_country`
- `pre_response.simple_search.preview`
Expand Down
80 changes: 80 additions & 0 deletions src/Class/Controller/SelectOptions/CreateController.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
<?php
declare(strict_types=1);

/**
* This source file is available under the terms of the
* Pimcore Open Core License (POCL)
* Full copyright and license information is available in
* LICENSE.md which is distributed with this source code.
*
* @copyright Copyright (c) Pimcore GmbH (https://www.pimcore.com)
* @license Pimcore Open Core License (POCL)
*/

namespace Pimcore\Bundle\StudioBackendBundle\Class\Controller\SelectOptions;

use OpenApi\Attributes\JsonContent;
use OpenApi\Attributes\Post;
use Pimcore\Bundle\StudioBackendBundle\Class\MappedParameter\CreateSelectOptionParameters;
use Pimcore\Bundle\StudioBackendBundle\Class\Schema\SelectOption\CreateSelectOption;
use Pimcore\Bundle\StudioBackendBundle\Class\Schema\SelectOption\SelectOptionDetail;
use Pimcore\Bundle\StudioBackendBundle\Class\Service\SelectOptions\SelectOptionServiceInterface;
use Pimcore\Bundle\StudioBackendBundle\Controller\AbstractApiController;
use Pimcore\Bundle\StudioBackendBundle\Exception\Api\ElementExistsException;
use Pimcore\Bundle\StudioBackendBundle\Exception\Api\ElementSavingFailedException;
use Pimcore\Bundle\StudioBackendBundle\OpenApi\Attribute\Request\ReferenceRequestBody;
use Pimcore\Bundle\StudioBackendBundle\OpenApi\Attribute\Response\DefaultResponses;
use Pimcore\Bundle\StudioBackendBundle\OpenApi\Attribute\Response\SuccessResponse;
use Pimcore\Bundle\StudioBackendBundle\OpenApi\Config\Tags;
use Pimcore\Bundle\StudioBackendBundle\Util\Constant\HttpResponseCodes;
use Pimcore\Bundle\StudioBackendBundle\Util\Constant\UserPermissions;
use Symfony\Component\HttpFoundation\JsonResponse;
use Symfony\Component\HttpKernel\Attribute\MapRequestPayload;
use Symfony\Component\Routing\Attribute\Route;
use Symfony\Component\Security\Http\Attribute\IsGranted;
use Symfony\Component\Serializer\SerializerInterface;

/**
* @internal
*/
final class CreateController extends AbstractApiController
{
private const string ROUTE = '/class/select-option';

public function __construct(

Check notice on line 44 in src/Class/Controller/SelectOptions/CreateController.php

View check run for this annotation

Codacy Production / Codacy Static Code Analysis

src/Class/Controller/SelectOptions/CreateController.php#L44

Expected 2 blank lines before function; 1 found
SerializerInterface $serializer,
private readonly SelectOptionServiceInterface $selectOptionService,
) {
parent::__construct($serializer);
}

Check notice on line 49 in src/Class/Controller/SelectOptions/CreateController.php

View check run for this annotation

Codacy Production / Codacy Static Code Analysis

src/Class/Controller/SelectOptions/CreateController.php#L49

Expected 1 blank line before closing function brace; 0 found

Check notice on line 49 in src/Class/Controller/SelectOptions/CreateController.php

View check run for this annotation

Codacy Production / Codacy Static Code Analysis

src/Class/Controller/SelectOptions/CreateController.php#L49

Expected 2 blank lines after function; 1 found

/**
* @throws ElementExistsException|ElementSavingFailedException
*/
#[Route(self::ROUTE, name: 'pimcore_studio_api_class_select_option_create', methods: ['POST'])]
#[IsGranted(UserPermissions::SELECT_OPTIONS->value)]
#[Post(
path: self::PREFIX . self::ROUTE,
operationId: 'class_select_option_create',
description: 'class_select_option_create_description',
summary: 'class_select_option_create_summary',
tags: [Tags::ClassDefinition->value],
)]
#[ReferenceRequestBody(CreateSelectOption::class)]
#[SuccessResponse(
description: 'class_select_option_create_success_response',
content: new JsonContent(ref: SelectOptionDetail::class)
)]
#[DefaultResponses([
HttpResponseCodes::CONFLICT,
HttpResponseCodes::INTERNAL_SERVER_ERROR,
HttpResponseCodes::UNAUTHORIZED,
])]
public function createSelectOption(
#[MapRequestPayload] CreateSelectOptionParameters $parameters,
): JsonResponse {
return $this->jsonResponse(
$this->selectOptionService->createSelectOption($parameters)
);
}
}
82 changes: 82 additions & 0 deletions src/Class/Controller/SelectOptions/DeleteController.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
<?php
declare(strict_types=1);

/**
* This source file is available under the terms of the
* Pimcore Open Core License (POCL)
* Full copyright and license information is available in
* LICENSE.md which is distributed with this source code.
*
* @copyright Copyright (c) Pimcore GmbH (https://www.pimcore.com)
* @license Pimcore Open Core License (POCL)
*/

namespace Pimcore\Bundle\StudioBackendBundle\Class\Controller\SelectOptions;

use OpenApi\Attributes\Delete;
use Pimcore\Bundle\StudioBackendBundle\Class\Service\SelectOptions\SelectOptionServiceInterface;
use Pimcore\Bundle\StudioBackendBundle\Controller\AbstractApiController;
use Pimcore\Bundle\StudioBackendBundle\Exception\Api\ConflictException;
use Pimcore\Bundle\StudioBackendBundle\Exception\Api\ForbiddenException;
use Pimcore\Bundle\StudioBackendBundle\Exception\Api\NotFoundException;
use Pimcore\Bundle\StudioBackendBundle\Exception\Api\NotWriteableException;
use Pimcore\Bundle\StudioBackendBundle\OpenApi\Attribute\Parameter\Path\StringParameter;
use Pimcore\Bundle\StudioBackendBundle\OpenApi\Attribute\Response\DefaultResponses;
use Pimcore\Bundle\StudioBackendBundle\OpenApi\Attribute\Response\SuccessResponse;
use Pimcore\Bundle\StudioBackendBundle\OpenApi\Config\Tags;
use Pimcore\Bundle\StudioBackendBundle\Util\Constant\HttpResponseCodes;
use Pimcore\Bundle\StudioBackendBundle\Util\Constant\UserPermissions;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\Routing\Attribute\Route;
use Symfony\Component\Security\Http\Attribute\IsGranted;
use Symfony\Component\Serializer\SerializerInterface;

/**
* @internal
*/
final class DeleteController extends AbstractApiController
{
private const string ROUTE = '/class/select-option/{id}';

public function __construct(

Check notice on line 41 in src/Class/Controller/SelectOptions/DeleteController.php

View check run for this annotation

Codacy Production / Codacy Static Code Analysis

src/Class/Controller/SelectOptions/DeleteController.php#L41

Expected 2 blank lines before function; 1 found
SerializerInterface $serializer,
private readonly SelectOptionServiceInterface $selectOptionService,
) {
parent::__construct($serializer);
}

Check notice on line 46 in src/Class/Controller/SelectOptions/DeleteController.php

View check run for this annotation

Codacy Production / Codacy Static Code Analysis

src/Class/Controller/SelectOptions/DeleteController.php#L46

Expected 1 blank line before closing function brace; 0 found

Check notice on line 46 in src/Class/Controller/SelectOptions/DeleteController.php

View check run for this annotation

Codacy Production / Codacy Static Code Analysis

src/Class/Controller/SelectOptions/DeleteController.php#L46

Expected 2 blank lines after function; 1 found

/**
* @throws ConflictException|ForbiddenException|NotFoundException|NotWriteableException
*/
#[Route(self::ROUTE, name: 'pimcore_studio_api_class_select_option_delete', methods: ['DELETE'])]
#[IsGranted(UserPermissions::SELECT_OPTIONS->value)]
#[Delete(
path: self::PREFIX . self::ROUTE,
operationId: 'class_select_option_delete',
description: 'class_select_option_delete_description',
summary: 'class_select_option_delete_summary',
tags: [Tags::ClassDefinition->value],
)]
#[StringParameter(
name: 'id',
example: 'EventStatus',
description: 'Select option configuration ID',
required: true
)]
#[SuccessResponse(
description: 'class_select_option_delete_success_response'
)]
#[DefaultResponses([
HttpResponseCodes::CONFLICT,
HttpResponseCodes::FORBIDDEN,
HttpResponseCodes::INTERNAL_SERVER_ERROR,
HttpResponseCodes::NOT_FOUND,
HttpResponseCodes::UNAUTHORIZED,
])]
public function deleteSelectOption(string $id): Response
{
$this->selectOptionService->deleteSelectOption($id);

return new Response();
}
}
79 changes: 79 additions & 0 deletions src/Class/Controller/SelectOptions/GetController.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
<?php
declare(strict_types=1);

/**
* This source file is available under the terms of the
* Pimcore Open Core License (POCL)
* Full copyright and license information is available in
* LICENSE.md which is distributed with this source code.
*
* @copyright Copyright (c) Pimcore GmbH (https://www.pimcore.com)
* @license Pimcore Open Core License (POCL)
*/

namespace Pimcore\Bundle\StudioBackendBundle\Class\Controller\SelectOptions;

use OpenApi\Attributes\Get;
use OpenApi\Attributes\JsonContent;
use Pimcore\Bundle\StudioBackendBundle\Class\Schema\SelectOption\SelectOptionDetail;
use Pimcore\Bundle\StudioBackendBundle\Class\Service\SelectOptions\SelectOptionServiceInterface;
use Pimcore\Bundle\StudioBackendBundle\Controller\AbstractApiController;
use Pimcore\Bundle\StudioBackendBundle\Exception\Api\NotFoundException;
use Pimcore\Bundle\StudioBackendBundle\OpenApi\Attribute\Parameter\Path\StringParameter;
use Pimcore\Bundle\StudioBackendBundle\OpenApi\Attribute\Response\DefaultResponses;
use Pimcore\Bundle\StudioBackendBundle\OpenApi\Attribute\Response\SuccessResponse;
use Pimcore\Bundle\StudioBackendBundle\OpenApi\Config\Tags;
use Pimcore\Bundle\StudioBackendBundle\Util\Constant\HttpResponseCodes;
use Pimcore\Bundle\StudioBackendBundle\Util\Constant\UserPermissions;
use Symfony\Component\HttpFoundation\JsonResponse;
use Symfony\Component\Routing\Attribute\Route;
use Symfony\Component\Security\Http\Attribute\IsGranted;
use Symfony\Component\Serializer\SerializerInterface;

/**
* @internal
*/
final class GetController extends AbstractApiController
{
private const string ROUTE = '/class/select-option/{id}';

public function __construct(

Check notice on line 40 in src/Class/Controller/SelectOptions/GetController.php

View check run for this annotation

Codacy Production / Codacy Static Code Analysis

src/Class/Controller/SelectOptions/GetController.php#L40

Expected 2 blank lines before function; 1 found
SerializerInterface $serializer,
private readonly SelectOptionServiceInterface $selectOptionService,
) {
parent::__construct($serializer);
}

Check notice on line 45 in src/Class/Controller/SelectOptions/GetController.php

View check run for this annotation

Codacy Production / Codacy Static Code Analysis

src/Class/Controller/SelectOptions/GetController.php#L45

Expected 1 blank line before closing function brace; 0 found

Check notice on line 45 in src/Class/Controller/SelectOptions/GetController.php

View check run for this annotation

Codacy Production / Codacy Static Code Analysis

src/Class/Controller/SelectOptions/GetController.php#L45

Expected 2 blank lines after function; 1 found

/**
* @throws NotFoundException
*/
#[Route(self::ROUTE, name: 'pimcore_studio_api_class_select_option_get', methods: ['GET'])]
#[IsGranted(UserPermissions::SELECT_OPTIONS->value)]
#[Get(
path: self::PREFIX . self::ROUTE,
operationId: 'class_select_option_get',
description: 'class_select_option_get_description',
summary: 'class_select_option_get_summary',
tags: [Tags::ClassDefinition->value],
)]
#[StringParameter(
name: 'id',
example: 'EventStatus',
description: 'Select option configuration ID',
required: true
)]
#[SuccessResponse(
description: 'class_select_option_get_success_response',
content: new JsonContent(ref: SelectOptionDetail::class)
)]
#[DefaultResponses([
HttpResponseCodes::NOT_FOUND,
HttpResponseCodes::UNAUTHORIZED,
])]
public function getSelectOption(string $id): JsonResponse
{
return $this->jsonResponse(
$this->selectOptionService->getSelectOption($id)
);
}
}
6 changes: 3 additions & 3 deletions src/Class/Controller/SelectOptions/TreeController.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
use OpenApi\Attributes\Get;
use Pimcore\Bundle\StudioBackendBundle\Class\Attribute\Response\Property\AnyOfSelectOptionNodes;
use Pimcore\Bundle\StudioBackendBundle\Class\MappedParameter\TreeParameter;
use Pimcore\Bundle\StudioBackendBundle\Class\Service\SelectOptionServiceInterface;
use Pimcore\Bundle\StudioBackendBundle\Class\Service\SelectOptions\TreeServiceInterface;
use Pimcore\Bundle\StudioBackendBundle\Controller\AbstractApiController;
use Pimcore\Bundle\StudioBackendBundle\OpenApi\Attribute\Parameter\Query\BoolParameter;
use Pimcore\Bundle\StudioBackendBundle\OpenApi\Attribute\Response\Content\CollectionJson;
Expand Down Expand Up @@ -44,12 +44,12 @@ final class TreeController extends AbstractApiController

public function __construct(
SerializerInterface $serializer,
private readonly SelectOptionServiceInterface $optionService,
private readonly TreeServiceInterface $optionService,
) {
parent::__construct($serializer);
}

#[Route(self::ROUTE, name: 'pimcore_studio_api_class_select_option_tree', methods: ['GET'])]
#[Route(self::ROUTE, name: 'pimcore_studio_api_class_select_option_tree', methods: ['GET'], priority: 10)]
#[IsGranted(UserPermissions::SELECT_OPTIONS->value)]
#[Get(
path: self::PREFIX . self::ROUTE,
Expand Down
Loading
Loading