Skip to content

Commit a1ce1e9

Browse files
author
roadiz-ci
committed
fix(migrations): Fixed missing DB indexes drop in existing migrations
1 parent 8f052f9 commit a1ce1e9

26 files changed

Lines changed: 386 additions & 415 deletions

config/routing.yaml

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -17,11 +17,6 @@ nodesRoutes:
1717
resource: "routing/nodes.yml"
1818
prefix: /rz-admin/nodes
1919

20-
## Ajax
21-
ajaxRequestsRoutes:
22-
resource: "routing/ajax.yml"
23-
prefix: /rz-admin/ajax
24-
2520
# Node TYPES
2621
nodeTypesHomePage:
2722
path: /rz-admin/node-types
@@ -57,15 +52,6 @@ settingGroupsRoutes:
5752
resource: "routing/setting-groups.yml"
5853
prefix: /rz-admin/setting-groups
5954

60-
61-
# TAGS
62-
tagsHomePage:
63-
path: /rz-admin/tags
64-
controller: RZ\Roadiz\RozierBundle\Controller\Tag\TagController::indexAction
65-
tagsRoutes:
66-
resource: "routing/tags.yml"
67-
prefix: /rz-admin/tags
68-
6955
# USERS
7056
usersHomePage:
7157
path: /rz-admin/users

config/routing/ajax.yml

Lines changed: 0 additions & 202 deletions
This file was deleted.

config/routing/tags.yml

Lines changed: 0 additions & 48 deletions
This file was deleted.

src/Controller/Ajax/AjaxAttributeValuesController.php

Lines changed: 17 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,12 @@
66

77
use RZ\Roadiz\CoreBundle\Entity\AttributeValue;
88
use RZ\Roadiz\CoreBundle\Security\Authorization\Voter\NodeVoter;
9+
use Symfony\Bridge\Doctrine\Attribute\MapEntity;
910
use Symfony\Component\HttpFoundation\JsonResponse;
1011
use Symfony\Component\HttpFoundation\Request;
1112
use Symfony\Component\HttpFoundation\Response;
1213
use Symfony\Component\HttpKernel\Exception\BadRequestHttpException;
14+
use Symfony\Component\Routing\Attribute\Route;
1315

1416
final class AjaxAttributeValuesController extends AbstractAjaxController
1517
{
@@ -23,22 +25,22 @@ final class AjaxAttributeValuesController extends AbstractAjaxController
2325
*
2426
* @return Response JSON response
2527
*/
26-
public function editAction(Request $request, int $attributeValueId): Response
27-
{
28-
/*
29-
* Validate
30-
*/
28+
#[Route(
29+
path: '/rz-admin/ajax/attribute-values/edit/{attributeValueId}',
30+
name: 'attributeValueAjaxEdit',
31+
requirements: ['attributeValueId' => '\d+'],
32+
format: 'json',
33+
)]
34+
public function editAction(
35+
Request $request,
36+
#[MapEntity(
37+
expr: 'repository.find(attributeValueId)',
38+
evictCache: true,
39+
message: 'AttributeValue does not exist'
40+
)]
41+
AttributeValue $attributeValue,
42+
): Response {
3143
$this->validateRequest($request, 'POST', false);
32-
33-
/** @var AttributeValue|null $attributeValue */
34-
$attributeValue = $this->managerRegistry
35-
->getRepository(AttributeValue::class)
36-
->find($attributeValueId);
37-
38-
if (null === $attributeValue) {
39-
throw $this->createNotFoundException($this->translator->trans('attribute_value.%attributeValueId%.not_exists', ['%attributeValueId%' => $attributeValueId]));
40-
}
41-
4244
$this->denyAccessUnlessGranted(NodeVoter::EDIT_ATTRIBUTE, $attributeValue->getAttributable());
4345

4446
$responseArray = [];

src/Controller/Ajax/AjaxCustomFormFieldsController.php

Lines changed: 19 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,10 @@
55
namespace RZ\Roadiz\RozierBundle\Controller\Ajax;
66

77
use RZ\Roadiz\CoreBundle\Entity\CustomFormField;
8+
use Symfony\Bridge\Doctrine\Attribute\MapEntity;
89
use Symfony\Component\HttpFoundation\Request;
910
use Symfony\Component\HttpFoundation\Response;
11+
use Symfony\Component\Routing\Attribute\Route;
1012

1113
final class AjaxCustomFormFieldsController extends AjaxAbstractFieldsController
1214
{
@@ -16,18 +18,29 @@ final class AjaxCustomFormFieldsController extends AjaxAbstractFieldsController
1618
*
1719
* @return Response JSON response
1820
*/
19-
public function editAction(Request $request, int $customFormFieldId): Response
20-
{
21+
#[Route(
22+
path: '/rz-admin/ajax/custom-forms/fields/edit/{customFormFieldId}',
23+
name: 'customFormFieldAjaxEdit',
24+
requirements: ['customFormFieldId' => '\d+'],
25+
format: 'json'
26+
)]
27+
public function editAction(
28+
Request $request,
29+
#[MapEntity(
30+
expr: 'repository.find(customFormFieldId)',
31+
evictCache: true,
32+
message: 'field.%customFormFieldId%.not_exists'
33+
)]
34+
CustomFormField $field,
35+
): Response {
2136
$this->validateRequest($request);
2237
$this->denyAccessUnlessGranted('ROLE_ACCESS_CUSTOMFORMS_DELETE');
2338

24-
$field = $this->findEntity((int) $customFormFieldId);
25-
26-
if (null !== $field && null !== $response = $this->handleFieldActions($request, $field)) {
39+
if (null !== $response = $this->handleFieldActions($request, $field)) {
2740
return $response;
2841
}
2942

30-
throw $this->createNotFoundException($this->translator->trans('field.%customFormFieldId%.not_exists', ['%customFormFieldId%' => $customFormFieldId]));
43+
throw $this->createNotFoundException($this->translator->trans('field.%customFormFieldId%.not_exists', ['%customFormFieldId%' => $field->getId()]));
3144
}
3245

3346
#[\Override]

0 commit comments

Comments
 (0)