Skip to content

Commit dfd0e26

Browse files
Merge branch '2026.1' into 2026.x
2 parents d708e4c + cc1baee commit dfd0e26

19 files changed

Lines changed: 435 additions & 0 deletions

src/Entity/Search/SavedSearchConfiguration.php

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,9 @@ class SavedSearchConfiguration implements ShareableConfigurationInterface
5353
#[ORM\Column(type: 'boolean')]
5454
private bool $createMenuShortcut = false;
5555

56+
#[ORM\Column(type: 'string', length: 255, nullable: true)]
57+
private ?string $menuShortcutGroup = null;
58+
5659
#[ORM\Column(name: 'columns', type: 'json')]
5760
private array $columns = [];
5861

@@ -108,6 +111,11 @@ public function isCreateMenuShortcut(): bool
108111
return $this->createMenuShortcut;
109112
}
110113

114+
public function getMenuShortcutGroup(): ?string
115+
{
116+
return $this->menuShortcutGroup;
117+
}
118+
111119
public function getColumns(): array
112120
{
113121
return $this->columns;
@@ -163,6 +171,11 @@ public function setCreateMenuShortcut(bool $createMenuShortcut): void
163171
$this->createMenuShortcut = $createMenuShortcut;
164172
}
165173

174+
public function setMenuShortcutGroup(?string $menuShortcutGroup): void
175+
{
176+
$this->menuShortcutGroup = $menuShortcutGroup;
177+
}
178+
166179
public function setColumns(array $columns): void
167180
{
168181
$this->columns = $columns;

src/Installer.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -288,6 +288,7 @@ public function createSavedSearchConfigurationTable(Schema $schema): void
288288
$table->addColumn('classId', 'string', ['notnull' => false, 'length' => 50]);
289289
$table->addColumn('shareGlobal', 'boolean', ['notnull' => true]);
290290
$table->addColumn('createMenuShortcut', 'boolean', ['notnull' => true]);
291+
$table->addColumn('menuShortcutGroup', 'string', ['notnull' => false, 'length' => 255]);
291292
$table->addColumn('columns', 'json', ['notnull' => true]);
292293
$table->addColumn('filter', 'json', ['notnull' => false]);
293294
$table->addColumn('creationDate', 'datetime', ['notnull' => true]);
Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
<?php
2+
3+
declare(strict_types=1);
4+
5+
/**
6+
* This source file is available under the terms of the
7+
* Pimcore Open Core License (POCL)
8+
* Full copyright and license information is available in
9+
* LICENSE.md which is distributed with this source code.
10+
*
11+
* @copyright Copyright (c) Pimcore GmbH (https://www.pimcore.com)
12+
* @license Pimcore Open Core License (POCL)
13+
*/
14+
15+
namespace Pimcore\Bundle\StudioBackendBundle\Migrations;
16+
17+
use Doctrine\DBAL\Schema\Schema;
18+
use Doctrine\Migrations\AbstractMigration;
19+
use Pimcore\Bundle\StudioBackendBundle\Entity\Search\SavedSearchConfiguration;
20+
21+
/**
22+
* @internal
23+
*/
24+
final class Version20260624084904 extends AbstractMigration
25+
{
26+
public function getDescription(): string
27+
{
28+
return 'Add menuShortcutGroup column to the saved search configuration table';
29+
}
30+
31+
public function up(Schema $schema): void
32+
{
33+
if (!$schema->hasTable(SavedSearchConfiguration::TABLE_NAME)) {
34+
return;
35+
}
36+
37+
$table = $schema->getTable(SavedSearchConfiguration::TABLE_NAME);
38+
if (!$table->hasColumn('menuShortcutGroup')) {
39+
$table->addColumn('menuShortcutGroup', 'string', ['notnull' => false, 'length' => 255]);
40+
}
41+
}
42+
43+
public function down(Schema $schema): void
44+
{
45+
if (!$schema->hasTable(SavedSearchConfiguration::TABLE_NAME)) {
46+
return;
47+
}
48+
49+
$table = $schema->getTable(SavedSearchConfiguration::TABLE_NAME);
50+
if ($table->hasColumn('menuShortcutGroup')) {
51+
$table->dropColumn('menuShortcutGroup');
52+
}
53+
}
54+
}
Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
<?php
2+
declare(strict_types=1);
3+
4+
/**
5+
* This source file is available under the terms of the
6+
* Pimcore Open Core License (POCL)
7+
* Full copyright and license information is available in
8+
* LICENSE.md which is distributed with this source code.
9+
*
10+
* @copyright Copyright (c) Pimcore GmbH (https://www.pimcore.com)
11+
* @license Pimcore Open Core License (POCL)
12+
*/
13+
14+
namespace Pimcore\Bundle\StudioBackendBundle\Search\Attribute\Request;
15+
16+
use Attribute;
17+
use OpenApi\Attributes\JsonContent;
18+
use OpenApi\Attributes\RequestBody;
19+
use Pimcore\Bundle\StudioBackendBundle\OpenApi\Attribute\Property\SingleBoolean;
20+
use Pimcore\Bundle\StudioBackendBundle\OpenApi\Attribute\Property\SingleString;
21+
22+
/**
23+
* @internal
24+
*/
25+
#[Attribute(Attribute::TARGET_METHOD)]
26+
final class MenuShortcutRequestBody extends RequestBody
27+
{
28+
public function __construct()
29+
{
30+
parent::__construct(
31+
required: true,
32+
content: new JsonContent(
33+
required: ['createMenuShortcut'],
34+
properties: [
35+
new SingleBoolean('createMenuShortcut'),
36+
new SingleString('menuShortcutGroup'),
37+
],
38+
type: 'object',
39+
),
40+
);
41+
}
42+
}

src/Search/Attribute/Request/SavedSearchRequestBody.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@ public function __construct()
4444
new SingleString('classId'),
4545
new SingleBoolean('shareGlobal'),
4646
new SingleBoolean('createMenuShortcut'),
47+
new SingleString('menuShortcutGroup'),
4748
new ListOfInteger('sharedUsers'),
4849
new ListOfInteger('sharedRoles'),
4950
new Property(

src/Search/Controller/SavedSearch/GetConfigurationController.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,7 @@ public function __construct(
5252
#[Route(
5353
self::ROUTE,
5454
name: 'pimcore_studio_api_get_saved_search_configuration',
55+
requirements: ['id' => '\d+'],
5556
methods: ['GET'],
5657
)]
5758
#[IsGranted(UserPermissions::PIMCORE_USER->value)]
Lines changed: 79 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,79 @@
1+
<?php
2+
declare(strict_types=1);
3+
4+
/**
5+
* This source file is available under the terms of the
6+
* Pimcore Open Core License (POCL)
7+
* Full copyright and license information is available in
8+
* LICENSE.md which is distributed with this source code.
9+
*
10+
* @copyright Copyright (c) Pimcore GmbH (https://www.pimcore.com)
11+
* @license Pimcore Open Core License (POCL)
12+
*/
13+
14+
namespace Pimcore\Bundle\StudioBackendBundle\Search\Controller\SavedSearch;
15+
16+
use OpenApi\Attributes\Get;
17+
use Pimcore\Bundle\StudioBackendBundle\Controller\AbstractApiController;
18+
use Pimcore\Bundle\StudioBackendBundle\OpenApi\Attribute\Property\GenericCollection;
19+
use Pimcore\Bundle\StudioBackendBundle\OpenApi\Attribute\Response\Content\CollectionJson;
20+
use Pimcore\Bundle\StudioBackendBundle\OpenApi\Attribute\Response\DefaultResponses;
21+
use Pimcore\Bundle\StudioBackendBundle\OpenApi\Attribute\Response\SuccessResponse;
22+
use Pimcore\Bundle\StudioBackendBundle\OpenApi\Config\Tags;
23+
use Pimcore\Bundle\StudioBackendBundle\Search\Schema\ConfigurationListItem;
24+
use Pimcore\Bundle\StudioBackendBundle\Search\Service\SavedSearchConfigurationServiceInterface;
25+
use Pimcore\Bundle\StudioBackendBundle\Util\Constant\HttpResponseCodes;
26+
use Pimcore\Bundle\StudioBackendBundle\Util\Constant\UserPermissions;
27+
use Pimcore\Bundle\StudioBackendBundle\Util\Trait\PaginatedResponseTrait;
28+
use Symfony\Component\HttpFoundation\JsonResponse;
29+
use Symfony\Component\Routing\Attribute\Route;
30+
use Symfony\Component\Security\Http\Attribute\IsGranted;
31+
use Symfony\Component\Serializer\SerializerInterface;
32+
33+
/**
34+
* @internal
35+
*/
36+
final class ListMenuShortcutConfigurationsController extends AbstractApiController
37+
{
38+
use PaginatedResponseTrait;
39+
40+
private const string ROUTE = '/search/saved/configuration/menu-shortcuts';
41+
42+
public function __construct(
43+
SerializerInterface $serializer,
44+
private readonly SavedSearchConfigurationServiceInterface $savedSearchConfigurationService,
45+
) {
46+
parent::__construct($serializer);
47+
}
48+
49+
#[Route(
50+
self::ROUTE,
51+
name: 'pimcore_studio_api_get_saved_search_menu_shortcut_configurations',
52+
methods: ['GET'],
53+
)]
54+
#[IsGranted(UserPermissions::PIMCORE_USER->value)]
55+
#[Get(
56+
path: self::PREFIX . self::ROUTE,
57+
operationId: 'saved_search_get_menu_shortcut_configurations',
58+
description: 'saved_search_get_menu_shortcut_configurations_description',
59+
summary: 'saved_search_get_menu_shortcut_configurations_summary',
60+
tags: [Tags::Search->value]
61+
)]
62+
#[SuccessResponse(
63+
description: 'saved_search_get_menu_shortcut_configurations_success_response',
64+
content: new CollectionJson(new GenericCollection(ConfigurationListItem::class))
65+
)]
66+
#[DefaultResponses([
67+
HttpResponseCodes::UNAUTHORIZED,
68+
])]
69+
public function getSavedSearchMenuShortcutConfigurations(): JsonResponse
70+
{
71+
$collection = $this->savedSearchConfigurationService->listMenuShortcutConfigurations();
72+
73+
return $this->getPaginatedCollection(
74+
$this->serializer,
75+
$collection->getItems(),
76+
$collection->getTotalItems()
77+
);
78+
}
79+
}
Lines changed: 84 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,84 @@
1+
<?php
2+
declare(strict_types=1);
3+
4+
/**
5+
* This source file is available under the terms of the
6+
* Pimcore Open Core License (POCL)
7+
* Full copyright and license information is available in
8+
* LICENSE.md which is distributed with this source code.
9+
*
10+
* @copyright Copyright (c) Pimcore GmbH (https://www.pimcore.com)
11+
* @license Pimcore Open Core License (POCL)
12+
*/
13+
14+
namespace Pimcore\Bundle\StudioBackendBundle\Search\Controller\SavedSearch;
15+
16+
use OpenApi\Attributes\Put;
17+
use Pimcore\Bundle\StudioBackendBundle\Controller\AbstractApiController;
18+
use Pimcore\Bundle\StudioBackendBundle\Exception\Api\ForbiddenException;
19+
use Pimcore\Bundle\StudioBackendBundle\Exception\Api\NotFoundException;
20+
use Pimcore\Bundle\StudioBackendBundle\OpenApi\Attribute\Parameter\Path\IdParameter;
21+
use Pimcore\Bundle\StudioBackendBundle\OpenApi\Attribute\Response\DefaultResponses;
22+
use Pimcore\Bundle\StudioBackendBundle\OpenApi\Attribute\Response\SuccessResponse;
23+
use Pimcore\Bundle\StudioBackendBundle\OpenApi\Config\Tags;
24+
use Pimcore\Bundle\StudioBackendBundle\Search\Attribute\Request\MenuShortcutRequestBody;
25+
use Pimcore\Bundle\StudioBackendBundle\Search\MappedParameter\UpdateMenuShortcutParameter;
26+
use Pimcore\Bundle\StudioBackendBundle\Search\Service\SavedSearchConfigurationServiceInterface;
27+
use Pimcore\Bundle\StudioBackendBundle\Util\Constant\HttpResponseCodes;
28+
use Pimcore\Bundle\StudioBackendBundle\Util\Constant\UserPermissions;
29+
use Symfony\Component\HttpFoundation\Response;
30+
use Symfony\Component\HttpKernel\Attribute\MapRequestPayload;
31+
use Symfony\Component\Routing\Attribute\Route;
32+
use Symfony\Component\Security\Http\Attribute\IsGranted;
33+
use Symfony\Component\Serializer\SerializerInterface;
34+
35+
/**
36+
* @internal
37+
*/
38+
final class UpdateMenuShortcutController extends AbstractApiController
39+
{
40+
private const string ROUTE = '/search/saved/configuration/update-menu-shortcut/{id}';
41+
42+
public function __construct(
43+
SerializerInterface $serializer,
44+
private readonly SavedSearchConfigurationServiceInterface $savedSearchConfigurationService,
45+
) {
46+
parent::__construct($serializer);
47+
}
48+
49+
/**
50+
* @throws ForbiddenException
51+
* @throws NotFoundException
52+
*/
53+
#[Route(
54+
self::ROUTE,
55+
name: 'pimcore_studio_api_update_saved_search_menu_shortcut',
56+
methods: ['PUT'],
57+
)]
58+
#[IsGranted(UserPermissions::PIMCORE_USER->value)]
59+
#[Put(
60+
path: self::PREFIX . self::ROUTE,
61+
operationId: 'saved_search_update_menu_shortcut',
62+
description: 'saved_search_update_menu_shortcut_description',
63+
summary: 'saved_search_update_menu_shortcut_summary',
64+
tags: [Tags::Search->value]
65+
)]
66+
#[MenuShortcutRequestBody]
67+
#[IdParameter(type: 'saved search configuration')]
68+
#[SuccessResponse(
69+
description: 'saved_search_update_menu_shortcut_success_response',
70+
)]
71+
#[DefaultResponses([
72+
HttpResponseCodes::FORBIDDEN,
73+
HttpResponseCodes::UNAUTHORIZED,
74+
HttpResponseCodes::NOT_FOUND,
75+
])]
76+
public function updateMenuShortcut(
77+
#[MapRequestPayload] UpdateMenuShortcutParameter $parameter,
78+
int $id
79+
): Response {
80+
$this->savedSearchConfigurationService->updateMenuShortcut($parameter, $id);
81+
82+
return new Response();
83+
}
84+
}

src/Search/Hydrator/DetailedConfigurationHydrator.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ public function hydrate(
3535
sharedUsers: $users,
3636
sharedRoles: $roles,
3737
createMenuShortcut: $data->isCreateMenuShortcut(),
38+
menuShortcutGroup: $data->getMenuShortcutGroup(),
3839
classId: $data->getClassId(),
3940
columns: $data->getColumns(),
4041
filter: $data->getFilter(),

src/Search/Hydrator/ListItemHydrator.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ public function hydrate(SavedSearchConfiguration $data, bool $owner): Configurat
3030
owner: $owner,
3131
modificationDate: $data->getModificationDate()->getTimestamp(),
3232
creationDate: $data->getCreationDate()->getTimestamp(),
33+
menuShortcutGroup: $data->getMenuShortcutGroup(),
3334
);
3435
}
3536
}

0 commit comments

Comments
 (0)