Skip to content

Commit 4e518cf

Browse files
author
roadiz-ci
committed
chore: Bumped
1 parent 39d7585 commit 4e518cf

File tree

104 files changed

+811
-715
lines changed

Some content is hidden

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

104 files changed

+811
-715
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
/dev.php
88
/install.php
99
/clear_cache.php
10+
/pimple.json
1011
/assets
1112
project_env.sh
1213

.travis/backoffice_assets.sh

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
#!/bin/sh -x
2+
cd src || exit 1;
3+
yarn install --pure-lockfile
4+
yarn run install
5+
yarn run build

.travis/composer_install.sh

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
#!/bin/sh -x
2+
phpenv config-rm xdebug.ini;
3+
curl -s http://getcomposer.org/installer | php;
4+
php composer.phar install --dev --no-interaction;

.travis/php_lint.sh

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
#!/bin/sh -x
2+
vendor/bin/phpcs --report=full --report-file=./report.txt -p ./ || exit 1;
3+
vendor/bin/phpstan analyse -c phpstan.neon || exit 1;
4+
#vendor/bin/console lint:twig || exit 1;
5+
#vendor/bin/console lint:twig src/Resources/views || exit 1;

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 © 2024 Ambroise Maupate, Julien Blanchet
3+
Copyright © 2023 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",
3231
"prefer-stable": true,
3332
"require": {
3433
"php": ">=8.1",
3534
"ext-zip": "*",
36-
"doctrine/orm": "~2.19.0",
35+
"doctrine/orm": "~2.17.0",
3736
"guzzlehttp/guzzle": "^7.2.0",
3837
"jms/serializer": "^3.9.0",
3938
"league/flysystem": "^3.0",
39+
"pimple/pimple": "^3.3.1",
4040
"ramsey/uuid": "^4.7",
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.*",
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.*",
4848
"roadiz/nodetype-contracts": "~1.1.2",
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.*",
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.*",
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.3.*",
71-
"roadiz/random": "2.3.*",
72-
"roadiz/jwt": "2.3.*",
70+
"roadiz/entity-generator": "2.2.*",
71+
"roadiz/random": "2.2.*",
72+
"roadiz/jwt": "2.2.*",
7373
"squizlabs/php_codesniffer": "^3.5"
7474
},
7575
"autoload": {
@@ -95,8 +95,8 @@
9595
},
9696
"extra": {
9797
"branch-alias": {
98-
"dev-main": "2.3.x-dev",
99-
"dev-develop": "2.4.x-dev"
98+
"dev-main": "2.2.x-dev",
99+
"dev-develop": "2.3.x-dev"
100100
}
101101
}
102102
}

phpstan.neon

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

3634
reportUnmatchedIgnoredErrors: false
37-
treatPhpDocTypesAsCertain: false
35+
checkGenericClassInNonGenericObjectType: false
36+
checkMissingIterableValueType: false
3837

3938
includes:
4039
- vendor/phpstan/phpstan-doctrine/extension.neon

src/AjaxControllers/AjaxAttributeValuesController.php

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

77
use RZ\Roadiz\CoreBundle\Entity\AttributeValue;
8+
use RZ\Roadiz\CoreBundle\Entity\Node;
89
use RZ\Roadiz\CoreBundle\Security\Authorization\Voter\NodeVoter;
910
use Symfony\Component\HttpFoundation\JsonResponse;
1011
use Symfony\Component\HttpFoundation\Request;
@@ -68,7 +69,7 @@ protected function updatePosition(array $parameters, AttributeValue $attributeVa
6869
$attributable = $attributeValue->getAttributable();
6970
$details = [
7071
'%name%' => $attributeValue->getAttribute()->getLabelOrCode(),
71-
'%nodeName%' => $attributable->getNodeName(),
72+
'%nodeName%' => $attributable instanceof Node ? $attributable->getNodeName() : '',
7273
];
7374

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

src/AjaxControllers/AjaxEntitiesExplorerController.php

Lines changed: 7 additions & 17 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\HttpKernel\Exception\BadRequestHttpException;
21+
use Symfony\Component\Routing\Exception\InvalidParameterException;
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 BadRequestHttpException('nodeTypeField is not a valid entity join.');
49+
throw new InvalidParameterException('nodeTypeField is not a valid entity join.');
5050
}
5151

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

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

69-
/** @var NodeTypeField|null $nodeTypeField */
69+
/** @var NodeTypeField $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-
7671
$configuration = $this->getFieldConfiguration($nodeTypeField);
7772
/** @var class-string<PersistableInterface> $className */
7873
$className = $configuration['classname'];
@@ -117,25 +112,20 @@ public function indexAction(Request $request): JsonResponse
117112
public function listAction(Request $request): JsonResponse
118113
{
119114
if (!$request->query->has('nodeTypeFieldId')) {
120-
throw new BadRequestHttpException('nodeTypeFieldId parameter is missing.');
115+
throw new InvalidParameterException('nodeTypeFieldId parameter is missing.');
121116
}
122117

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

127122
$this->denyAccessUnlessGranted('ROLE_BACKEND_USER');
128123

129124
/** @var EntityManager $em */
130125
$em = $this->em();
131126

132-
/** @var NodeTypeField|null $nodeTypeField */
127+
/** @var NodeTypeField $nodeTypeField */
133128
$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-
139129
$configuration = $this->getFieldConfiguration($nodeTypeField);
140130
/** @var class-string<PersistableInterface> $className */
141131
$className = $configuration['classname'];

src/AjaxControllers/AjaxNodesExplorerController.php

Lines changed: 14 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -14,14 +14,13 @@
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;
1817
use RZ\Roadiz\CoreBundle\Security\Authorization\Voter\NodeVoter;
1918
use Symfony\Component\HttpFoundation\JsonResponse;
2019
use Symfony\Component\HttpFoundation\Request;
2120
use Symfony\Component\HttpFoundation\Response;
2221
use Symfony\Component\Routing\Exception\InvalidParameterException;
2322
use Symfony\Component\Routing\Generator\UrlGeneratorInterface;
24-
use Symfony\Bundle\SecurityBundle\Security;
23+
use Symfony\Component\Security\Core\Security;
2524
use Themes\Rozier\Models\NodeModel;
2625
use Themes\Rozier\Models\NodeSourceModel;
2726

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

260260
foreach ($nodes as $node) {
261-
if ($node instanceof SolrSearchResultItem) {
262-
$item = $node->getItem();
263-
if ($item instanceof NodesSources || $item instanceof Node) {
264-
$this->normalizeItem($item, $nodesArray);
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+
}
265272
}
266-
} else {
267-
$this->normalizeItem($node, $nodesArray);
268273
}
269274
}
270275

271276
return array_values($nodesArray);
272277
}
273278

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-
285279
/**
286280
* @param array $data
287281
* @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\Bundle\SecurityBundle\Security;
17+
use Symfony\Component\Security\Core\Security;
1818

1919
class AjaxSearchNodesSourcesController extends AbstractAjaxController
2020
{

0 commit comments

Comments
 (0)