Skip to content

Commit 324dfcb

Browse files
author
roadiz-ci
committed
Merge branch hotfix/v2.3.13
1 parent 420f436 commit 324dfcb

File tree

102 files changed

+647
-810
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

102 files changed

+647
-810
lines changed

.gitignore

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@
77
/dev.php
88
/install.php
99
/clear_cache.php
10-
/pimple.json
1110
/assets
1211
project_env.sh
1312

.travis/backoffice_assets.sh

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

.travis/composer_install.sh

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

.travis/php_lint.sh

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

LICENSE.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
The MIT License (MIT)
22

3-
Copyright © 2023 Ambroise Maupate, Julien Blanchet
3+
Copyright © 2024 Ambroise Maupate, Julien Blanchet
44

55
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the “Software”), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
66

composer.json

Lines changed: 29 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -28,48 +28,48 @@
2828
"role": "Frontend developer"
2929
}
3030
],
31+
"minimum-stability": "dev",
3132
"prefer-stable": true,
3233
"require": {
3334
"php": ">=8.1",
3435
"ext-zip": "*",
35-
"doctrine/orm": "~2.17.0",
36+
"doctrine/orm": "~2.19.0",
3637
"guzzlehttp/guzzle": "^7.2.0",
3738
"jms/serializer": "^3.9.0",
3839
"league/flysystem": "^3.0",
39-
"pimple/pimple": "^3.3.1",
4040
"ramsey/uuid": "^4.7",
41-
"roadiz/compat-bundle": "2.2.*",
42-
"roadiz/core-bundle": "2.2.*",
43-
"roadiz/doc-generator": "2.2.*",
44-
"roadiz/documents": "2.2.*",
45-
"roadiz/dts-generator": "2.2.*",
46-
"roadiz/markdown": "2.2.*",
47-
"roadiz/models": "2.2.*",
41+
"roadiz/compat-bundle": "2.3.*",
42+
"roadiz/core-bundle": "2.3.*",
43+
"roadiz/doc-generator": "2.3.*",
44+
"roadiz/documents": "2.3.*",
45+
"roadiz/dts-generator": "2.3.*",
46+
"roadiz/markdown": "2.3.*",
47+
"roadiz/models": "2.3.*",
4848
"roadiz/nodetype-contracts": "~1.1.2",
49-
"roadiz/openid": "2.2.*",
50-
"roadiz/rozier-bundle": "2.2.*",
51-
"symfony/asset": "5.4.*",
52-
"symfony/filesystem": "5.4.*",
53-
"symfony/form": "5.4.*",
54-
"symfony/http-foundation": "5.4.*",
55-
"symfony/http-kernel": "5.4.*",
56-
"symfony/routing": "5.4.*",
57-
"symfony/security-core": "5.4.*",
58-
"symfony/security-csrf": "5.4.*",
59-
"symfony/security-http": "5.4.*",
60-
"symfony/translation": "5.4.*",
61-
"symfony/validator": "5.4.*",
62-
"symfony/workflow": "5.4.*",
63-
"symfony/yaml": "5.4.*",
49+
"roadiz/openid": "2.3.*",
50+
"roadiz/rozier-bundle": "2.3.*",
51+
"symfony/asset": "6.4.*",
52+
"symfony/filesystem": "6.4.*",
53+
"symfony/form": "6.4.*",
54+
"symfony/http-foundation": "6.4.*",
55+
"symfony/http-kernel": "6.4.*",
56+
"symfony/routing": "6.4.*",
57+
"symfony/security-core": "6.4.*",
58+
"symfony/security-csrf": "6.4.*",
59+
"symfony/security-http": "6.4.*",
60+
"symfony/translation": "6.4.*",
61+
"symfony/validator": "6.4.*",
62+
"symfony/workflow": "6.4.*",
63+
"symfony/yaml": "6.4.*",
6464
"twig/twig": "^3.1"
6565
},
6666
"require-dev": {
6767
"php-coveralls/php-coveralls": "^2.4",
6868
"phpstan/phpstan": "^1.5.3",
6969
"phpstan/phpstan-doctrine": "^1.3",
70-
"roadiz/entity-generator": "2.2.*",
71-
"roadiz/random": "2.2.*",
72-
"roadiz/jwt": "2.2.*",
70+
"roadiz/entity-generator": "2.3.*",
71+
"roadiz/random": "2.3.*",
72+
"roadiz/jwt": "2.3.*",
7373
"squizlabs/php_codesniffer": "^3.5"
7474
},
7575
"autoload": {
@@ -95,8 +95,8 @@
9595
},
9696
"extra": {
9797
"branch-alias": {
98-
"dev-main": "2.2.x-dev",
99-
"dev-develop": "2.3.x-dev"
98+
"dev-main": "2.3.x-dev",
99+
"dev-develop": "2.4.x-dev"
100100
}
101101
}
102102
}

phpstan.neon

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
parameters:
2-
level: 6
2+
level: 7
33
paths:
44
- src
55
excludePaths:
@@ -9,6 +9,8 @@ parameters:
99
doctrine:
1010
repositoryClass: RZ\Roadiz\Core\Repositories\EntityRepository
1111
ignoreErrors:
12+
- identifier: missingType.iterableValue
13+
- identifier: missingType.generics
1214
- '#Call to an undefined method RZ\\Roadiz\\CoreBundle\\Repository#'
1315
- '#Call to an undefined method RZ\\Roadiz\\UserBundle\\Repository#'
1416
- '#Call to an undefined method Doctrine\\Persistence\\ObjectRepository#'
@@ -32,8 +34,7 @@ parameters:
3234
- '#does not accept Doctrine\\Common\\Collections\\ReadableCollection<int, [^\>]+>#'
3335

3436
reportUnmatchedIgnoredErrors: false
35-
checkGenericClassInNonGenericObjectType: false
36-
checkMissingIterableValueType: false
37+
treatPhpDocTypesAsCertain: false
3738

3839
includes:
3940
- vendor/phpstan/phpstan-doctrine/extension.neon

src/AjaxControllers/AjaxAttributeValuesController.php

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55
namespace Themes\Rozier\AjaxControllers;
66

77
use RZ\Roadiz\CoreBundle\Entity\AttributeValue;
8-
use RZ\Roadiz\CoreBundle\Entity\Node;
98
use RZ\Roadiz\CoreBundle\Security\Authorization\Voter\NodeVoter;
109
use Symfony\Component\HttpFoundation\JsonResponse;
1110
use Symfony\Component\HttpFoundation\Request;
@@ -69,7 +68,7 @@ protected function updatePosition(array $parameters, AttributeValue $attributeVa
6968
$attributable = $attributeValue->getAttributable();
7069
$details = [
7170
'%name%' => $attributeValue->getAttribute()->getLabelOrCode(),
72-
'%nodeName%' => $attributable instanceof Node ? $attributable->getNodeName() : '',
71+
'%nodeName%' => $attributable->getNodeName(),
7372
];
7473

7574
if (!empty($parameters['afterAttributeValueId']) && is_numeric($parameters['afterAttributeValueId'])) {

src/AjaxControllers/AjaxEntitiesExplorerController.php

Lines changed: 17 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
use Symfony\Component\Config\Definition\Processor;
1919
use Symfony\Component\HttpFoundation\JsonResponse;
2020
use Symfony\Component\HttpFoundation\Request;
21-
use Symfony\Component\Routing\Exception\InvalidParameterException;
21+
use Symfony\Component\HttpKernel\Exception\BadRequestHttpException;
2222
use Symfony\Component\Routing\Generator\UrlGeneratorInterface;
2323
use Symfony\Component\Yaml\Yaml;
2424
use Themes\Rozier\Explorer\ConfigurableExplorerItem;
@@ -46,7 +46,7 @@ protected function getFieldConfiguration(NodeTypeField $nodeTypeField): array
4646
$nodeTypeField->getType() !== AbstractField::MANY_TO_MANY_T &&
4747
$nodeTypeField->getType() !== AbstractField::MANY_TO_ONE_T
4848
) {
49-
throw new InvalidParameterException('nodeTypeField is not a valid entity join.');
49+
throw new BadRequestHttpException('nodeTypeField is not a valid entity join.');
5050
}
5151

5252
$configs = [
@@ -63,11 +63,16 @@ public function indexAction(Request $request): JsonResponse
6363
$this->denyAccessUnlessGranted('ROLE_BACKEND_USER');
6464

6565
if (!$request->query->has('nodeTypeFieldId')) {
66-
throw new InvalidParameterException('nodeTypeFieldId parameter is missing.');
66+
throw new BadRequestHttpException('nodeTypeFieldId parameter is missing.');
6767
}
6868

69-
/** @var NodeTypeField $nodeTypeField */
69+
/** @var NodeTypeField|null $nodeTypeField */
7070
$nodeTypeField = $this->em()->find(NodeTypeField::class, $request->query->get('nodeTypeFieldId'));
71+
72+
if (null === $nodeTypeField) {
73+
throw new BadRequestHttpException('nodeTypeField does not exist.');
74+
}
75+
7176
$configuration = $this->getFieldConfiguration($nodeTypeField);
7277
/** @var class-string<PersistableInterface> $className */
7378
$className = $configuration['classname'];
@@ -112,20 +117,25 @@ public function indexAction(Request $request): JsonResponse
112117
public function listAction(Request $request): JsonResponse
113118
{
114119
if (!$request->query->has('nodeTypeFieldId')) {
115-
throw new InvalidParameterException('nodeTypeFieldId parameter is missing.');
120+
throw new BadRequestHttpException('nodeTypeFieldId parameter is missing.');
116121
}
117122

118123
if (!$request->query->has('ids')) {
119-
throw new InvalidParameterException('Ids should be provided within an array');
124+
throw new BadRequestHttpException('Ids should be provided within an array');
120125
}
121126

122127
$this->denyAccessUnlessGranted('ROLE_BACKEND_USER');
123128

124129
/** @var EntityManager $em */
125130
$em = $this->em();
126131

127-
/** @var NodeTypeField $nodeTypeField */
132+
/** @var NodeTypeField|null $nodeTypeField */
128133
$nodeTypeField = $this->em()->find(NodeTypeField::class, $request->query->get('nodeTypeFieldId'));
134+
135+
if (null === $nodeTypeField) {
136+
throw new BadRequestHttpException('nodeTypeField does not exist.');
137+
}
138+
129139
$configuration = $this->getFieldConfiguration($nodeTypeField);
130140
/** @var class-string<PersistableInterface> $className */
131141
$className = $configuration['classname'];

src/AjaxControllers/AjaxNodesExplorerController.php

Lines changed: 20 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -14,13 +14,14 @@
1414
use RZ\Roadiz\CoreBundle\EntityApi\NodeTypeApi;
1515
use RZ\Roadiz\CoreBundle\SearchEngine\ClientRegistry;
1616
use RZ\Roadiz\CoreBundle\SearchEngine\NodeSourceSearchHandlerInterface;
17+
use RZ\Roadiz\CoreBundle\SearchEngine\SolrSearchResultItem;
1718
use RZ\Roadiz\CoreBundle\Security\Authorization\Voter\NodeVoter;
1819
use Symfony\Component\HttpFoundation\JsonResponse;
1920
use Symfony\Component\HttpFoundation\Request;
2021
use Symfony\Component\HttpFoundation\Response;
2122
use Symfony\Component\Routing\Exception\InvalidParameterException;
2223
use Symfony\Component\Routing\Generator\UrlGeneratorInterface;
23-
use Symfony\Component\Security\Core\Security;
24+
use Symfony\Bundle\SecurityBundle\Security;
2425
use Themes\Rozier\Models\NodeModel;
2526
use Themes\Rozier\Models\NodeSourceModel;
2627

@@ -184,7 +185,6 @@ protected function getSolrSearchResults(
184185
$arrayFilter,
185186
$this->getItemPerPage(),
186187
true,
187-
2,
188188
(int) $currentPage
189189
);
190190
$pageCount = ceil($results->getResultCount() / $this->getItemPerPage());
@@ -250,32 +250,38 @@ public function listAction(Request $request): JsonResponse
250250
/**
251251
* Normalize response Node list result.
252252
*
253-
* @param iterable<Node|NodesSources> $nodes
253+
* @param iterable<Node|NodesSources|SolrSearchResultItem> $nodes
254254
* @return array
255255
*/
256256
private function normalizeNodes(iterable $nodes): array
257257
{
258258
$nodesArray = [];
259259

260260
foreach ($nodes as $node) {
261-
if (null !== $node) {
262-
if ($node instanceof NodesSources) {
263-
if (!key_exists($node->getNode()->getId(), $nodesArray)) {
264-
$nodeModel = new NodeSourceModel($node, $this->urlGenerator, $this->security);
265-
$nodesArray[$node->getNode()->getId()] = $nodeModel->toArray();
266-
}
267-
} else {
268-
if (!key_exists($node->getId(), $nodesArray)) {
269-
$nodeModel = new NodeModel($node, $this->urlGenerator, $this->security);
270-
$nodesArray[$node->getId()] = $nodeModel->toArray();
271-
}
261+
if ($node instanceof SolrSearchResultItem) {
262+
$item = $node->getItem();
263+
if ($item instanceof NodesSources || $item instanceof Node) {
264+
$this->normalizeItem($item, $nodesArray);
272265
}
266+
} else {
267+
$this->normalizeItem($node, $nodesArray);
273268
}
274269
}
275270

276271
return array_values($nodesArray);
277272
}
278273

274+
private function normalizeItem(NodesSources|Node $item, array &$nodesArray): void
275+
{
276+
if ($item instanceof NodesSources && !key_exists($item->getNode()->getId(), $nodesArray)) {
277+
$nodeSourceModel = new NodeSourceModel($item, $this->urlGenerator, $this->security);
278+
$nodesArray[$item->getNode()->getId()] = $nodeSourceModel->toArray();
279+
} elseif ($item instanceof Node && !key_exists($item->getId(), $nodesArray)) {
280+
$nodeModel = new NodeModel($item, $this->urlGenerator, $this->security);
281+
$nodesArray[$item->getId()] = $nodeModel->toArray();
282+
}
283+
}
284+
279285
/**
280286
* @param array $data
281287
* @return JsonResponse

src/AjaxControllers/AjaxSearchNodesSourcesController.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
use Symfony\Component\HttpFoundation\Request;
1515
use Symfony\Component\HttpFoundation\Response;
1616
use Symfony\Component\HttpKernel\Exception\BadRequestHttpException;
17-
use Symfony\Component\Security\Core\Security;
17+
use Symfony\Bundle\SecurityBundle\Security;
1818

1919
class AjaxSearchNodesSourcesController extends AbstractAjaxController
2020
{

0 commit comments

Comments
 (0)