diff --git a/Makefile b/Makefile
index aed348d0a..ffdf3a6aa 100644
--- a/Makefile
+++ b/Makefile
@@ -1,19 +1,17 @@
phpstan:
- php -d "memory_limit=-1" vendor/bin/phpstan analyse -c phpstan.neon
+ docker compose run --no-deps --rm --entrypoint= app php -d "memory_limit=-1" vendor/bin/phpstan analyse -c phpstan.neon
test:
- vendor/bin/requirements-checker
- vendor/bin/monorepo-builder validate
+ docker compose run --no-deps --rm --entrypoint= app vendor/bin/requirements-checker
+ docker compose run --no-deps --rm --entrypoint= app vendor/bin/monorepo-builder validate
make phpstan
- XDEBUG_MODE=coverage vendor/bin/phpunit -v
- php -d "memory_limit=-1" vendor/bin/php-cs-fixer fix --ansi -vvv
- php -d "memory_limit=-1" bin/console lint:twig ./lib/Documents/src/Resources/views
- php -d "memory_limit=-1" bin/console lint:twig ./lib/RoadizCoreBundle/templates
- php -d "memory_limit=-1" bin/console lint:twig ./lib/RoadizFontBundle/templates
- php -d "memory_limit=-1" bin/console lint:twig ./lib/RoadizRozierBundle/templates
- php -d "memory_limit=-1" bin/console lint:twig ./lib/RoadizTwoFactorBundle/templates
- php -d "memory_limit=-1" bin/console lint:twig ./lib/RoadizUserBundle/templates
- php -d "memory_limit=-1" bin/console lint:twig ./lib/Rozier/src/Resources/views
+ docker compose run --no-deps --rm --entrypoint= app php -d "memory_limit=-1" bin/console lint:twig ./lib/Documents/src/Resources/views
+ docker compose run --no-deps --rm --entrypoint= app php -d "memory_limit=-1" bin/console lint:twig ./lib/RoadizCoreBundle/templates
+ docker compose run --no-deps --rm --entrypoint= app php -d "memory_limit=-1" bin/console lint:twig ./lib/RoadizRozierBundle/templates
+ docker compose run --no-deps --rm --entrypoint= app php -d "memory_limit=-1" bin/console lint:twig ./lib/RoadizTwoFactorBundle/templates
+ docker compose run --no-deps --rm --entrypoint= app php -d "memory_limit=-1" bin/console lint:twig ./lib/RoadizUserBundle/templates
+ docker compose run --no-deps --rm --entrypoint= app php -d "memory_limit=-1" bin/console lint:twig ./lib/Rozier/src/Resources/views
+ make phpunit
phpunit:
APP_ENV=test docker compose exec app php vendor/bin/phpunit -v
diff --git a/composer.json b/composer.json
index b7802775f..043aae6ed 100644
--- a/composer.json
+++ b/composer.json
@@ -41,7 +41,7 @@
"ext-openssl": "*",
"ext-simplexml": "*",
"ext-zip": "*",
- "api-platform/core": "~3.3.11",
+ "api-platform/core": "~3.4.17",
"codercat/jwk-to-pem": "^1.0",
"composer/package-versions-deprecated": "1.11.99.3",
"doctrine/annotations": "^2.0",
diff --git a/config/packages/roadiz_core.yaml b/config/packages/roadiz_core.yaml
index b8ca3aa62..ab325108d 100644
--- a/config/packages/roadiz_core.yaml
+++ b/config/packages/roadiz_core.yaml
@@ -22,6 +22,9 @@ roadiz_core:
solr:
timeout: 3
+ search:
+ fuzzy_proximity: 2
+ fuzzy_min_term_length: 3
endpoints:
docker:
host: '%env(string:SOLR_HOST)%'
diff --git a/lib/Documents/src/Console/DocumentSizeCommand.php b/lib/Documents/src/Console/DocumentSizeCommand.php
index 466b9f9f6..57b0b8f9e 100644
--- a/lib/Documents/src/Console/DocumentSizeCommand.php
+++ b/lib/Documents/src/Console/DocumentSizeCommand.php
@@ -36,7 +36,7 @@ protected function execute(InputInterface $input, OutputInterface $output): int
private function updateDocumentSize(DocumentInterface $document): void
{
- if (!($document instanceof SizeableInterface)) {
+ if (!$document instanceof SizeableInterface) {
return;
}
$mountPath = $document->getMountPath();
diff --git a/lib/Documents/src/MediaFinders/AbstractYoutubeEmbedFinder.php b/lib/Documents/src/MediaFinders/AbstractYoutubeEmbedFinder.php
index 942d30faa..43a648847 100644
--- a/lib/Documents/src/MediaFinders/AbstractYoutubeEmbedFinder.php
+++ b/lib/Documents/src/MediaFinders/AbstractYoutubeEmbedFinder.php
@@ -144,9 +144,8 @@ public function getSearchFeed(string $searchTerm, ?string $author = null, int $m
}
return $this->downloadFeedFromAPI($url);
- } else {
- throw new APINeedsAuthentificationException('YoutubeEmbedFinder needs a Google server key, create a “google_server_id” setting.', 1);
}
+ throw new APINeedsAuthentificationException('YoutubeEmbedFinder needs a Google server key, create a “google_server_id” setting.', 1);
}
/**
diff --git a/lib/Documents/src/Models/DocumentTrait.php b/lib/Documents/src/Models/DocumentTrait.php
index 2a960cc70..c7ba3937a 100644
--- a/lib/Documents/src/Models/DocumentTrait.php
+++ b/lib/Documents/src/Models/DocumentTrait.php
@@ -162,9 +162,9 @@ public function getShortType(): string
{
if (null !== $this->getMimeType() && isset(static::$mimeToIcon[$this->getMimeType()])) {
return static::$mimeToIcon[$this->getMimeType()];
- } else {
- return 'unknown';
}
+
+ return 'unknown';
}
/**
@@ -233,23 +233,19 @@ public function isWebp(): bool
return 'image/webp' === $this->getMimeType();
}
- #[
- Serializer\Groups(['document', 'document_display', 'nodes_sources', 'tag', 'attribute']),
- Serializer\SerializedName('relativePath'),
- ]
+ #[Serializer\Groups(['document', 'document_display', 'nodes_sources', 'tag', 'attribute']),
+ Serializer\SerializedName('relativePath'),]
public function getRelativePath(): ?string
{
if ($this->isLocal()) {
return $this->getFolder().'/'.$this->getFilename();
- } else {
- return null;
}
+
+ return null;
}
- #[
- Serializer\Groups(['document_mount']),
- Serializer\SerializedName('mountPath'),
- ]
+ #[Serializer\Groups(['document_mount']),
+ Serializer\SerializedName('mountPath'),]
public function getMountPath(): ?string
{
if (null === $relativePath = $this->getRelativePath()) {
@@ -257,14 +253,12 @@ public function getMountPath(): ?string
}
if ($this->isPrivate()) {
return 'private://'.$relativePath;
- } else {
- return 'public://'.$relativePath;
}
+
+ return 'public://'.$relativePath;
}
- #[
- Serializer\Ignore
- ]
+ #[Serializer\Ignore]
public function getMountFolderPath(): ?string
{
$folder = $this->getFolder();
@@ -273,9 +267,9 @@ public function getMountFolderPath(): ?string
}
if ($this->isPrivate()) {
return 'private://'.$folder;
- } else {
- return 'public://'.$folder;
}
+
+ return 'public://'.$folder;
}
/**
@@ -292,23 +286,19 @@ protected function initDocumentTrait(): void
$this->setFolder(DocumentFolderGenerator::generateFolderName());
}
- #[
- Serializer\Groups(['document', 'document_display', 'nodes_sources', 'tag', 'attribute']),
+ #[Serializer\Groups(['document', 'document_display', 'nodes_sources', 'tag', 'attribute']),
Serializer\SerializedName('processable'),
ApiProperty(
description: 'Document can be processed as an image for resampling and other image operations.',
writable: false,
- )
- ]
+ )]
public function isProcessable(): bool
{
return $this->isImage() && in_array($this->getMimeType(), static::$processableMimeTypes, true);
}
- #[
- Serializer\Groups(['document', 'document_display', 'nodes_sources', 'tag', 'attribute']),
- Serializer\SerializedName('alt'),
- ]
+ #[Serializer\Groups(['document', 'document_display', 'nodes_sources', 'tag', 'attribute']),
+ Serializer\SerializedName('alt'),]
public function getAlternativeText(): ?string
{
return null;
diff --git a/lib/Documents/src/Renderer/ChainRenderer.php b/lib/Documents/src/Renderer/ChainRenderer.php
index 0de8b7afe..f935bb499 100644
--- a/lib/Documents/src/Renderer/ChainRenderer.php
+++ b/lib/Documents/src/Renderer/ChainRenderer.php
@@ -19,7 +19,7 @@ public function __construct(array $renderers)
* @var RendererInterface $renderer
*/
foreach ($renderers as $renderer) {
- if (!($renderer instanceof RendererInterface)) {
+ if (!$renderer instanceof RendererInterface) {
throw new \InvalidArgumentException('Document Renderer must implement RendererInterface');
}
}
diff --git a/lib/Documents/src/Renderer/EmbedRenderer.php b/lib/Documents/src/Renderer/EmbedRenderer.php
index 76aa00c6a..1fc93d3c4 100644
--- a/lib/Documents/src/Renderer/EmbedRenderer.php
+++ b/lib/Documents/src/Renderer/EmbedRenderer.php
@@ -23,9 +23,9 @@ public function supports(DocumentInterface $document, array $options): bool
&& true === $options['embed']
) {
return true;
- } else {
- return false;
}
+
+ return false;
}
public function render(DocumentInterface $document, array $options): string
diff --git a/lib/Documents/src/SvgSizeResolver.php b/lib/Documents/src/SvgSizeResolver.php
index bf07b87a9..9bd67ae44 100644
--- a/lib/Documents/src/SvgSizeResolver.php
+++ b/lib/Documents/src/SvgSizeResolver.php
@@ -22,7 +22,7 @@ public function __construct(
/**
* @return array|null [$x, $y, $width, $height]
*/
- protected function getViewBoxAttributes(): ?array
+ private function getViewBoxAttributes(): ?array
{
try {
$viewBox = $this->getSvgNodeAttributes()->getNamedItem('viewBox');
@@ -36,7 +36,7 @@ protected function getViewBoxAttributes(): ?array
return null;
}
- protected function getIntegerAttribute(string $name): ?int
+ private function getIntegerAttribute(string $name): ?int
{
try {
$attribute = $this->getSvgNodeAttributes()->getNamedItem($name);
diff --git a/lib/Documents/src/TwigExtension/DocumentExtension.php b/lib/Documents/src/TwigExtension/DocumentExtension.php
index 381b2a156..e342df107 100644
--- a/lib/Documents/src/TwigExtension/DocumentExtension.php
+++ b/lib/Documents/src/TwigExtension/DocumentExtension.php
@@ -66,9 +66,9 @@ public function getEmbedFinder(?DocumentInterface $document = null): ?EmbedFinde
if (null === $document) {
if ($this->throwExceptions) {
throw new RuntimeError('Document can’t be null to get its EmbedFinder.');
- } else {
- return null;
}
+
+ return null;
}
try {
@@ -84,9 +84,9 @@ public function getEmbedFinder(?DocumentInterface $document = null): ?EmbedFinde
} catch (InvalidEmbedId $embedException) {
if ($this->throwExceptions) {
throw new RuntimeError($embedException->getMessage());
- } else {
- return null;
}
+
+ return null;
}
return null;
@@ -100,9 +100,9 @@ public function display(?DocumentInterface $document = null, ?array $options = [
if (null === $document) {
if ($this->throwExceptions) {
throw new RuntimeError('Document can’t be null to be displayed.');
- } else {
- return '';
}
+
+ return '';
}
if (null === $options) {
$options = [];
@@ -112,9 +112,9 @@ public function display(?DocumentInterface $document = null, ?array $options = [
} catch (InvalidEmbedId $embedException) {
if ($this->throwExceptions) {
throw new RuntimeError($embedException->getMessage());
- } else {
- return '
'.$embedException->getMessage().'
';
}
+
+ return ''.$embedException->getMessage().'
';
} catch (InvalidArgumentException $e) {
throw new RuntimeError($e->getMessage(), -1, null, $e);
}
@@ -134,9 +134,9 @@ public function getImageOrientation(?SizeableInterface $document = null): ?strin
if (null === $document) {
if ($this->throwExceptions) {
throw new RuntimeError('Document can’t be null to get its orientation.');
- } else {
- return null;
}
+
+ return null;
}
$size = $this->getImageSize($document);
@@ -153,12 +153,12 @@ public function getImageSize(?SizeableInterface $document = null): array
if (null === $document) {
if ($this->throwExceptions) {
throw new RuntimeError('Document can’t be null to get its size.');
- } else {
- return [
- 'width' => 0,
- 'height' => 0,
- ];
}
+
+ return [
+ 'width' => 0,
+ 'height' => 0,
+ ];
}
return [
@@ -175,9 +175,9 @@ public function getImageRatio(?SizeableInterface $document = null): float
if (null === $document) {
if ($this->throwExceptions) {
throw new RuntimeError('Document can’t be null to get its ratio.');
- } else {
- return 0.0;
}
+
+ return 0.0;
}
if (null !== $document && null !== $ratio = $document->getImageRatio()) {
diff --git a/lib/Documents/src/UrlGenerators/AbstractDocumentUrlGenerator.php b/lib/Documents/src/UrlGenerators/AbstractDocumentUrlGenerator.php
index 02ecfa3f9..50fd93fb9 100644
--- a/lib/Documents/src/UrlGenerators/AbstractDocumentUrlGenerator.php
+++ b/lib/Documents/src/UrlGenerators/AbstractDocumentUrlGenerator.php
@@ -80,9 +80,9 @@ public function getUrl(bool $absolute = false): string
$publicUrl = $this->documentsStorage->publicUrl($mountPath);
if ($absolute && \str_starts_with($publicUrl, '/')) {
return $this->urlHelper->getAbsoluteUrl($publicUrl);
- } else {
- return $publicUrl;
}
+
+ return $publicUrl;
}
return $this->getProcessedDocumentUrlByArray($absolute);
diff --git a/lib/Documents/src/Viewers/SvgDocumentViewer.php b/lib/Documents/src/Viewers/SvgDocumentViewer.php
index 634cad002..541e3ce25 100644
--- a/lib/Documents/src/Viewers/SvgDocumentViewer.php
+++ b/lib/Documents/src/Viewers/SvgDocumentViewer.php
@@ -39,12 +39,12 @@ public function getContent(): string
{
if (false === $this->asObject) {
return $this->getInlineSvg();
- } else {
- return $this->getObjectSvg();
}
+
+ return $this->getObjectSvg();
}
- protected function getAllowedAttributes(): array
+ private function getAllowedAttributes(): array
{
$attributes = [];
foreach ($this->attributes as $key => $value) {
@@ -63,7 +63,7 @@ protected function getAllowedAttributes(): array
/**
* @throws FilesystemException
*/
- protected function getInlineSvg(): string
+ private function getInlineSvg(): string
{
$mountPath = $this->document->getMountPath();
@@ -95,7 +95,7 @@ protected function getInlineSvg(): string
/**
* @throws \Exception
*/
- protected function injectAttributes(string $svg): string
+ private function injectAttributes(string $svg): string
{
$attributes = $this->getAllowedAttributes();
if (count($attributes) > 0) {
@@ -133,7 +133,7 @@ protected function injectAttributes(string $svg): string
/**
* @deprecated use SvgRenderer to render HTML object
*/
- protected function getObjectSvg(): string
+ private function getObjectSvg(): string
{
$mountPath = $this->document->getMountPath();
diff --git a/lib/Documents/tests/Renderer/AudioRendererTest.php b/lib/Documents/tests/Renderer/AudioRendererTest.php
index 55b8f6633..f991479d4 100644
--- a/lib/Documents/tests/Renderer/AudioRendererTest.php
+++ b/lib/Documents/tests/Renderer/AudioRendererTest.php
@@ -68,16 +68,14 @@ public function testRender(): void
Your browser does not support native audio.
-EOT
- , $renderer->render($mockDocument, []));
+EOT, $renderer->render($mockDocument, []));
$this->assertHtmlTidyEquals(<<
Your browser does not support native audio.
-EOT
- , $renderer->render($mockDocument2, []));
+EOT, $renderer->render($mockDocument2, []));
$this->assertHtmlTidyEquals(<<
@@ -85,12 +83,11 @@ public function testRender(): void
Your browser does not support native audio.
-EOT
- , $renderer->render($mockDocument, [
- 'controls' => true,
- 'loop' => true,
- 'autoplay' => true,
- ]));
+EOT, $renderer->render($mockDocument, [
+ 'controls' => true,
+ 'loop' => true,
+ 'autoplay' => true,
+ ]));
$this->assertHtmlTidyEquals(<<
@@ -98,10 +95,9 @@ public function testRender(): void
Your browser does not support native audio.
-EOT
- , $renderer->render($mockDocument, [
- 'controls' => false,
- ]));
+EOT, $renderer->render($mockDocument, [
+ 'controls' => false,
+ ]));
}
private function getDocumentFinder(): DocumentFinderInterface
diff --git a/lib/Documents/tests/Renderer/ChainRendererTest.php b/lib/Documents/tests/Renderer/ChainRendererTest.php
index 4ce316276..dfe12f06d 100644
--- a/lib/Documents/tests/Renderer/ChainRendererTest.php
+++ b/lib/Documents/tests/Renderer/ChainRendererTest.php
@@ -75,8 +75,7 @@ public function testRender(): void
-EOT
- ,
+EOT,
$renderer->render($mockSvgDocument, ['inline' => true])
);
@@ -88,8 +87,7 @@ public function testRender(): void
-EOT
- ,
+EOT,
$renderer->render($mockDocumentYoutube, ['embed' => true])
);
@@ -100,8 +98,7 @@ public function testRender(): void
-EOT
- ,
+EOT,
$renderer->render($mockPictureDocument, [
'width' => 300,
'picture' => true,
@@ -115,8 +112,7 @@ public function testRender(): void
-EOT
- ,
+EOT,
$renderer->render($mockDecorativeDocument, [
'width' => 300,
'picture' => true,
diff --git a/lib/Documents/tests/Renderer/EmbedRendererTest.php b/lib/Documents/tests/Renderer/EmbedRendererTest.php
index b332af8a2..f179bcfa3 100644
--- a/lib/Documents/tests/Renderer/EmbedRendererTest.php
+++ b/lib/Documents/tests/Renderer/EmbedRendererTest.php
@@ -69,8 +69,7 @@ public function testRender(): void
-EOT
- ,
+EOT,
$renderer->render($mockDocumentYoutube, ['embed' => true])
);
@@ -80,8 +79,7 @@ public function testRender(): void
allow="accelerometer; encrypted-media; gyroscope; picture-in-picture; fullscreen"
allowFullScreen
loading="lazy">
-EOT
- ,
+EOT,
$renderer->render($mockDocumentYoutube, [
'embed' => true,
'loading' => 'lazy',
@@ -93,8 +91,7 @@ public function testRender(): void
-EOT
- ,
+EOT,
$renderer->render($mockDocumentYoutube, [
'embed' => true,
'width' => 500,
@@ -107,8 +104,7 @@ public function testRender(): void
-EOT
- ,
+EOT,
$renderer->render($mockDocumentYoutube, [
'embed' => true,
'width' => 500,
@@ -121,8 +117,7 @@ public function testRender(): void
-EOT
- ,
+EOT,
$renderer->render($mockDocumentYoutube, [
'embed' => true,
'autoplay' => true,
@@ -137,8 +132,7 @@ public function testRender(): void
-EOT
- ,
+EOT,
$renderer->render($mockDocumentVimeo, ['embed' => true])
);
@@ -147,8 +141,7 @@ public function testRender(): void
-EOT
- ,
+EOT,
$renderer->render($mockDocumentVimeo, [
'embed' => true,
'autoplay' => true,
@@ -161,8 +154,7 @@ public function testRender(): void
-EOT
- ,
+EOT,
$renderer->render($mockDocumentVimeo, [
'embed' => true,
'autoplay' => true,
diff --git a/lib/Documents/tests/Renderer/InlineSvgRendererTest.php b/lib/Documents/tests/Renderer/InlineSvgRendererTest.php
index 651fe0076..ed7418f18 100644
--- a/lib/Documents/tests/Renderer/InlineSvgRendererTest.php
+++ b/lib/Documents/tests/Renderer/InlineSvgRendererTest.php
@@ -64,8 +64,7 @@ public function testRender(): void
-EOT
- ,
+EOT,
$renderer->render($mockDocument, ['inline' => true])
);
}
diff --git a/lib/Documents/tests/Renderer/PictureRendererTest.php b/lib/Documents/tests/Renderer/PictureRendererTest.php
index 474003425..7bcde24c8 100644
--- a/lib/Documents/tests/Renderer/PictureRendererTest.php
+++ b/lib/Documents/tests/Renderer/PictureRendererTest.php
@@ -131,8 +131,7 @@ public function testRender(): void
-EOT
- ,
+EOT,
$renderer->render($mockDocument, [
'noProcess' => true,
'picture' => true,
@@ -146,8 +145,7 @@ public function testRender(): void
-EOT
- ,
+EOT,
$renderer->render($mockDocument, [
'noProcess' => true,
'picture' => true,
@@ -161,8 +159,7 @@ public function testRender(): void
-EOT
- ,
+EOT,
$renderer->render($mockWebpDocument, [
'noProcess' => true,
'picture' => true,
@@ -176,8 +173,7 @@ public function testRender(): void
-EOT
- ,
+EOT,
$renderer->render($mockDocument, [
'absolute' => true,
'noProcess' => true,
diff --git a/lib/Documents/tests/Renderer/SvgRendererTest.php b/lib/Documents/tests/Renderer/SvgRendererTest.php
index 232f2a173..202d16dd6 100644
--- a/lib/Documents/tests/Renderer/SvgRendererTest.php
+++ b/lib/Documents/tests/Renderer/SvgRendererTest.php
@@ -67,8 +67,7 @@ public function testRender(): void
$this->assertHtmlTidyEquals(
<<
-EOT
- ,
+EOT,
$renderer->render($mockDocument, [])
);
}
diff --git a/lib/Documents/tests/Renderer/VideoRendererTest.php b/lib/Documents/tests/Renderer/VideoRendererTest.php
index 7d80fe088..eadf6df9d 100644
--- a/lib/Documents/tests/Renderer/VideoRendererTest.php
+++ b/lib/Documents/tests/Renderer/VideoRendererTest.php
@@ -75,8 +75,7 @@ public function testRender(): void
Your browser does not support native video.
-EOT
- ,
+EOT,
$renderer->render($mockDocument, [])
);
@@ -86,8 +85,7 @@ public function testRender(): void
Your browser does not support native video.
-EOT
- ,
+EOT,
$renderer->render($mockDocument2, [])
);
@@ -98,8 +96,7 @@ public function testRender(): void
Your browser does not support native video.
-EOT
- ,
+EOT,
$renderer->render($mockDocument, [
'controls' => true,
'loop' => true,
@@ -114,8 +111,7 @@ public function testRender(): void
Your browser does not support native video.
-EOT
- ,
+EOT,
$renderer->render($mockDocument, [
'controls' => true,
'loop' => true,
@@ -131,8 +127,7 @@ public function testRender(): void
Your browser does not support native video.
-EOT
- ,
+EOT,
$renderer->render($mockDocument, [
'controls' => false,
])
diff --git a/lib/DtsGenerator/src/Generators/NodeTypeGenerator.php b/lib/DtsGenerator/src/Generators/NodeTypeGenerator.php
index 4c2b2053c..101024a30 100644
--- a/lib/DtsGenerator/src/Generators/NodeTypeGenerator.php
+++ b/lib/DtsGenerator/src/Generators/NodeTypeGenerator.php
@@ -51,7 +51,7 @@ public function getContents(): string
]);
}
- protected function getInterfaceBody(): string
+ private function getInterfaceBody(): string
{
$lines = [
'export interface '.$this->nodeType->getSourceEntityClassName().' extends RoadizNodesSources {',
@@ -62,7 +62,7 @@ protected function getInterfaceBody(): string
return implode(PHP_EOL, $lines);
}
- protected function getIntroduction(): string
+ private function getIntroduction(): string
{
$lines = [
'',
@@ -82,7 +82,7 @@ protected function getIntroduction(): string
}, $lines));
}
- protected function getFieldsContents(): string
+ private function getFieldsContents(): string
{
return implode(PHP_EOL, array_map(function (AbstractFieldGenerator $abstractFieldGenerator) {
return $abstractFieldGenerator->getContents();
diff --git a/lib/EntityGenerator/composer.json b/lib/EntityGenerator/composer.json
index 6f0cbdd29..86fd753f5 100644
--- a/lib/EntityGenerator/composer.json
+++ b/lib/EntityGenerator/composer.json
@@ -38,7 +38,7 @@
"phpstan/phpstan": "^1.5.3",
"phpstan/phpdoc-parser": "<2",
"phpunit/phpunit": "^9.5",
- "api-platform/core": "~3.3.11"
+ "api-platform/core": "~3.4.17"
},
"extra": {
"branch-alias": {
diff --git a/lib/Models/src/Core/AbstractEntities/AbstractDateTimed.php b/lib/Models/src/Core/AbstractEntities/AbstractDateTimed.php
index 90449e328..abd49e620 100644
--- a/lib/Models/src/Core/AbstractEntities/AbstractDateTimed.php
+++ b/lib/Models/src/Core/AbstractEntities/AbstractDateTimed.php
@@ -11,27 +11,21 @@
/**
* An AbstractEntity with datetime fields to keep track of time with your items.
*/
-#[
- ORM\MappedSuperclass,
+#[ORM\MappedSuperclass,
ORM\HasLifecycleCallbacks,
ORM\Table,
ORM\Index(columns: ['created_at']),
- ORM\Index(columns: ['updated_at']),
-]
+ ORM\Index(columns: ['updated_at']),]
abstract class AbstractDateTimed extends AbstractEntity
{
- #[
- ORM\Column(name: 'created_at', type: 'datetime', nullable: true),
+ #[ORM\Column(name: 'created_at', type: 'datetime', nullable: true),
Serializer\Groups(['timestamps']),
- SymfonySerializer\Groups(['timestamps']),
- ]
+ SymfonySerializer\Groups(['timestamps']),]
protected ?\DateTime $createdAt = null;
- #[
- ORM\Column(name: 'updated_at', type: 'datetime', nullable: true),
+ #[ORM\Column(name: 'updated_at', type: 'datetime', nullable: true),
Serializer\Groups(['timestamps']),
- SymfonySerializer\Groups(['timestamps']),
- ]
+ SymfonySerializer\Groups(['timestamps']),]
protected ?\DateTime $updatedAt = null;
public function getCreatedAt(): ?\DateTime
diff --git a/lib/Models/src/Core/AbstractEntities/AbstractEntity.php b/lib/Models/src/Core/AbstractEntities/AbstractEntity.php
index 49b5b870c..dd59d79ab 100644
--- a/lib/Models/src/Core/AbstractEntities/AbstractEntity.php
+++ b/lib/Models/src/Core/AbstractEntities/AbstractEntity.php
@@ -11,20 +11,16 @@
/**
* Base entity implementing PersistableInterface to offer a unique ID.
*/
-#[
- ORM\MappedSuperclass,
- ORM\Table
-]
+#[ORM\MappedSuperclass,
+ ORM\Table]
abstract class AbstractEntity implements PersistableInterface
{
- #[
- ORM\Id,
+ #[ORM\Id,
ORM\Column(type: 'integer'),
ORM\GeneratedValue,
Serializer\Groups(['id']),
Serializer\Type('integer'),
- SymfonySerializer\Groups(['id'])
- ]
+ SymfonySerializer\Groups(['id'])]
protected int|string|null $id = null;
public function getId(): int|string|null
diff --git a/lib/Models/src/Core/AbstractEntities/AbstractHuman.php b/lib/Models/src/Core/AbstractEntities/AbstractHuman.php
index 258fdcc24..f2549f4d5 100644
--- a/lib/Models/src/Core/AbstractEntities/AbstractHuman.php
+++ b/lib/Models/src/Core/AbstractEntities/AbstractHuman.php
@@ -14,57 +14,45 @@
*
* This class can be extended for *Users*, *Subscribers*, etc.
*/
-#[
- ORM\MappedSuperclass,
+#[ORM\MappedSuperclass,
ORM\Table,
- ORM\HasLifecycleCallbacks
-]
+ ORM\HasLifecycleCallbacks]
abstract class AbstractHuman extends AbstractDateTimed
{
- #[
- ORM\Column(type: 'string', length: 200, unique: true),
+ #[ORM\Column(type: 'string', length: 200, unique: true),
Serializer\Groups(['user_personal', 'human']),
SymfonySerializer\Groups(['user_personal', 'human']),
Assert\NotNull(),
Assert\NotBlank(),
Assert\Length(max: 200),
- Assert\Email()
- ]
+ Assert\Email()]
protected ?string $email = null;
/**
* Public name (pseudonyme) that can be displayed to a public audience.
*/
- #[
- ORM\Column(name: 'publicName', type: 'string', length: 250, nullable: true),
+ #[ORM\Column(name: 'publicName', type: 'string', length: 250, nullable: true),
Serializer\Groups(['user_public', 'human']),
SymfonySerializer\Groups(['user_public', 'human']),
- Assert\Length(max: 250)
- ]
+ Assert\Length(max: 250)]
protected ?string $publicName = null;
- #[
- ORM\Column(name: 'firstName', type: 'string', length: 250, nullable: true),
+ #[ORM\Column(name: 'firstName', type: 'string', length: 250, nullable: true),
Serializer\Groups(['user_personal', 'human']),
SymfonySerializer\Groups(['user_personal', 'human']),
- Assert\Length(max: 250)
- ]
+ Assert\Length(max: 250)]
protected ?string $firstName = null;
- #[
- ORM\Column(name: 'lastName', type: 'string', length: 250, nullable: true),
+ #[ORM\Column(name: 'lastName', type: 'string', length: 250, nullable: true),
Serializer\Groups(['user_personal', 'human']),
SymfonySerializer\Groups(['user_personal', 'human']),
- Assert\Length(max: 250)
- ]
+ Assert\Length(max: 250)]
protected ?string $lastName = null;
- #[
- ORM\Column(type: 'string', length: 250, nullable: true),
+ #[ORM\Column(type: 'string', length: 250, nullable: true),
Serializer\Groups(['user_personal', 'human']),
SymfonySerializer\Groups(['user_personal', 'human']),
- Assert\Length(max: 250)
- ]
+ Assert\Length(max: 250)]
protected ?string $company = null;
public function getEmail(): ?string
diff --git a/lib/Models/src/Core/AbstractEntities/AbstractPositioned.php b/lib/Models/src/Core/AbstractEntities/AbstractPositioned.php
index e0b934c7f..955978ae6 100644
--- a/lib/Models/src/Core/AbstractEntities/AbstractPositioned.php
+++ b/lib/Models/src/Core/AbstractEntities/AbstractPositioned.php
@@ -12,21 +12,17 @@
/**
* Combined AbstractEntity and PositionedTrait.
*/
-#[
- ORM\MappedSuperclass,
+#[ORM\MappedSuperclass,
ORM\HasLifecycleCallbacks,
ORM\Table,
- ORM\Index(columns: ['position'])
-]
+ ORM\Index(columns: ['position'])]
abstract class AbstractPositioned extends AbstractEntity implements PositionedInterface, Comparable
{
use PositionedTrait;
- #[
- ORM\Column(type: 'float'),
+ #[ORM\Column(type: 'float'),
Serializer\Groups(['position']),
SymfonySerializer\Groups(['position']),
- Serializer\Type('float')
- ]
+ Serializer\Type('float')]
protected float $position = 0.0;
}
diff --git a/lib/Models/src/Utils/StringHandler.php b/lib/Models/src/Utils/StringHandler.php
index 2b0e1d4aa..278a188df 100644
--- a/lib/Models/src/Utils/StringHandler.php
+++ b/lib/Models/src/Utils/StringHandler.php
@@ -131,9 +131,8 @@ public static function encodeWithSecret(?string $value, ?string $secret): string
$secret = crypt($secret, $secret);
return base64_encode($secret.base64_encode(strip_tags($value ?? '')));
- } else {
- throw new \InvalidArgumentException('You cannot encode with an empty salt. Did you enter a secret security phrase in your conf/config.json file?', 1);
}
+ throw new \InvalidArgumentException('You cannot encode with an empty salt. Did you enter a secret security phrase in your conf/config.json file?', 1);
}
/**
@@ -155,9 +154,8 @@ public static function decodeWithSecret(?string $value, ?string $secret): string
$nonSalted = str_replace($secret, '', $salted);
return base64_decode($nonSalted);
- } else {
- throw new \InvalidArgumentException('You cannot encode with an empty salt. Did you enter a secret security phrase in your conf/config.json file?', 1);
}
+ throw new \InvalidArgumentException('You cannot encode with an empty salt. Did you enter a secret security phrase in your conf/config.json file?', 1);
}
/**
diff --git a/lib/OpenId/src/Authentication/OpenIdAuthenticator.php b/lib/OpenId/src/Authentication/OpenIdAuthenticator.php
index 26e96c758..1dbad35c6 100644
--- a/lib/OpenId/src/Authentication/OpenIdAuthenticator.php
+++ b/lib/OpenId/src/Authentication/OpenIdAuthenticator.php
@@ -154,7 +154,7 @@ public function authenticate(Request $request): Passport
$jwt = $configuration->parser()->parse($jsonResponse['id_token']);
- if (!($jwt instanceof Plain)) {
+ if (!$jwt instanceof Plain) {
throw new OpenIdAuthenticationException('JWT token must be instance of '.Plain::class);
}
diff --git a/lib/OpenId/src/Authentication/Provider/ChainJwtRoleStrategy.php b/lib/OpenId/src/Authentication/Provider/ChainJwtRoleStrategy.php
index 925263cb0..35f996bf7 100644
--- a/lib/OpenId/src/Authentication/Provider/ChainJwtRoleStrategy.php
+++ b/lib/OpenId/src/Authentication/Provider/ChainJwtRoleStrategy.php
@@ -12,7 +12,7 @@
public function __construct(private array $strategies)
{
foreach ($this->strategies as $strategy) {
- if (!($strategy instanceof JwtRoleStrategy)) {
+ if (!$strategy instanceof JwtRoleStrategy) {
throw new \InvalidArgumentException('Strategy must implement '.JwtRoleStrategy::class);
}
}
diff --git a/lib/OpenId/src/OpenIdJwtConfigurationFactory.php b/lib/OpenId/src/OpenIdJwtConfigurationFactory.php
index 93e76d2d0..1e7814ffc 100644
--- a/lib/OpenId/src/OpenIdJwtConfigurationFactory.php
+++ b/lib/OpenId/src/OpenIdJwtConfigurationFactory.php
@@ -31,7 +31,7 @@ public function __construct(
/**
* @return Constraint[]
*/
- protected function getValidationConstraints(): array
+ private function getValidationConstraints(): array
{
$validators = [
new LooseValidAt(SystemClock::fromSystemTimezone()),
diff --git a/lib/OpenId/src/User/OpenIdAccount.php b/lib/OpenId/src/User/OpenIdAccount.php
index c0a026f7a..2d8d61233 100644
--- a/lib/OpenId/src/User/OpenIdAccount.php
+++ b/lib/OpenId/src/User/OpenIdAccount.php
@@ -71,7 +71,7 @@ public function __construct(
$this->roles = $roles;
$this->email = $email;
$this->jwtToken = $jwtToken;
- if (!($jwtToken instanceof Token\Plain)) {
+ if (!$jwtToken instanceof Token\Plain) {
throw new \InvalidArgumentException('Token must be an instance of '.Token\Plain::class);
}
/*
@@ -133,7 +133,6 @@ public function getUsername(): string
public function eraseCredentials(): void
{
- return;
}
public function getEmail(): ?string
diff --git a/lib/RoadizCompatBundle/src/Controller/Controller.php b/lib/RoadizCompatBundle/src/Controller/Controller.php
index 5348267f7..53575b207 100644
--- a/lib/RoadizCompatBundle/src/Controller/Controller.php
+++ b/lib/RoadizCompatBundle/src/Controller/Controller.php
@@ -293,9 +293,8 @@ public function render(string $view, array $parameters = [], ?Response $response
} catch (RuntimeError $e) {
if ($e->getPrevious() instanceof ForceResponseException) {
return $e->getPrevious()->getResponse();
- } else {
- throw $e;
}
+ throw $e;
}
}
diff --git a/lib/RoadizCompatBundle/src/EventSubscriber/ExceptionSubscriber.php b/lib/RoadizCompatBundle/src/EventSubscriber/ExceptionSubscriber.php
index b133e38df..ca6656299 100644
--- a/lib/RoadizCompatBundle/src/EventSubscriber/ExceptionSubscriber.php
+++ b/lib/RoadizCompatBundle/src/EventSubscriber/ExceptionSubscriber.php
@@ -145,7 +145,7 @@ public function onKernelException(ExceptionEvent $event): void
}
}
- protected function isNotFoundExceptionWithTheme(ExceptionEvent $event): ?Theme
+ private function isNotFoundExceptionWithTheme(ExceptionEvent $event): ?Theme
{
$exception = $event->getThrowable();
$request = $event->getRequest();
@@ -182,7 +182,7 @@ protected function isNotFoundExceptionWithTheme(ExceptionEvent $event): ?Theme
* @throws \Throwable
* @throws SyntaxError
*/
- protected function createThemeNotFoundResponse(Theme $theme, \Throwable $exception, ExceptionEvent $event): Response
+ private function createThemeNotFoundResponse(Theme $theme, \Throwable $exception, ExceptionEvent $event): Response
{
$ctrlClass = $theme->getClassName();
$controller = new $ctrlClass();
diff --git a/lib/RoadizCompatBundle/src/Theme/StaticThemeResolver.php b/lib/RoadizCompatBundle/src/Theme/StaticThemeResolver.php
index 4407a5077..1f85a9d25 100644
--- a/lib/RoadizCompatBundle/src/Theme/StaticThemeResolver.php
+++ b/lib/RoadizCompatBundle/src/Theme/StaticThemeResolver.php
@@ -112,8 +112,8 @@ public static function compareThemePriority(Theme $themeA, Theme $themeB): int
}
if (call_user_func([$classA, 'getPriority']) > call_user_func([$classB, 'getPriority'])) {
return 1;
- } else {
- return -1;
}
+
+ return -1;
}
}
diff --git a/lib/RoadizCompatBundle/src/Theme/ThemeGenerator.php b/lib/RoadizCompatBundle/src/Theme/ThemeGenerator.php
index db87ae3f8..0e86fd3d1 100644
--- a/lib/RoadizCompatBundle/src/Theme/ThemeGenerator.php
+++ b/lib/RoadizCompatBundle/src/Theme/ThemeGenerator.php
@@ -41,12 +41,11 @@ public function installThemeAssets(ThemeInfo $themeInfo, string $expectedMethod)
return $this->relativeSymlinkWithFallback($originDir, $targetDir);
} elseif (static::METHOD_ABSOLUTE_SYMLINK === $expectedMethod) {
return $this->absoluteSymlinkWithFallback($originDir, $targetDir);
- } else {
- return $this->hardCopy($originDir, $targetDir);
}
- } else {
- $this->logger->info($themeInfo->getThemeName().' assets are already public.');
+
+ return $this->hardCopy($originDir, $targetDir);
}
+ $this->logger->info($themeInfo->getThemeName().' assets are already public.');
}
return null;
diff --git a/lib/RoadizCompatBundle/src/Theme/ThemeInfo.php b/lib/RoadizCompatBundle/src/Theme/ThemeInfo.php
index 89df90cb6..03a9feb69 100644
--- a/lib/RoadizCompatBundle/src/Theme/ThemeInfo.php
+++ b/lib/RoadizCompatBundle/src/Theme/ThemeInfo.php
@@ -53,7 +53,7 @@ public function isProtected(): bool
*
* @throws ThemeClassNotValidException
*/
- protected function guessClassnameFromThemeName(string $themeName): string
+ private function guessClassnameFromThemeName(string $themeName): string
{
$className = match ($themeName) {
'RozierApp', 'RozierTheme', 'Rozier' => '\\Themes\\Rozier\\RozierApp',
@@ -62,9 +62,8 @@ protected function guessClassnameFromThemeName(string $themeName): string
if (class_exists($className)) {
return $className;
- } else {
- throw new ThemeClassNotValidException(sprintf('“%s” theme is not available in your project.', $className));
}
+ throw new ThemeClassNotValidException(sprintf('“%s” theme is not available in your project.', $className));
}
/**
@@ -72,7 +71,7 @@ protected function guessClassnameFromThemeName(string $themeName): string
*
* @throws ThemeClassNotValidException
*/
- protected function extractNameFromClassname(string $classname): string
+ private function extractNameFromClassname(string $classname): string
{
$shortName = $this->getThemeReflectionClass($classname)->getShortName();
@@ -86,7 +85,7 @@ protected function extractNameFromClassname(string $classname): string
*
* @throws ThemeClassNotValidException
*/
- protected function validateClassname(string $classname): string
+ private function validateClassname(string $classname): string
{
if (null !== $reflection = $this->getThemeReflectionClass($classname)) {
/** @var class-string $class */
@@ -98,7 +97,7 @@ protected function validateClassname(string $classname): string
throw new \RuntimeException('Theme class '.$classname.' does not exist.');
}
- protected function validateName(string $name): string
+ private function validateName(string $name): string
{
if (1 !== preg_match('#^[A-Z][a-zA-Z]+$#', $name)) {
throw new LogicException('Theme name must only contain alphabetical characters and begin with uppercase letter.');
@@ -129,7 +128,7 @@ public function exists(): bool
return false;
}
- protected function getProtectedThemePath(): string
+ private function getProtectedThemePath(): string
{
if ($this->filesystem->exists($this->projectDir.'/vendor/roadiz/'.$this->getThemeName())) {
return $this->projectDir.'/vendor/roadiz/'.$this->getThemeName();
@@ -188,7 +187,7 @@ public function getThemeReflectionClass(?string $className = null): ?\Reflection
return null;
}
- protected function getThemeNameFromName(): string
+ private function getThemeNameFromName(): string
{
if (in_array($this->name, self::$protectedThemeNames)) {
return $this->name;
diff --git a/lib/RoadizCoreBundle/composer.json b/lib/RoadizCoreBundle/composer.json
index 794a43ccc..eb9f40f0e 100644
--- a/lib/RoadizCoreBundle/composer.json
+++ b/lib/RoadizCoreBundle/composer.json
@@ -24,7 +24,7 @@
"ext-zip": "*",
"ext-json": "*",
"ext-mbstring": "*",
- "api-platform/core": "~3.3.11",
+ "api-platform/core": "~3.4.17",
"doctrine/annotations": "^2.0",
"doctrine/doctrine-bundle": "^2.8.1",
"doctrine/doctrine-migrations-bundle": "^3.1",
diff --git a/lib/RoadizCoreBundle/config/packages/roadiz_core.yaml b/lib/RoadizCoreBundle/config/packages/roadiz_core.yaml
index 376c7274c..5998e380f 100644
--- a/lib/RoadizCoreBundle/config/packages/roadiz_core.yaml
+++ b/lib/RoadizCoreBundle/config/packages/roadiz_core.yaml
@@ -29,6 +29,9 @@ roadiz_core:
domainName: '%env(string:VARNISH_DOMAIN)%'
solr:
timeout: 3
+ search:
+ fuzzy_proximity: 2
+ fuzzy_min_term_length: 3
endpoints:
docker:
host: '%env(string:SOLR_HOST)%'
diff --git a/lib/RoadizCoreBundle/config/services.yaml b/lib/RoadizCoreBundle/config/services.yaml
index 2d23b22eb..8ac33430a 100644
--- a/lib/RoadizCoreBundle/config/services.yaml
+++ b/lib/RoadizCoreBundle/config/services.yaml
@@ -51,6 +51,8 @@ services:
$useGravatar: '%roadiz_core.use_gravatar%'
$useReplyTo: '%roadiz_core.use_email_reply_to%'
$helpExternalUrl: '%roadiz_core.help_external_url%'
+ $fuzzyProximity: '%roadiz_core.solr.search.fuzzy_proximity%'
+ $fuzzyMinTermLength: '%roadiz_core.solr.search.fuzzy_min_term_length%'
RZ\Roadiz\CoreBundle\:
resource: '../src/'
diff --git a/lib/RoadizCoreBundle/src/Api/Extension/AttributeValueQueryExtension.php b/lib/RoadizCoreBundle/src/Api/Extension/AttributeValueQueryExtension.php
index ad8ad4b55..a4d8f54c2 100644
--- a/lib/RoadizCoreBundle/src/Api/Extension/AttributeValueQueryExtension.php
+++ b/lib/RoadizCoreBundle/src/Api/Extension/AttributeValueQueryExtension.php
@@ -77,7 +77,5 @@ private function apply(
$queryBuilder
->andWhere($queryBuilder->expr()->eq($joinAlias.'.status', ':status'))
->setParameter(':status', NodeStatus::PUBLISHED);
-
- return;
}
}
diff --git a/lib/RoadizCoreBundle/src/Api/Extension/NodeQueryExtension.php b/lib/RoadizCoreBundle/src/Api/Extension/NodeQueryExtension.php
index 65c08c959..e322344d0 100644
--- a/lib/RoadizCoreBundle/src/Api/Extension/NodeQueryExtension.php
+++ b/lib/RoadizCoreBundle/src/Api/Extension/NodeQueryExtension.php
@@ -62,8 +62,6 @@ private function apply(
->andWhere($queryBuilder->expr()->eq('o.status', ':status'))
->setParameter(':lte_published_at', new \DateTime())
->setParameter(':status', NodeStatus::PUBLISHED);
-
- return;
}
public function applyToCollection(
diff --git a/lib/RoadizCoreBundle/src/Api/Extension/NodesTagsQueryExtension.php b/lib/RoadizCoreBundle/src/Api/Extension/NodesTagsQueryExtension.php
index c61c1f1b2..980464cf4 100644
--- a/lib/RoadizCoreBundle/src/Api/Extension/NodesTagsQueryExtension.php
+++ b/lib/RoadizCoreBundle/src/Api/Extension/NodesTagsQueryExtension.php
@@ -82,7 +82,5 @@ private function apply(
$queryBuilder
->andWhere($queryBuilder->expr()->eq($existingNodeJoin->getAlias().'.status', ':status'))
->setParameter(':status', NodeStatus::PUBLISHED);
-
- return;
}
}
diff --git a/lib/RoadizCoreBundle/src/Api/ListManager/SolrPaginator.php b/lib/RoadizCoreBundle/src/Api/ListManager/SolrPaginator.php
index 5056d1409..97c770757 100644
--- a/lib/RoadizCoreBundle/src/Api/ListManager/SolrPaginator.php
+++ b/lib/RoadizCoreBundle/src/Api/ListManager/SolrPaginator.php
@@ -16,7 +16,7 @@ public function __construct(private readonly SolrSearchListManager $listManager)
{
}
- protected function handleOnce(): void
+ private function handleOnce(): void
{
if (false === $this->handled) {
$this->listManager->handle();
diff --git a/lib/RoadizCoreBundle/src/Api/TreeWalker/Definition/MultiTypeChildrenDefinition.php b/lib/RoadizCoreBundle/src/Api/TreeWalker/Definition/MultiTypeChildrenDefinition.php
index 94534396e..26aaa7d86 100644
--- a/lib/RoadizCoreBundle/src/Api/TreeWalker/Definition/MultiTypeChildrenDefinition.php
+++ b/lib/RoadizCoreBundle/src/Api/TreeWalker/Definition/MultiTypeChildrenDefinition.php
@@ -41,7 +41,7 @@ protected function getNodeTypes(NodeTypes $nodeTypesBag): array
*/
public function __invoke(NodesSources $source): array
{
- if (!($this->context instanceof NodeSourceWalkerContext)) {
+ if (!$this->context instanceof NodeSourceWalkerContext) {
throw new \InvalidArgumentException('Context should be instance of '.NodeSourceWalkerContext::class);
}
diff --git a/lib/RoadizCoreBundle/src/Api/TreeWalker/Definition/NodeSourceDefinitionTrait.php b/lib/RoadizCoreBundle/src/Api/TreeWalker/Definition/NodeSourceDefinitionTrait.php
index 246b891ab..eda850d35 100644
--- a/lib/RoadizCoreBundle/src/Api/TreeWalker/Definition/NodeSourceDefinitionTrait.php
+++ b/lib/RoadizCoreBundle/src/Api/TreeWalker/Definition/NodeSourceDefinitionTrait.php
@@ -23,7 +23,7 @@ protected function getQueryBuilder(
NodesSources $parent,
bool $onlyVisible = true,
): QueryBuilder {
- if (!($this->context instanceof NodeSourceWalkerContext)) {
+ if (!$this->context instanceof NodeSourceWalkerContext) {
throw new \InvalidArgumentException('Context should be instance of '.NodeSourceWalkerContext::class);
}
diff --git a/lib/RoadizCoreBundle/src/Api/TreeWalker/Definition/NonReachableNodeSourceBlockDefinition.php b/lib/RoadizCoreBundle/src/Api/TreeWalker/Definition/NonReachableNodeSourceBlockDefinition.php
index a519daaa1..fa1b12ffb 100644
--- a/lib/RoadizCoreBundle/src/Api/TreeWalker/Definition/NonReachableNodeSourceBlockDefinition.php
+++ b/lib/RoadizCoreBundle/src/Api/TreeWalker/Definition/NonReachableNodeSourceBlockDefinition.php
@@ -35,7 +35,7 @@ protected function getNodeTypes(NodeTypes $nodeTypesBag): array
*/
public function __invoke(NodesSources $source): array
{
- if (!($this->context instanceof NodeSourceWalkerContext)) {
+ if (!$this->context instanceof NodeSourceWalkerContext) {
throw new \InvalidArgumentException('Context should be instance of '.NodeSourceWalkerContext::class);
}
diff --git a/lib/RoadizCoreBundle/src/Api/TreeWalker/Definition/ReachableNodeSourceDefinition.php b/lib/RoadizCoreBundle/src/Api/TreeWalker/Definition/ReachableNodeSourceDefinition.php
index d5772eae5..f2da9312b 100644
--- a/lib/RoadizCoreBundle/src/Api/TreeWalker/Definition/ReachableNodeSourceDefinition.php
+++ b/lib/RoadizCoreBundle/src/Api/TreeWalker/Definition/ReachableNodeSourceDefinition.php
@@ -35,7 +35,7 @@ protected function getNodeTypes(NodeTypes $nodeTypesBag): array
*/
public function __invoke(NodesSources $source): array
{
- if (!($this->context instanceof NodeSourceWalkerContext)) {
+ if (!$this->context instanceof NodeSourceWalkerContext) {
throw new \InvalidArgumentException('Context should be instance of '.NodeSourceWalkerContext::class);
}
diff --git a/lib/RoadizCoreBundle/src/Bag/DecoratedNodeTypes.php b/lib/RoadizCoreBundle/src/Bag/DecoratedNodeTypes.php
index 903ee0e80..c219372dd 100644
--- a/lib/RoadizCoreBundle/src/Bag/DecoratedNodeTypes.php
+++ b/lib/RoadizCoreBundle/src/Bag/DecoratedNodeTypes.php
@@ -95,9 +95,9 @@ public function allSorted(?string $sort = 'ASC'): array
usort($nodeTypes, function (NodeType $a, NodeType $b) use ($sort) {
if ('DESC' !== $sort) {
return strcmp($a->getName(), $b->getName());
- } else {
- return strcmp($b->getName(), $a->getName());
}
+
+ return strcmp($b->getName(), $a->getName());
});
return $nodeTypes;
diff --git a/lib/RoadizCoreBundle/src/Cache/Clearer/OPCacheClearer.php b/lib/RoadizCoreBundle/src/Cache/Clearer/OPCacheClearer.php
index c9a8cadd7..8caf23e89 100644
--- a/lib/RoadizCoreBundle/src/Cache/Clearer/OPCacheClearer.php
+++ b/lib/RoadizCoreBundle/src/Cache/Clearer/OPCacheClearer.php
@@ -6,7 +6,7 @@
final class OPCacheClearer implements ClearerInterface
{
- protected string $output;
+ private string $output;
public function clear(): bool
{
@@ -22,9 +22,8 @@ public function clear(): bool
$this->output = 'PHP OPCache has been reset.';
return true;
- } else {
- $this->output = 'PHP OPCache is disabled.';
}
+ $this->output = 'PHP OPCache is disabled.';
return false;
}
diff --git a/lib/RoadizCoreBundle/src/Captcha/FriendlyCaptchaService.php b/lib/RoadizCoreBundle/src/Captcha/FriendlyCaptchaService.php
index 26242dd25..af240ea34 100644
--- a/lib/RoadizCoreBundle/src/Captcha/FriendlyCaptchaService.php
+++ b/lib/RoadizCoreBundle/src/Captcha/FriendlyCaptchaService.php
@@ -14,10 +14,10 @@
{
public function __construct(
private HttpClientInterface $client,
- protected ?string $publicKey,
+ private ?string $publicKey,
#[\SensitiveParameter]
- protected ?string $privateKey,
- protected ?string $verifyUrl = 'https://global.frcapi.com/api/v2/captcha/siteverify',
+ private ?string $privateKey,
+ private ?string $verifyUrl = 'https://global.frcapi.com/api/v2/captcha/siteverify',
) {
}
diff --git a/lib/RoadizCoreBundle/src/Captcha/GoogleRecaptchaService.php b/lib/RoadizCoreBundle/src/Captcha/GoogleRecaptchaService.php
index a7fa18f43..37040b727 100644
--- a/lib/RoadizCoreBundle/src/Captcha/GoogleRecaptchaService.php
+++ b/lib/RoadizCoreBundle/src/Captcha/GoogleRecaptchaService.php
@@ -14,10 +14,10 @@
{
public function __construct(
private HttpClientInterface $client,
- protected ?string $publicKey,
+ private ?string $publicKey,
#[\SensitiveParameter]
- protected ?string $privateKey,
- protected ?string $verifyUrl = 'https://www.google.com/recaptcha/api/siteverify',
+ private ?string $privateKey,
+ private ?string $verifyUrl = 'https://www.google.com/recaptcha/api/siteverify',
) {
}
diff --git a/lib/RoadizCoreBundle/src/Captcha/HCaptchaService.php b/lib/RoadizCoreBundle/src/Captcha/HCaptchaService.php
index 4919b375d..79d399601 100644
--- a/lib/RoadizCoreBundle/src/Captcha/HCaptchaService.php
+++ b/lib/RoadizCoreBundle/src/Captcha/HCaptchaService.php
@@ -14,10 +14,10 @@
{
public function __construct(
private HttpClientInterface $client,
- protected ?string $publicKey,
+ private ?string $publicKey,
#[\SensitiveParameter]
- protected ?string $privateKey,
- protected ?string $verifyUrl = 'https://api.hcaptcha.com/siteverify',
+ private ?string $privateKey,
+ private ?string $verifyUrl = 'https://api.hcaptcha.com/siteverify',
) {
}
diff --git a/lib/RoadizCoreBundle/src/Captcha/TurnstileCaptchaService.php b/lib/RoadizCoreBundle/src/Captcha/TurnstileCaptchaService.php
index 72b9eb68a..48a4834a0 100644
--- a/lib/RoadizCoreBundle/src/Captcha/TurnstileCaptchaService.php
+++ b/lib/RoadizCoreBundle/src/Captcha/TurnstileCaptchaService.php
@@ -14,10 +14,10 @@
{
public function __construct(
private HttpClientInterface $client,
- protected ?string $publicKey,
+ private ?string $publicKey,
#[\SensitiveParameter]
- protected ?string $privateKey,
- protected ?string $verifyUrl = 'https://challenges.cloudflare.com/turnstile/v0/siteverify',
+ private ?string $privateKey,
+ private ?string $verifyUrl = 'https://challenges.cloudflare.com/turnstile/v0/siteverify',
) {
}
diff --git a/lib/RoadizCoreBundle/src/Console/GetCronLastExecDateCommand.php b/lib/RoadizCoreBundle/src/Console/GetCronLastExecDateCommand.php
index 9cc65f307..e981fe9fc 100644
--- a/lib/RoadizCoreBundle/src/Console/GetCronLastExecDateCommand.php
+++ b/lib/RoadizCoreBundle/src/Console/GetCronLastExecDateCommand.php
@@ -30,7 +30,7 @@ protected function execute(InputInterface $input, OutputInterface $output): int
$io = new SymfonyStyle($input, $output);
$setting = $this->settingRepository->findOneByName('cron_last_exec_date');
- if (!($setting instanceof Setting)) {
+ if (!$setting instanceof Setting) {
$io->warning('Last execution date of cron job has not been persisted yet.');
return Command::FAILURE;
diff --git a/lib/RoadizCoreBundle/src/Console/UsersCommand.php b/lib/RoadizCoreBundle/src/Console/UsersCommand.php
index 36de8d56c..4f7c2a4eb 100644
--- a/lib/RoadizCoreBundle/src/Console/UsersCommand.php
+++ b/lib/RoadizCoreBundle/src/Console/UsersCommand.php
@@ -105,7 +105,7 @@ protected function getUserForInput(InputInterface $input): User
->getRepository(User::class)
->findOneBy(['username' => $name]);
- if (!($user instanceof User)) {
+ if (!$user instanceof User) {
throw new InvalidArgumentException('User “'.$name.'” does not exist.');
}
diff --git a/lib/RoadizCoreBundle/src/Console/UsersDeleteCommand.php b/lib/RoadizCoreBundle/src/Console/UsersDeleteCommand.php
index 0f2007faa..1b6bdce30 100644
--- a/lib/RoadizCoreBundle/src/Console/UsersDeleteCommand.php
+++ b/lib/RoadizCoreBundle/src/Console/UsersDeleteCommand.php
@@ -44,10 +44,9 @@ protected function execute(InputInterface $input, OutputInterface $output): int
$io->success('User “'.$name.'” deleted.');
return 0;
- } else {
- $io->warning('User “'.$name.'” was not deleted.');
-
- return 1;
}
+ $io->warning('User “'.$name.'” was not deleted.');
+
+ return 1;
}
}
diff --git a/lib/RoadizCoreBundle/src/Console/UsersDisableCommand.php b/lib/RoadizCoreBundle/src/Console/UsersDisableCommand.php
index 587e8ecfa..effa25b06 100644
--- a/lib/RoadizCoreBundle/src/Console/UsersDisableCommand.php
+++ b/lib/RoadizCoreBundle/src/Console/UsersDisableCommand.php
@@ -44,10 +44,9 @@ protected function execute(InputInterface $input, OutputInterface $output): int
$io->success('User “'.$name.'” disabled.');
return 0;
- } else {
- $io->warning('User “'.$name.'” was not disabled.');
-
- return 1;
}
+ $io->warning('User “'.$name.'” was not disabled.');
+
+ return 1;
}
}
diff --git a/lib/RoadizCoreBundle/src/Console/UsersEnableCommand.php b/lib/RoadizCoreBundle/src/Console/UsersEnableCommand.php
index 11488c5ea..57c667bb9 100644
--- a/lib/RoadizCoreBundle/src/Console/UsersEnableCommand.php
+++ b/lib/RoadizCoreBundle/src/Console/UsersEnableCommand.php
@@ -44,10 +44,9 @@ protected function execute(InputInterface $input, OutputInterface $output): int
$io->success('User “'.$name.'” was enabled.');
return 0;
- } else {
- $io->warning('User “'.$name.'” was not enabled');
-
- return 1;
}
+ $io->warning('User “'.$name.'” was not enabled');
+
+ return 1;
}
}
diff --git a/lib/RoadizCoreBundle/src/Console/UsersExpireCommand.php b/lib/RoadizCoreBundle/src/Console/UsersExpireCommand.php
index c9d865e50..b8b62b968 100644
--- a/lib/RoadizCoreBundle/src/Console/UsersExpireCommand.php
+++ b/lib/RoadizCoreBundle/src/Console/UsersExpireCommand.php
@@ -52,10 +52,9 @@ protected function execute(InputInterface $input, OutputInterface $output): int
$io->success('User “'.$name.'” expiration date was set on '.$expirationDate->format('c').'.');
return 0;
- } else {
- $io->warning('User “'.$name.'” was not updated.');
-
- return 1;
}
+ $io->warning('User “'.$name.'” was not updated.');
+
+ return 1;
}
}
diff --git a/lib/RoadizCoreBundle/src/Console/UsersLockCommand.php b/lib/RoadizCoreBundle/src/Console/UsersLockCommand.php
index 7df7055d4..db666a524 100644
--- a/lib/RoadizCoreBundle/src/Console/UsersLockCommand.php
+++ b/lib/RoadizCoreBundle/src/Console/UsersLockCommand.php
@@ -44,10 +44,9 @@ protected function execute(InputInterface $input, OutputInterface $output): int
$io->success('User “'.$name.'” locked.');
return 0;
- } else {
- $io->warning('User “'.$name.'” was not locked.');
-
- return 1;
}
+ $io->warning('User “'.$name.'” was not locked.');
+
+ return 1;
}
}
diff --git a/lib/RoadizCoreBundle/src/Console/UsersPasswordCommand.php b/lib/RoadizCoreBundle/src/Console/UsersPasswordCommand.php
index 12b160e34..897090350 100644
--- a/lib/RoadizCoreBundle/src/Console/UsersPasswordCommand.php
+++ b/lib/RoadizCoreBundle/src/Console/UsersPasswordCommand.php
@@ -73,10 +73,9 @@ protected function execute(InputInterface $input, OutputInterface $output): int
$io->success('A new password was regenerated for '.$name.': '.$user->getPlainPassword());
return 0;
- } else {
- $io->warning('User password was not changed.');
-
- return 1;
}
+ $io->warning('User password was not changed.');
+
+ return 1;
}
}
diff --git a/lib/RoadizCoreBundle/src/Console/UsersUnexpireCommand.php b/lib/RoadizCoreBundle/src/Console/UsersUnexpireCommand.php
index a3dd50550..d942f554c 100644
--- a/lib/RoadizCoreBundle/src/Console/UsersUnexpireCommand.php
+++ b/lib/RoadizCoreBundle/src/Console/UsersUnexpireCommand.php
@@ -44,10 +44,9 @@ protected function execute(InputInterface $input, OutputInterface $output): int
$io->success('User “'.$name.'” unexpired.');
return 0;
- } else {
- $io->warning('User “'.$name.'” was not updated.');
-
- return 1;
}
+ $io->warning('User “'.$name.'” was not updated.');
+
+ return 1;
}
}
diff --git a/lib/RoadizCoreBundle/src/Console/UsersUnlockCommand.php b/lib/RoadizCoreBundle/src/Console/UsersUnlockCommand.php
index bd4684cbb..1d467aa2d 100644
--- a/lib/RoadizCoreBundle/src/Console/UsersUnlockCommand.php
+++ b/lib/RoadizCoreBundle/src/Console/UsersUnlockCommand.php
@@ -44,10 +44,9 @@ protected function execute(InputInterface $input, OutputInterface $output): int
$io->success('User “'.$name.'” unlocked.');
return 0;
- } else {
- $io->warning('User “'.$name.'” was not unlocked.');
-
- return 1;
}
+ $io->warning('User “'.$name.'” was not unlocked.');
+
+ return 1;
}
}
diff --git a/lib/RoadizCoreBundle/src/Controller/CustomFormController.php b/lib/RoadizCoreBundle/src/Controller/CustomFormController.php
index f878a43d5..b3aed4b56 100644
--- a/lib/RoadizCoreBundle/src/Controller/CustomFormController.php
+++ b/lib/RoadizCoreBundle/src/Controller/CustomFormController.php
@@ -150,9 +150,9 @@ public function addAction(Request $request, int $customFormId): Response
if ($mixed instanceof Response) {
return $mixed;
- } else {
- return $this->render('@RoadizCore/customForm/customForm.html.twig', $mixed);
}
+
+ return $this->render('@RoadizCore/customForm/customForm.html.twig', $mixed);
}
public function sentAction(Request $request, int $customFormId): Response
diff --git a/lib/RoadizCoreBundle/src/CustomForm/CustomFormHelper.php b/lib/RoadizCoreBundle/src/CustomForm/CustomFormHelper.php
index fdf1f958d..1c58c13c3 100644
--- a/lib/RoadizCoreBundle/src/CustomForm/CustomFormHelper.php
+++ b/lib/RoadizCoreBundle/src/CustomForm/CustomFormHelper.php
@@ -154,7 +154,7 @@ public function parseAnswerFormData(
* @throws FilesystemException
* @throws \Exception
*/
- protected function handleUploadedFile(
+ private function handleUploadedFile(
UploadedFile $file,
CustomFormFieldAttribute $fieldAttr,
): ?DocumentInterface {
@@ -169,7 +169,7 @@ protected function handleUploadedFile(
return $document;
}
- protected function getDocumentFolderForCustomForm(): ?Folder
+ private function getDocumentFolderForCustomForm(): ?Folder
{
return $this->em->getRepository(Folder::class)
->findOrCreateByPath(
@@ -189,9 +189,9 @@ private function formValueToString(mixed $rawValue): string
$values = array_map('strip_tags', $values);
return implode(static::ARRAY_SEPARATOR, $values);
- } else {
- return strip_tags((string) $rawValue);
}
+
+ return strip_tags((string) $rawValue);
}
private function getAttribute(CustomFormAnswer $answer, CustomFormField $field): ?CustomFormFieldAttribute
diff --git a/lib/RoadizCoreBundle/src/CustomForm/Message/Handler/CustomFormAnswerNotifyMessageHandler.php b/lib/RoadizCoreBundle/src/CustomForm/Message/Handler/CustomFormAnswerNotifyMessageHandler.php
index f49b8a59f..08d1fd7db 100644
--- a/lib/RoadizCoreBundle/src/CustomForm/Message/Handler/CustomFormAnswerNotifyMessageHandler.php
+++ b/lib/RoadizCoreBundle/src/CustomForm/Message/Handler/CustomFormAnswerNotifyMessageHandler.php
@@ -40,7 +40,7 @@ public function __invoke(CustomFormAnswerNotifyMessage $message): void
->getRepository(CustomFormAnswer::class)
->find($message->getCustomFormAnswerId());
- if (!($answer instanceof CustomFormAnswer)) {
+ if (!$answer instanceof CustomFormAnswer) {
throw new UnrecoverableMessageHandlingException('CustomFormAnswer not found');
}
diff --git a/lib/RoadizCoreBundle/src/DependencyInjection/Configuration.php b/lib/RoadizCoreBundle/src/DependencyInjection/Configuration.php
index ad39336d7..26510fca2 100644
--- a/lib/RoadizCoreBundle/src/DependencyInjection/Configuration.php
+++ b/lib/RoadizCoreBundle/src/DependencyInjection/Configuration.php
@@ -172,6 +172,20 @@ protected function addSolrNode()
$node->children()
->scalarNode('timeout')->defaultValue(3)->end()
+ ->arrayNode('search')
+ ->addDefaultsIfNotSet()
+ ->children()
+ ->integerNode('fuzzy_proximity')
+ ->defaultValue(2)
+ ->min(0)
+ ->max(2)
+ ->end()
+ ->integerNode('fuzzy_min_term_length')
+ ->defaultValue(3)
+ ->min(0)
+ ->end()
+ ->end()
+ ->end()
->arrayNode('endpoints')
->defaultValue([])
->useAttributeAsKey('name')
diff --git a/lib/RoadizCoreBundle/src/DependencyInjection/RoadizCoreExtension.php b/lib/RoadizCoreBundle/src/DependencyInjection/RoadizCoreExtension.php
index b65fc1eb9..4bf938d8d 100644
--- a/lib/RoadizCoreBundle/src/DependencyInjection/RoadizCoreExtension.php
+++ b/lib/RoadizCoreBundle/src/DependencyInjection/RoadizCoreExtension.php
@@ -68,6 +68,8 @@ public function load(array $configs, ContainerBuilder $container): void
$container->setParameter('roadiz_core.use_accept_language_header', $config['useAcceptLanguageHeader']);
$container->setParameter('roadiz_core.web_response_class', $config['webResponseClass']);
$container->setParameter('roadiz_core.preview_required_role_name', $config['previewRequiredRoleName']);
+ $container->setParameter('roadiz_core.solr.search.fuzzy_proximity', $config['solr']['search']['fuzzy_proximity']);
+ $container->setParameter('roadiz_core.solr.search.fuzzy_min_term_length', $config['solr']['search']['fuzzy_min_term_length']);
/*
* Assets config
diff --git a/lib/RoadizCoreBundle/src/Doctrine/EventSubscriber/UserLifeCycleSubscriber.php b/lib/RoadizCoreBundle/src/Doctrine/EventSubscriber/UserLifeCycleSubscriber.php
index fb76baecd..40501239f 100644
--- a/lib/RoadizCoreBundle/src/Doctrine/EventSubscriber/UserLifeCycleSubscriber.php
+++ b/lib/RoadizCoreBundle/src/Doctrine/EventSubscriber/UserLifeCycleSubscriber.php
@@ -72,7 +72,7 @@ public function preUpdate(PreUpdateEventArgs $event): void
}
}
- protected function setPassword(User $user, ?string $plainPassword): void
+ private function setPassword(User $user, ?string $plainPassword): void
{
if (null !== $plainPassword) {
$hasher = $this->passwordHasherFactory->getPasswordHasher($user);
diff --git a/lib/RoadizCoreBundle/src/Doctrine/ORM/Filter/NodesSourcesNodeTypeFilter.php b/lib/RoadizCoreBundle/src/Doctrine/ORM/Filter/NodesSourcesNodeTypeFilter.php
index 974709ffa..9926f09f2 100644
--- a/lib/RoadizCoreBundle/src/Doctrine/ORM/Filter/NodesSourcesNodeTypeFilter.php
+++ b/lib/RoadizCoreBundle/src/Doctrine/ORM/Filter/NodesSourcesNodeTypeFilter.php
@@ -21,7 +21,7 @@ public static function getSubscribedEvents(): array
];
}
- protected function supports(FilterNodesSourcesQueryBuilderCriteriaEvent $event): bool
+ private function supports(FilterNodesSourcesQueryBuilderCriteriaEvent $event): bool
{
return $event->supports()
&& 'node.nodeType' === $event->getProperty()
diff --git a/lib/RoadizCoreBundle/src/Doctrine/ORM/Filter/NodesSourcesReachableFilter.php b/lib/RoadizCoreBundle/src/Doctrine/ORM/Filter/NodesSourcesReachableFilter.php
index 9a0380916..0648ab65f 100644
--- a/lib/RoadizCoreBundle/src/Doctrine/ORM/Filter/NodesSourcesReachableFilter.php
+++ b/lib/RoadizCoreBundle/src/Doctrine/ORM/Filter/NodesSourcesReachableFilter.php
@@ -33,7 +33,7 @@ public static function getSubscribedEvents(): array
];
}
- protected function supports(FilterNodesSourcesQueryBuilderCriteriaEvent $event): bool
+ private function supports(FilterNodesSourcesQueryBuilderCriteriaEvent $event): bool
{
return $event->supports()
&& in_array($event->getProperty(), self::PARAMETER)
diff --git a/lib/RoadizCoreBundle/src/Document/MessageHandler/DocumentExifMessageHandler.php b/lib/RoadizCoreBundle/src/Document/MessageHandler/DocumentExifMessageHandler.php
index 94b38602b..921d7900b 100644
--- a/lib/RoadizCoreBundle/src/Document/MessageHandler/DocumentExifMessageHandler.php
+++ b/lib/RoadizCoreBundle/src/Document/MessageHandler/DocumentExifMessageHandler.php
@@ -97,11 +97,10 @@ private function getDescription(array $exif): ?string
}
return $comment;
- } else {
- foreach ($section as $skey => $value) {
- if ('comment' == \mb_strtolower($skey)) {
- return $value;
- }
+ }
+ foreach ($section as $skey => $value) {
+ if ('comment' == \mb_strtolower($skey)) {
+ return $value;
}
}
}
diff --git a/lib/RoadizCoreBundle/src/Entity/AbstractDateTimedPositioned.php b/lib/RoadizCoreBundle/src/Entity/AbstractDateTimedPositioned.php
index 5151807a4..f90023ff5 100644
--- a/lib/RoadizCoreBundle/src/Entity/AbstractDateTimedPositioned.php
+++ b/lib/RoadizCoreBundle/src/Entity/AbstractDateTimedPositioned.php
@@ -18,25 +18,21 @@
/**
* Combined AbstractDateTimed and PositionedTrait.
*/
-#[
- ORM\MappedSuperclass,
+#[ORM\MappedSuperclass,
ORM\HasLifecycleCallbacks,
ORM\Table,
ORM\Index(columns: ['position']),
ORM\Index(columns: ['created_at']),
- ORM\Index(columns: ['updated_at'])
-]
+ ORM\Index(columns: ['updated_at'])]
abstract class AbstractDateTimedPositioned extends AbstractDateTimed implements PositionedInterface, Comparable
{
use PositionedTrait;
- #[
- ORM\Column(type: 'float'),
+ #[ORM\Column(type: 'float'),
Serializer\Groups(['position']),
Serializer\Type('float'),
SymfonySerializer\Groups(['position']),
ApiFilter(RangeFilter::class),
- ApiFilter(NumericFilter::class)
- ]
+ ApiFilter(NumericFilter::class)]
protected float $position = 0.0;
}
diff --git a/lib/RoadizCoreBundle/src/Entity/AbstractField.php b/lib/RoadizCoreBundle/src/Entity/AbstractField.php
index 452341259..615a83d07 100644
--- a/lib/RoadizCoreBundle/src/Entity/AbstractField.php
+++ b/lib/RoadizCoreBundle/src/Entity/AbstractField.php
@@ -14,14 +14,12 @@
use Symfony\Component\Validator\Constraints as Assert;
use Symfony\Component\Yaml\Yaml;
-#[
- ORM\MappedSuperclass,
+#[ORM\MappedSuperclass,
ORM\Table,
ORM\Index(columns: ['position']),
ORM\Index(columns: ['group_name']),
ORM\Index(columns: ['group_name_canonical']),
- Serializer\ExclusionPolicy('all')
-]
+ Serializer\ExclusionPolicy('all')]
abstract class AbstractField extends AbstractPositioned
{
use FieldTypeTrait;
@@ -329,102 +327,84 @@ abstract class AbstractField extends AbstractPositioned
AbstractField::MARKDOWN_T,
];
- #[
- ORM\Column(name: 'group_name', type: 'string', length: 250, nullable: true),
+ #[ORM\Column(name: 'group_name', type: 'string', length: 250, nullable: true),
Assert\Length(max: 250),
SymfonySerializer\Groups(['node_type', 'node_type:import', 'setting']),
Serializer\Groups(['node_type', 'setting']),
Serializer\Type('string'),
- Serializer\Expose
- ]
+ Serializer\Expose]
protected ?string $groupName = null;
- #[
- ORM\Column(name: 'group_name_canonical', type: 'string', length: 250, nullable: true),
+ #[ORM\Column(name: 'group_name_canonical', type: 'string', length: 250, nullable: true),
Serializer\Groups(['node_type', 'setting']),
SymfonySerializer\Groups(['node_type', 'setting']),
Assert\Length(max: 250),
Serializer\Type('string'),
- Serializer\Expose
- ]
+ Serializer\Expose]
protected ?string $groupNameCanonical = null;
- #[
- ORM\Column(type: 'string', length: 250),
+ #[ORM\Column(type: 'string', length: 250),
Serializer\Expose,
Serializer\Groups(['node_type', 'setting']),
SymfonySerializer\Groups(['node_type', 'node_type:import', 'setting']),
Assert\Length(max: 250),
Serializer\Type('string'),
Assert\NotBlank(),
- Assert\NotNull()
- ]
+ Assert\NotNull()]
protected string $name;
- #[
- ORM\Column(type: 'string', length: 250),
+ #[ORM\Column(type: 'string', length: 250),
Serializer\Expose,
Serializer\Groups(['node_type', 'setting']),
Serializer\Type('string'),
SymfonySerializer\Groups(['node_type', 'node_type:import', 'setting']),
Assert\Length(max: 250),
Assert\NotBlank(),
- Assert\NotNull()
- ]
+ Assert\NotNull()]
protected ?string $label;
- #[
- ORM\Column(type: 'string', length: 250, nullable: true),
+ #[ORM\Column(type: 'string', length: 250, nullable: true),
Serializer\Expose,
Serializer\Groups(['node_type', 'setting']),
SymfonySerializer\Groups(['node_type', 'node_type:import', 'setting']),
Assert\Length(max: 250),
- Serializer\Type('string')
- ]
+ Serializer\Type('string')]
protected ?string $placeholder = null;
- #[
- ORM\Column(type: 'text', nullable: true),
+ #[ORM\Column(type: 'text', nullable: true),
Serializer\Expose,
Serializer\Groups(['node_type', 'setting']),
SymfonySerializer\Groups(['node_type', 'node_type:import', 'setting']),
- Serializer\Type('string')
- ]
+ Serializer\Type('string')]
protected ?string $description = null;
- #[
- ORM\Column(name: 'default_values', type: 'text', nullable: true),
+ #[ORM\Column(name: 'default_values', type: 'text', nullable: true),
Serializer\Groups(['node_type', 'setting']),
SymfonySerializer\Groups(['node_type', 'setting']),
Serializer\Type('string'),
- Serializer\Expose
- ]
+ Serializer\Expose]
protected ?string $defaultValues = null;
- #[
- ORM\Column(
- type: Types::SMALLINT,
- nullable: false,
- enumType: FieldType::class,
- options: ['default' => FieldType::STRING_T]
- ),
+ #[ORM\Column(
+ type: Types::SMALLINT,
+ nullable: false,
+ enumType: FieldType::class,
+ options: ['default' => FieldType::STRING_T]
+ ),
Serializer\Groups(['node_type', 'setting']),
SymfonySerializer\Groups(['node_type', 'setting']),
Serializer\Type('int'),
- Serializer\Expose
- ]
+ Serializer\Expose]
protected FieldType $type = FieldType::STRING_T;
/**
* If current field data should be expanded (for choices and country types).
*/
- #[
- ORM\Column(name: 'expanded', type: 'boolean', nullable: false, options: ['default' => false]),
+ #[ORM\Column(name: 'expanded', type: 'boolean', nullable: false, options: ['default' => false]),
Serializer\Groups(['node_type', 'setting']),
SymfonySerializer\Groups(['node_type', 'node_type:import', 'setting']),
Serializer\Type('bool'),
- Serializer\Expose
- ]
+ Serializer\Expose]
protected bool $expanded = false;
public function __construct()
diff --git a/lib/RoadizCoreBundle/src/Entity/Attribute.php b/lib/RoadizCoreBundle/src/Entity/Attribute.php
index a767c427f..26cb32443 100644
--- a/lib/RoadizCoreBundle/src/Entity/Attribute.php
+++ b/lib/RoadizCoreBundle/src/Entity/Attribute.php
@@ -19,8 +19,7 @@
use Symfony\Component\Validator\Constraints\NotNull;
use Symfony\Component\Validator\Constraints\Range;
-#[
- ORM\Entity(repositoryClass: AttributeRepository::class),
+#[ORM\Entity(repositoryClass: AttributeRepository::class),
ORM\Table(name: 'attributes'),
ORM\Index(columns: ['code']),
ORM\Index(columns: ['type']),
@@ -29,8 +28,7 @@
ORM\Index(columns: ['color']),
ORM\Index(columns: ['group_id']),
ORM\HasLifecycleCallbacks,
- UniqueEntity(fields: ['code']),
-]
+ UniqueEntity(fields: ['code']),]
class Attribute extends AbstractEntity implements AttributeInterface
{
use AttributeTrait;
@@ -38,16 +36,14 @@ class Attribute extends AbstractEntity implements AttributeInterface
/**
* @var Collection
*/
- #[
- ORM\OneToMany(
- mappedBy: 'attribute',
- targetEntity: AttributeDocuments::class,
- cascade: ['persist', 'merge'],
- orphanRemoval: true
- ),
+ #[ORM\OneToMany(
+ mappedBy: 'attribute',
+ targetEntity: AttributeDocuments::class,
+ cascade: ['persist', 'merge'],
+ orphanRemoval: true
+ ),
ORM\OrderBy(['position' => 'ASC']),
- SymfonySerializer\Ignore
- ]
+ SymfonySerializer\Ignore]
protected Collection $attributeDocuments;
#[ORM\ManyToOne(targetEntity: Realm::class)]
@@ -64,13 +60,11 @@ class Attribute extends AbstractEntity implements AttributeInterface
/**
* @var int absolute weight for sorting attributes in filtered lists
*/
- #[
- ORM\Column(type: 'integer', nullable: false, options: ['default' => 0]),
+ #[ORM\Column(type: 'integer', nullable: false, options: ['default' => 0]),
SymfonySerializer\Groups(['attribute', 'attribute:export', 'attribute:import', 'node', 'nodes_sources']),
ApiFilter(OrderFilter::class),
Range(min: 0, max: 9999),
- NotNull,
- ]
+ NotNull,]
protected int $weight = 0;
public function __construct()
@@ -122,9 +116,7 @@ public function setWeight(?int $weight): Attribute
/**
* @return Collection
*/
- #[
- SymfonySerializer\Groups(['attribute', 'node', 'nodes_sources']),
- ]
+ #[SymfonySerializer\Groups(['attribute', 'node', 'nodes_sources']),]
public function getDocuments(): Collection
{
/** @var Collection $values */
diff --git a/lib/RoadizCoreBundle/src/Entity/AttributeDocuments.php b/lib/RoadizCoreBundle/src/Entity/AttributeDocuments.php
index 412e2a8fd..d9ea45863 100644
--- a/lib/RoadizCoreBundle/src/Entity/AttributeDocuments.php
+++ b/lib/RoadizCoreBundle/src/Entity/AttributeDocuments.php
@@ -13,46 +13,40 @@
* Describes a complex ManyToMany relation
* between Attribute and Documents.
*/
-#[
- ORM\Entity(repositoryClass: AttributeDocumentsRepository::class),
+#[ORM\Entity(repositoryClass: AttributeDocumentsRepository::class),
ORM\Table(name: 'attributes_documents'),
ORM\Index(columns: ['position']),
- ORM\Index(columns: ['attribute_id', 'position'])
-]
+ ORM\Index(columns: ['attribute_id', 'position'])]
class AttributeDocuments extends AbstractPositioned
{
- #[
- ORM\ManyToOne(
- targetEntity: Attribute::class,
- cascade: ['persist', 'merge'],
- fetch: 'EAGER',
- inversedBy: 'attributeDocuments'
- ),
+ #[ORM\ManyToOne(
+ targetEntity: Attribute::class,
+ cascade: ['persist', 'merge'],
+ fetch: 'EAGER',
+ inversedBy: 'attributeDocuments'
+ ),
ORM\JoinColumn(
name: 'attribute_id',
referencedColumnName: 'id',
nullable: false,
onDelete: 'CASCADE'
),
- SymfonySerializer\Ignore()
- ]
+ SymfonySerializer\Ignore()]
protected Attribute $attribute;
- #[
- ORM\ManyToOne(
- targetEntity: Document::class,
- cascade: ['persist', 'merge'],
- fetch: 'EAGER',
- inversedBy: 'attributeDocuments'
- ),
+ #[ORM\ManyToOne(
+ targetEntity: Document::class,
+ cascade: ['persist', 'merge'],
+ fetch: 'EAGER',
+ inversedBy: 'attributeDocuments'
+ ),
ORM\JoinColumn(
name: 'document_id',
referencedColumnName: 'id',
nullable: false,
onDelete: 'CASCADE'
),
- SymfonySerializer\Groups(['attribute']),
- ]
+ SymfonySerializer\Groups(['attribute']),]
protected Document $document;
public function __construct(Attribute $attribute, Document $document)
diff --git a/lib/RoadizCoreBundle/src/Entity/AttributeGroup.php b/lib/RoadizCoreBundle/src/Entity/AttributeGroup.php
index cd56cac50..b4fc2b653 100644
--- a/lib/RoadizCoreBundle/src/Entity/AttributeGroup.php
+++ b/lib/RoadizCoreBundle/src/Entity/AttributeGroup.php
@@ -13,13 +13,11 @@
use RZ\Roadiz\CoreBundle\Repository\AttributeGroupRepository;
use Symfony\Bridge\Doctrine\Validator\Constraints\UniqueEntity;
-#[
- ORM\Entity(repositoryClass: AttributeGroupRepository::class),
+#[ORM\Entity(repositoryClass: AttributeGroupRepository::class),
ORM\Table(name: 'attribute_groups'),
ORM\Index(columns: ['canonical_name']),
ORM\HasLifecycleCallbacks,
- UniqueEntity(fields: ['canonicalName'])
-]
+ UniqueEntity(fields: ['canonicalName'])]
class AttributeGroup extends AbstractEntity implements AttributeGroupInterface
{
use AttributeGroupTrait;
diff --git a/lib/RoadizCoreBundle/src/Entity/AttributeGroupTranslation.php b/lib/RoadizCoreBundle/src/Entity/AttributeGroupTranslation.php
index 299e70d7f..f2d486277 100644
--- a/lib/RoadizCoreBundle/src/Entity/AttributeGroupTranslation.php
+++ b/lib/RoadizCoreBundle/src/Entity/AttributeGroupTranslation.php
@@ -11,16 +11,14 @@
use RZ\Roadiz\CoreBundle\Repository\AttributeGroupTranslationRepository;
use Symfony\Bridge\Doctrine\Validator\Constraints\UniqueEntity;
-#[
- ORM\Entity(repositoryClass: AttributeGroupTranslationRepository::class),
+#[ORM\Entity(repositoryClass: AttributeGroupTranslationRepository::class),
ORM\Table(name: 'attribute_group_translations'),
ORM\Index(columns: ['name']),
ORM\UniqueConstraint(columns: ['attribute_group_id', 'translation_id']),
ORM\UniqueConstraint(columns: ['name', 'translation_id']),
ORM\HasLifecycleCallbacks,
UniqueEntity(fields: ['attributeGroup', 'translation']),
- UniqueEntity(fields: ['name', 'translation'])
-]
+ UniqueEntity(fields: ['name', 'translation'])]
class AttributeGroupTranslation extends AbstractEntity implements AttributeGroupTranslationInterface
{
use AttributeGroupTranslationTrait;
diff --git a/lib/RoadizCoreBundle/src/Entity/AttributeTranslation.php b/lib/RoadizCoreBundle/src/Entity/AttributeTranslation.php
index 780ed7fda..e04da374c 100644
--- a/lib/RoadizCoreBundle/src/Entity/AttributeTranslation.php
+++ b/lib/RoadizCoreBundle/src/Entity/AttributeTranslation.php
@@ -11,14 +11,12 @@
use RZ\Roadiz\CoreBundle\Repository\AttributeTranslationRepository;
use Symfony\Bridge\Doctrine\Validator\Constraints\UniqueEntity;
-#[
- ORM\Entity(repositoryClass: AttributeTranslationRepository::class),
+#[ORM\Entity(repositoryClass: AttributeTranslationRepository::class),
ORM\Table(name: 'attribute_translations'),
ORM\Index(columns: ['label']),
ORM\UniqueConstraint(columns: ['attribute_id', 'translation_id']),
ORM\HasLifecycleCallbacks,
- UniqueEntity(fields: ['attribute', 'translation'], errorPath: 'translation')
-]
+ UniqueEntity(fields: ['attribute', 'translation'], errorPath: 'translation')]
class AttributeTranslation extends AbstractEntity implements AttributeTranslationInterface
{
use AttributeTranslationTrait;
diff --git a/lib/RoadizCoreBundle/src/Entity/AttributeValue.php b/lib/RoadizCoreBundle/src/Entity/AttributeValue.php
index 1188c5eaf..fab28219f 100644
--- a/lib/RoadizCoreBundle/src/Entity/AttributeValue.php
+++ b/lib/RoadizCoreBundle/src/Entity/AttributeValue.php
@@ -18,8 +18,7 @@
use RZ\Roadiz\CoreBundle\Repository\AttributeValueRepository;
use Symfony\Component\Serializer\Annotation as SymfonySerializer;
-#[
- ORM\Entity(repositoryClass: AttributeValueRepository::class),
+#[ORM\Entity(repositoryClass: AttributeValueRepository::class),
ORM\Table(name: 'attribute_values'),
ORM\Index(columns: ['attribute_id', 'node_id']),
ORM\Index(columns: ['node_id', 'position'], name: 'idx_attribute_value_node_position'),
@@ -28,14 +27,12 @@
ApiFilter(PropertyFilter::class),
ApiFilter(BaseFilter\OrderFilter::class, properties: [
'position',
- ]),
-]
+ ]),]
class AttributeValue extends AbstractPositioned implements AttributeValueInterface
{
use AttributeValueTrait;
- #[
- ORM\ManyToOne(targetEntity: Node::class, inversedBy: 'attributeValues'),
+ #[ORM\ManyToOne(targetEntity: Node::class, inversedBy: 'attributeValues'),
ORM\JoinColumn(name: 'node_id', referencedColumnName: 'id', nullable: false, onDelete: 'CASCADE'),
SymfonySerializer\Groups(['attribute_node']),
SymfonySerializer\MaxDepth(1),
@@ -47,8 +44,7 @@ class AttributeValue extends AbstractPositioned implements AttributeValueInterfa
]),
ApiFilter(BaseFilter\BooleanFilter::class, properties: [
'node.visible',
- ])
- ]
+ ])]
protected Node $node;
#[ORM\ManyToOne(targetEntity: Realm::class)]
diff --git a/lib/RoadizCoreBundle/src/Entity/AttributeValueTranslation.php b/lib/RoadizCoreBundle/src/Entity/AttributeValueTranslation.php
index 180144d7b..f06456e36 100644
--- a/lib/RoadizCoreBundle/src/Entity/AttributeValueTranslation.php
+++ b/lib/RoadizCoreBundle/src/Entity/AttributeValueTranslation.php
@@ -10,13 +10,11 @@
use RZ\Roadiz\CoreBundle\Model\AttributeValueTranslationTrait;
use RZ\Roadiz\CoreBundle\Repository\AttributeValueTranslationRepository;
-#[
- ORM\Entity(repositoryClass: AttributeValueTranslationRepository::class),
+#[ORM\Entity(repositoryClass: AttributeValueTranslationRepository::class),
ORM\Table(name: 'attribute_value_translations'),
ORM\Index(columns: ['value']),
ORM\Index(columns: ['translation_id', 'attribute_value']),
- ORM\HasLifecycleCallbacks
-]
+ ORM\HasLifecycleCallbacks]
class AttributeValueTranslation extends AbstractEntity implements AttributeValueTranslationInterface
{
use AttributeValueTranslationTrait;
diff --git a/lib/RoadizCoreBundle/src/Entity/CustomForm.php b/lib/RoadizCoreBundle/src/Entity/CustomForm.php
index befc86931..de816bd48 100644
--- a/lib/RoadizCoreBundle/src/Entity/CustomForm.php
+++ b/lib/RoadizCoreBundle/src/Entity/CustomForm.php
@@ -21,128 +21,104 @@
* CustomForms describe each node structure family,
* They are mandatory before creating any Node.
*/
-#[
- ORM\Entity(repositoryClass: CustomFormRepository::class),
+#[ORM\Entity(repositoryClass: CustomFormRepository::class),
ORM\Table(name: 'custom_forms'),
ORM\HasLifecycleCallbacks,
UniqueEntity(fields: ['name']),
ORM\Index(columns: ['created_at'], name: 'custom_form_created_at'),
- ORM\Index(columns: ['updated_at'], name: 'custom_form_updated_at'),
-]
+ ORM\Index(columns: ['updated_at'], name: 'custom_form_updated_at'),]
class CustomForm extends AbstractDateTimed
{
- #[
- ORM\Column(name: 'color', type: 'string', length: 7, unique: false, nullable: true),
+ #[ORM\Column(name: 'color', type: 'string', length: 7, unique: false, nullable: true),
Serializer\Groups(['custom_form', 'nodes_sources']),
Assert\Length(max: 7),
- SymfonySerializer\Ignore()
- ]
+ SymfonySerializer\Ignore()]
protected ?string $color = '#000000';
- #[
- ORM\Column(type: 'string', length: 250, unique: true),
+ #[ORM\Column(type: 'string', length: 250, unique: true),
Serializer\Groups(['custom_form', 'nodes_sources']),
SymfonySerializer\Groups(['custom_form', 'nodes_sources']),
Assert\NotNull(),
Assert\NotBlank(),
Assert\Length(max: 250),
- SymfonySerializer\Ignore()
- ]
+ SymfonySerializer\Ignore()]
private string $name = 'Untitled';
- #[
- ORM\Column(name: 'display_name', type: 'string', length: 250),
+ #[ORM\Column(name: 'display_name', type: 'string', length: 250),
Serializer\Groups(['custom_form', 'nodes_sources']),
SymfonySerializer\Groups(['custom_form', 'nodes_sources']),
Assert\NotNull(),
Assert\NotBlank(),
Assert\Length(max: 250),
- SymfonySerializer\Ignore()
- ]
+ SymfonySerializer\Ignore()]
private string $displayName = 'Untitled';
- #[
- ORM\Column(type: 'text', nullable: true),
+ #[ORM\Column(type: 'text', nullable: true),
Serializer\Groups(['custom_form', 'nodes_sources']),
SymfonySerializer\Groups(['custom_form', 'nodes_sources']),
- SymfonySerializer\Ignore()
- ]
+ SymfonySerializer\Ignore()]
private ?string $description = null;
- #[
- ORM\Column(type: 'text', nullable: true),
+ #[ORM\Column(type: 'text', nullable: true),
Serializer\Groups(['custom_form']),
SymfonySerializer\Groups(['custom_form']),
- SymfonySerializer\Ignore()
- ]
+ SymfonySerializer\Ignore()]
private ?string $email = null;
- #[
- ORM\Column(type: 'string', length: 15, nullable: true),
+ #[ORM\Column(type: 'string', length: 15, nullable: true),
Serializer\Groups(['custom_form']),
SymfonySerializer\Groups(['custom_form']),
Assert\Length(max: 15),
- SymfonySerializer\Ignore()
- ]
+ SymfonySerializer\Ignore()]
private ?string $retentionTime = null;
- #[
- ORM\Column(type: 'boolean', nullable: false, options: ['default' => true]),
+ #[ORM\Column(type: 'boolean', nullable: false, options: ['default' => true]),
Serializer\Groups(['custom_form', 'nodes_sources']),
SymfonySerializer\Groups(['custom_form', 'nodes_sources']),
- SymfonySerializer\Ignore()
- ]
+ SymfonySerializer\Ignore()]
private bool $open = true;
- #[
- ApiFilter(RoadizFilter\ArchiveFilter::class),
+ #[ApiFilter(RoadizFilter\ArchiveFilter::class),
ORM\Column(name: 'close_date', type: 'datetime', nullable: true),
Serializer\Groups(['custom_form', 'nodes_sources']),
SymfonySerializer\Groups(['custom_form', 'nodes_sources']),
- SymfonySerializer\Ignore()
- ]
+ SymfonySerializer\Ignore()]
private ?\DateTime $closeDate = null;
/**
* @var Collection
*/
- #[
- ORM\OneToMany(
- mappedBy: 'customForm',
- targetEntity: CustomFormField::class,
- cascade: ['ALL'],
- orphanRemoval: true
- ),
+ #[ORM\OneToMany(
+ mappedBy: 'customForm',
+ targetEntity: CustomFormField::class,
+ cascade: ['ALL'],
+ orphanRemoval: true
+ ),
ORM\OrderBy(['position' => 'ASC']),
Serializer\Groups(['custom_form']),
SymfonySerializer\Groups(['custom_form']),
- SymfonySerializer\Ignore()
- ]
+ SymfonySerializer\Ignore()]
private Collection $fields;
/**
* @var Collection
*/
- #[
- ORM\OneToMany(
- mappedBy: 'customForm',
- targetEntity: CustomFormAnswer::class,
- cascade: ['ALL'],
- orphanRemoval: true
- ),
+ #[ORM\OneToMany(
+ mappedBy: 'customForm',
+ targetEntity: CustomFormAnswer::class,
+ cascade: ['ALL'],
+ orphanRemoval: true
+ ),
Serializer\Exclude,
- SymfonySerializer\Ignore
- ]
+ SymfonySerializer\Ignore]
private Collection $customFormAnswers;
/**
* @var Collection
*/
- #[
- ORM\OneToMany(mappedBy: 'customForm', targetEntity: NodesCustomForms::class, fetch: 'EXTRA_LAZY'),
+ #[ORM\OneToMany(mappedBy: 'customForm', targetEntity: NodesCustomForms::class, fetch: 'EXTRA_LAZY'),
Serializer\Exclude,
- SymfonySerializer\Ignore
- ]
+ SymfonySerializer\Ignore]
private Collection $nodes;
public function __construct()
@@ -228,11 +204,9 @@ public function setCloseDate(?\DateTime $closeDate): CustomForm
* Combine open flag and closeDate to determine
* if current form is still available.
*/
- #[
- Serializer\Groups(['custom_form', 'nodes_sources']),
+ #[Serializer\Groups(['custom_form', 'nodes_sources']),
Serializer\VirtualProperty,
- SymfonySerializer\Ignore
- ]
+ SymfonySerializer\Ignore]
public function isFormStillOpen(): bool
{
return (null === $this->getCloseDate() || $this->getCloseDate() >= (new \DateTime('now')))
diff --git a/lib/RoadizCoreBundle/src/Entity/CustomFormAnswer.php b/lib/RoadizCoreBundle/src/Entity/CustomFormAnswer.php
index 0ba86fcb4..85d15e934 100644
--- a/lib/RoadizCoreBundle/src/Entity/CustomFormAnswer.php
+++ b/lib/RoadizCoreBundle/src/Entity/CustomFormAnswer.php
@@ -13,54 +13,44 @@
use Symfony\Component\Serializer\Annotation as SymfonySerializer;
use Symfony\Component\Validator\Constraints as Assert;
-#[
- ORM\Entity(repositoryClass: CustomFormAnswerRepository::class),
+#[ORM\Entity(repositoryClass: CustomFormAnswerRepository::class),
ORM\Table(name: 'custom_form_answers'),
ORM\Index(columns: ['ip']),
ORM\Index(columns: ['submitted_at']),
- ORM\Index(columns: ['custom_form_id', 'submitted_at'], name: 'answer_customform_submitted_at')
-]
+ ORM\Index(columns: ['custom_form_id', 'submitted_at'], name: 'answer_customform_submitted_at')]
class CustomFormAnswer extends AbstractEntity
{
- #[
- ORM\Column(name: 'ip', type: 'string', length: 46, nullable: false),
+ #[ORM\Column(name: 'ip', type: 'string', length: 46, nullable: false),
Serializer\Groups(['custom_form_answer']),
SymfonySerializer\Groups(['custom_form_answer']),
- Assert\Length(max: 46)
- ]
+ Assert\Length(max: 46)]
private string $ip = '';
- #[
- ORM\Column(name: 'submitted_at', type: 'datetime', nullable: false),
+ #[ORM\Column(name: 'submitted_at', type: 'datetime', nullable: false),
Serializer\Groups(['custom_form_answer']),
- SymfonySerializer\Groups(['custom_form_answer'])
- ]
+ SymfonySerializer\Groups(['custom_form_answer'])]
private \DateTime $submittedAt;
/**
* @var Collection
*/
- #[
- ORM\OneToMany(
- mappedBy: 'customFormAnswer',
- targetEntity: CustomFormFieldAttribute::class,
- cascade: ['ALL'],
- orphanRemoval: true
- ),
+ #[ORM\OneToMany(
+ mappedBy: 'customFormAnswer',
+ targetEntity: CustomFormFieldAttribute::class,
+ cascade: ['ALL'],
+ orphanRemoval: true
+ ),
Serializer\Groups(['custom_form_answer']),
- SymfonySerializer\Groups(['custom_form_answer'])
- ]
+ SymfonySerializer\Groups(['custom_form_answer'])]
private Collection $answerFields;
- #[
- ORM\ManyToOne(
- targetEntity: CustomForm::class,
- inversedBy: 'customFormAnswers'
- ),
+ #[ORM\ManyToOne(
+ targetEntity: CustomForm::class,
+ inversedBy: 'customFormAnswers'
+ ),
ORM\JoinColumn(name: 'custom_form_id', referencedColumnName: 'id', nullable: false, onDelete: 'CASCADE'),
Serializer\Exclude,
- SymfonySerializer\Ignore
- ]
+ SymfonySerializer\Ignore]
private CustomForm $customForm;
public function __construct()
diff --git a/lib/RoadizCoreBundle/src/Entity/CustomFormField.php b/lib/RoadizCoreBundle/src/Entity/CustomFormField.php
index d3f46322b..e96a251a5 100644
--- a/lib/RoadizCoreBundle/src/Entity/CustomFormField.php
+++ b/lib/RoadizCoreBundle/src/Entity/CustomFormField.php
@@ -18,8 +18,7 @@
* CustomFormField entities are used to create CustomForms with
* custom data structure.
*/
-#[
- ORM\Entity(repositoryClass: CustomFormFieldRepository::class),
+#[ORM\Entity(repositoryClass: CustomFormFieldRepository::class),
ORM\Table(name: 'custom_form_fields'),
ORM\UniqueConstraint(columns: ['name', 'custom_form_id']),
ORM\Index(columns: ['position']),
@@ -27,8 +26,7 @@
ORM\Index(columns: ['type']),
ORM\Index(columns: ['custom_form_id', 'position'], name: 'cfield_customform_position'),
ORM\HasLifecycleCallbacks,
- UniqueEntity(fields: ['label', 'customForm'])
-]
+ UniqueEntity(fields: ['label', 'customForm'])]
class CustomFormField extends AbstractField
{
/**
@@ -50,36 +48,29 @@ class CustomFormField extends AbstractField
FieldType::TEXT_T,
];
- #[
- ORM\ManyToOne(targetEntity: CustomForm::class, inversedBy: 'fields'),
+ #[ORM\ManyToOne(targetEntity: CustomForm::class, inversedBy: 'fields'),
ORM\JoinColumn(name: 'custom_form_id', referencedColumnName: 'id', nullable: false, onDelete: 'CASCADE'),
Serializer\Exclude,
- SymfonySerializer\Ignore
- ]
+ SymfonySerializer\Ignore]
private CustomForm $customForm;
/**
* @var Collection
*/
- #[
- ORM\OneToMany(mappedBy: 'customFormField', targetEntity: CustomFormFieldAttribute::class),
+ #[ORM\OneToMany(mappedBy: 'customFormField', targetEntity: CustomFormFieldAttribute::class),
Serializer\Exclude,
- SymfonySerializer\Ignore
- ]
+ SymfonySerializer\Ignore]
private Collection $customFormFieldAttributes;
- #[
- ORM\Column(name: 'field_required', type: 'boolean', nullable: false, options: ['default' => false]),
+ #[ORM\Column(name: 'field_required', type: 'boolean', nullable: false, options: ['default' => false]),
Serializer\Groups(['custom_form']),
- SymfonySerializer\Groups(['custom_form'])
- ]
+ SymfonySerializer\Groups(['custom_form'])]
private bool $required = false;
/**
* @var string|null https://developer.mozilla.org/fr/docs/Web/HTML/Attributes/autocomplete
*/
- #[
- ORM\Column(name: 'autocomplete', type: 'string', length: 18, nullable: true),
+ #[ORM\Column(name: 'autocomplete', type: 'string', length: 18, nullable: true),
Serializer\Groups(['custom_form']),
SymfonySerializer\Groups(['custom_form']),
Choice([
@@ -108,8 +99,7 @@ class CustomFormField extends AbstractField
'tel-national',
'url',
'photo',
- ])
- ]
+ ])]
private ?string $autocomplete = null;
public function __construct()
diff --git a/lib/RoadizCoreBundle/src/Entity/CustomFormFieldAttribute.php b/lib/RoadizCoreBundle/src/Entity/CustomFormFieldAttribute.php
index 188a0d910..5f88cad4c 100644
--- a/lib/RoadizCoreBundle/src/Entity/CustomFormFieldAttribute.php
+++ b/lib/RoadizCoreBundle/src/Entity/CustomFormFieldAttribute.php
@@ -14,35 +14,27 @@
* CustomFormField entities are used to create CustomForms with
* custom data structure.
*/
-#[
- ORM\Entity(repositoryClass: CustomFormFieldAttributeRepository::class),
+#[ORM\Entity(repositoryClass: CustomFormFieldAttributeRepository::class),
ORM\Table(name: 'custom_form_field_attributes'),
ORM\Index(columns: ['custom_form_answer_id', 'custom_form_field_id'], name: 'cffattribute_answer_field'),
- ORM\HasLifecycleCallbacks
-]
+ ORM\HasLifecycleCallbacks]
class CustomFormFieldAttribute extends AbstractEntity
{
- #[
- ORM\ManyToOne(targetEntity: CustomFormAnswer::class, inversedBy: 'answerFields'),
- ORM\JoinColumn(name: 'custom_form_answer_id', referencedColumnName: 'id', nullable: false, onDelete: 'CASCADE')
- ]
+ #[ORM\ManyToOne(targetEntity: CustomFormAnswer::class, inversedBy: 'answerFields'),
+ ORM\JoinColumn(name: 'custom_form_answer_id', referencedColumnName: 'id', nullable: false, onDelete: 'CASCADE')]
protected CustomFormAnswer $customFormAnswer;
- #[
- ORM\ManyToOne(targetEntity: CustomFormField::class, inversedBy: 'customFormFieldAttributes'),
- ORM\JoinColumn(name: 'custom_form_field_id', referencedColumnName: 'id', nullable: false, onDelete: 'CASCADE')
- ]
+ #[ORM\ManyToOne(targetEntity: CustomFormField::class, inversedBy: 'customFormFieldAttributes'),
+ ORM\JoinColumn(name: 'custom_form_field_id', referencedColumnName: 'id', nullable: false, onDelete: 'CASCADE')]
protected CustomFormField $customFormField;
/**
* @var Collection
*/
- #[
- ORM\ManyToMany(targetEntity: Document::class, inversedBy: 'customFormFieldAttributes'),
+ #[ORM\ManyToMany(targetEntity: Document::class, inversedBy: 'customFormFieldAttributes'),
ORM\JoinTable(name: 'custom_form_answers_documents'),
ORM\JoinColumn(name: 'customformfieldattribute_id', onDelete: 'CASCADE'),
- ORM\InverseJoinColumn(name: 'document_id', onDelete: 'CASCADE')
- ]
+ ORM\InverseJoinColumn(name: 'document_id', onDelete: 'CASCADE')]
protected Collection $documents;
#[ORM\Column(type: 'text', nullable: true)]
diff --git a/lib/RoadizCoreBundle/src/Entity/Document.php b/lib/RoadizCoreBundle/src/Entity/Document.php
index b709984d8..80de35ee7 100644
--- a/lib/RoadizCoreBundle/src/Entity/Document.php
+++ b/lib/RoadizCoreBundle/src/Entity/Document.php
@@ -33,8 +33,7 @@
/**
* Documents entity represent a file on server with datetime and naming.
*/
-#[
- ORM\Entity(repositoryClass: DocumentRepository::class),
+#[ORM\Entity(repositoryClass: DocumentRepository::class),
ORM\Table(name: 'documents'),
ORM\Index(columns: ['created_at'], name: 'document_created_at'),
ORM\Index(columns: ['updated_at'], name: 'document_updated_at'),
@@ -69,8 +68,7 @@
'copyrightValidSince' => 'include_null_before',
'copyrightValidUntil' => 'include_null_after',
]),
- ApiFilter(CopyrightValidFilter::class)
-]
+ ApiFilter(CopyrightValidFilter::class)]
class Document extends AbstractDateTimed implements AdvancedDocumentInterface, HasThumbnailInterface, TimeableInterface, FileHashInterface
{
use DocumentTrait;
@@ -139,12 +137,10 @@ class Document extends AbstractDateTimed implements AdvancedDocumentInterface, H
#[Serializer\Exclude]
protected ?DocumentInterface $rawDocument = null;
- #[
- SymfonySerializer\Ignore,
+ #[SymfonySerializer\Ignore,
Serializer\Groups(['document']),
Serializer\Type('bool'),
- ORM\Column(name: 'raw', type: 'boolean', nullable: false, options: ['default' => false])
- ]
+ ORM\Column(name: 'raw', type: 'boolean', nullable: false, options: ['default' => false])]
protected bool $raw = false;
#[ORM\Column(name: 'embedId', type: 'string', length: 250, unique: false, nullable: true)]
@@ -606,8 +602,7 @@ public function setFilesize(?int $filesize): static
return $this;
}
- #[
- Serializer\Groups(['document', 'document_display', 'nodes_sources', 'tag', 'attribute']),
+ #[Serializer\Groups(['document', 'document_display', 'nodes_sources', 'tag', 'attribute']),
Serializer\Type('string'),
Serializer\VirtualProperty,
Serializer\SerializedName('alt'),
@@ -616,8 +611,7 @@ public function setFilesize(?int $filesize): static
ApiProperty(
description: 'Document alternative text, for img HTML tag. Image is decorative if this is NULL or empty.',
writable: false,
- )
- ]
+ )]
public function getAlternativeText(): ?string
{
$documentTranslation = $this->getDocumentTranslations()->first();
diff --git a/lib/RoadizCoreBundle/src/Entity/DocumentTranslation.php b/lib/RoadizCoreBundle/src/Entity/DocumentTranslation.php
index db4872b37..4122863ed 100644
--- a/lib/RoadizCoreBundle/src/Entity/DocumentTranslation.php
+++ b/lib/RoadizCoreBundle/src/Entity/DocumentTranslation.php
@@ -15,12 +15,10 @@
use Symfony\Component\Serializer\Annotation as SymfonySerializer;
use Symfony\Component\Validator\Constraints as Assert;
-#[
- ORM\Entity(repositoryClass: DocumentTranslationRepository::class),
+#[ORM\Entity(repositoryClass: DocumentTranslationRepository::class),
ORM\Table(name: 'documents_translations'),
ORM\UniqueConstraint(columns: ['document_id', 'translation_id']),
- Gedmo\Loggable(logEntryClass: UserLogEntry::class)
-]
+ Gedmo\Loggable(logEntryClass: UserLogEntry::class)]
class DocumentTranslation extends AbstractEntity implements Loggable
{
#[ORM\Column(type: 'string', length: 250, nullable: true)]
diff --git a/lib/RoadizCoreBundle/src/Entity/Folder.php b/lib/RoadizCoreBundle/src/Entity/Folder.php
index f2ff8c59e..6f1d813bf 100644
--- a/lib/RoadizCoreBundle/src/Entity/Folder.php
+++ b/lib/RoadizCoreBundle/src/Entity/Folder.php
@@ -26,8 +26,7 @@
/**
* Folders entity represent a directory on server with datetime and naming.
*/
-#[
- ORM\Entity(repositoryClass: FolderRepository::class),
+#[ORM\Entity(repositoryClass: FolderRepository::class),
ORM\HasLifecycleCallbacks,
ORM\Table(name: 'folders'),
ORM\Index(columns: ['visible']),
@@ -45,8 +44,7 @@
'position',
'createdAt',
'updatedAt',
- ])
-]
+ ])]
class Folder extends AbstractDateTimedPositioned implements FolderInterface, LeafInterface
{
use LeafTrait;
diff --git a/lib/RoadizCoreBundle/src/Entity/FolderTranslation.php b/lib/RoadizCoreBundle/src/Entity/FolderTranslation.php
index c9bca9c5d..2bdddcd5d 100644
--- a/lib/RoadizCoreBundle/src/Entity/FolderTranslation.php
+++ b/lib/RoadizCoreBundle/src/Entity/FolderTranslation.php
@@ -18,12 +18,10 @@
*
* It stores their name.
*/
-#[
- ORM\Entity(repositoryClass: FolderTranslationRepository::class),
+#[ORM\Entity(repositoryClass: FolderTranslationRepository::class),
ORM\Table(name: 'folders_translations'),
ORM\UniqueConstraint(columns: ['folder_id', 'translation_id']),
- UniqueEntity(fields: ['folder', 'translation'])
-]
+ UniqueEntity(fields: ['folder', 'translation'])]
class FolderTranslation extends AbstractEntity
{
#[ORM\Column(type: 'string', length: 250)]
diff --git a/lib/RoadizCoreBundle/src/Entity/Group.php b/lib/RoadizCoreBundle/src/Entity/Group.php
index bbb5da3c2..2a6df1568 100644
--- a/lib/RoadizCoreBundle/src/Entity/Group.php
+++ b/lib/RoadizCoreBundle/src/Entity/Group.php
@@ -16,11 +16,9 @@
/**
* A group gather User and Roles.
*/
-#[
- ORM\Entity(repositoryClass: GroupRepository::class),
+#[ORM\Entity(repositoryClass: GroupRepository::class),
ORM\Table(name: 'usergroups'),
- UniqueEntity(fields: ['name'])
-]
+ UniqueEntity(fields: ['name'])]
class Group extends AbstractEntity
{
#[ORM\Column(type: 'string', length: 250, unique: true)]
diff --git a/lib/RoadizCoreBundle/src/Entity/Node.php b/lib/RoadizCoreBundle/src/Entity/Node.php
index d0e099b13..a79f7ac6d 100644
--- a/lib/RoadizCoreBundle/src/Entity/Node.php
+++ b/lib/RoadizCoreBundle/src/Entity/Node.php
@@ -39,8 +39,7 @@
* it describes a document-like object which can be inherited
* with *NodesSources* to create complex data structures.
*/
-#[
- ORM\Entity(repositoryClass: NodeRepository::class),
+#[ORM\Entity(repositoryClass: NodeRepository::class),
ORM\Table(name: 'nodes'),
ORM\Index(columns: ['visible']),
ORM\Index(columns: ['status']),
@@ -74,8 +73,7 @@
ApiFilter(NodeTypeReachableFilter::class),
ApiFilter(NodeTypePublishableFilter::class),
ApiFilter(PropertyFilter::class),
- ApiFilter(TagGroupFilter::class)
-]
+ ApiFilter(TagGroupFilter::class)]
class Node extends AbstractDateTimedPositioned implements LeafInterface, AttributableInterface, Loggable, NodeInterface
{
use LeafTrait;
diff --git a/lib/RoadizCoreBundle/src/Entity/NodeType.php b/lib/RoadizCoreBundle/src/Entity/NodeType.php
index 7ab7f5205..a4e07c31f 100644
--- a/lib/RoadizCoreBundle/src/Entity/NodeType.php
+++ b/lib/RoadizCoreBundle/src/Entity/NodeType.php
@@ -20,66 +20,50 @@
*/
final class NodeType implements NodeTypeInterface
{
- #[
- Serializer\Groups(['node_type', 'color']),
+ #[Serializer\Groups(['node_type', 'color']),
SymfonySerializer\Groups(['node_type:display', 'node_type', 'node_type:import', 'color']),
Serializer\Type('string'),
- Assert\Length(max: 7),
- ]
- protected ?string $color = '#000000';
- #[
- Serializer\Groups(['node_type', 'node']),
+ Assert\Length(max: 7),]
+ private ?string $color = '#000000';
+ #[Serializer\Groups(['node_type', 'node']),
SymfonySerializer\Groups(['node_type:display', 'node_type', 'node_type:import', 'node']),
Serializer\Type('string'),
Assert\NotNull(),
Assert\NotBlank(),
RoadizAssert\SimpleLatinString(),
// Limit discriminator column to 30 characters for indexing optimization
- Assert\Length(max: 30)
- ]
+ Assert\Length(max: 30)]
private string $name = '';
- #[
- Serializer\Groups(['node_type', 'node']),
+ #[Serializer\Groups(['node_type', 'node']),
SymfonySerializer\Groups(['node_type:display', 'node_type', 'node_type:import', 'node']),
Serializer\Type('string'),
Assert\NotNull(),
Assert\NotBlank(),
- Assert\Length(max: 250)
- ]
+ Assert\Length(max: 250)]
private string $displayName = '';
- #[
- Serializer\Groups(['node_type']),
+ #[Serializer\Groups(['node_type']),
SymfonySerializer\Groups(['node_type', 'node_type:import']),
- Serializer\Type('string')
- ]
+ Serializer\Type('string')]
private ?string $description = null;
- #[
- Serializer\Groups(['node_type']),
+ #[Serializer\Groups(['node_type']),
SymfonySerializer\Groups(['node_type:display', 'node_type', 'node_type:import']),
- Serializer\Type('boolean')
- ]
+ Serializer\Type('boolean')]
private bool $visible = true;
- #[
- Serializer\Groups(['node_type']),
+ #[Serializer\Groups(['node_type']),
SymfonySerializer\Groups(['node_type', 'node_type:import']),
- Serializer\Type('boolean')
- ]
+ Serializer\Type('boolean')]
private bool $publishable = false;
/**
* @var bool define if this node-type produces nodes that will have attributes
*/
- #[
- Serializer\Groups(['node_type']),
+ #[Serializer\Groups(['node_type']),
SymfonySerializer\Groups(['node_type', 'node_type:import']),
- Serializer\Type('boolean')
- ]
+ Serializer\Type('boolean')]
private bool $attributable = false;
- #[
- Serializer\Groups(['node_type']),
+ #[Serializer\Groups(['node_type']),
SymfonySerializer\Groups(['node_type', 'node_type:import']),
- Serializer\Type('boolean')
- ]
+ Serializer\Type('boolean')]
private bool $sortingAttributesByWeight = false;
/**
* Define if this node-type produces nodes that will be
@@ -87,51 +71,39 @@ final class NodeType implements NodeTypeInterface
*
* Typically, if a node has a URL.
*/
- #[
- Serializer\Groups(['node_type']),
+ #[Serializer\Groups(['node_type']),
SymfonySerializer\Groups(['node_type', 'node_type:import']),
- Serializer\Type('boolean')
- ]
+ Serializer\Type('boolean')]
private bool $reachable = true;
- #[
- Serializer\Groups(['node_type']),
+ #[Serializer\Groups(['node_type']),
SymfonySerializer\Groups(['node_type', 'node_type:import']),
- Serializer\Type('boolean')
- ]
+ Serializer\Type('boolean')]
private bool $hidingNodes = false;
- #[
- Serializer\Groups(['node_type']),
+ #[Serializer\Groups(['node_type']),
SymfonySerializer\Groups(['node_type', 'node_type:import']),
- Serializer\Type('boolean')
- ]
+ Serializer\Type('boolean')]
private bool $hidingNonReachableNodes = false;
/**
* @var Collection
*/
- #[
- Serializer\Groups(['node_type']),
+ #[Serializer\Groups(['node_type']),
SymfonySerializer\Groups(['node_type', 'node_type:import']),
Serializer\Type("ArrayCollection"),
- Serializer\Accessor(getter: 'getFields', setter: 'setFields')
- ]
+ Serializer\Accessor(getter: 'getFields', setter: 'setFields')]
private Collection $fields;
- #[
- Serializer\Groups(['node_type']),
+ #[Serializer\Groups(['node_type']),
SymfonySerializer\Groups(['node_type', 'node_type:import']),
Serializer\Type('int'),
Assert\GreaterThanOrEqual(value: 0),
- Assert\NotNull
- ]
+ Assert\NotNull]
// @phpstan-ignore-next-line
private ?int $defaultTtl = 0;
/**
* Define if this node-type title will be indexed during its parent indexation.
*/
- #[
- Serializer\Groups(['node_type']),
+ #[Serializer\Groups(['node_type']),
SymfonySerializer\Groups(['node_type', 'node_type:import']),
- Serializer\Type('boolean')
- ]
+ Serializer\Type('boolean')]
private bool $searchable = true;
/**
diff --git a/lib/RoadizCoreBundle/src/Entity/NodeTypeDecorator.php b/lib/RoadizCoreBundle/src/Entity/NodeTypeDecorator.php
index 0f6d550ec..6d99b18ff 100644
--- a/lib/RoadizCoreBundle/src/Entity/NodeTypeDecorator.php
+++ b/lib/RoadizCoreBundle/src/Entity/NodeTypeDecorator.php
@@ -11,12 +11,10 @@
use RZ\Roadiz\CoreBundle\Repository\NodeTypeDecoratorRepository;
use Symfony\Bridge\Doctrine\Validator\Constraints\UniqueEntity;
-#[
- ORM\Entity(repositoryClass: NodeTypeDecoratorRepository::class),
+#[ORM\Entity(repositoryClass: NodeTypeDecoratorRepository::class),
ORM\Table(name: 'node_type_decorators'),
UniqueEntity(fields: ['path', 'property']),
- ORM\Index(columns: ['path'], name: 'idx_ntd_path'),
-]
+ ORM\Index(columns: ['path'], name: 'idx_ntd_path'),]
class NodeTypeDecorator extends AbstractEntity implements PersistableInterface
{
private function __construct(
diff --git a/lib/RoadizCoreBundle/src/Entity/NodeTypeField.php b/lib/RoadizCoreBundle/src/Entity/NodeTypeField.php
index cd8f64155..d13f418fc 100644
--- a/lib/RoadizCoreBundle/src/Entity/NodeTypeField.php
+++ b/lib/RoadizCoreBundle/src/Entity/NodeTypeField.php
@@ -19,83 +19,55 @@
#[RoadizAssert\NodeTypeField]
final class NodeTypeField extends AbstractField implements NodeTypeFieldInterface, SerializableInterface
{
- #[
- Serializer\Groups(['node_type', 'node_type:import', 'setting']),
+ #[Serializer\Groups(['node_type', 'node_type:import', 'setting']),
Assert\Length(max: 50),
RoadizAssert\NonSqlReservedWord(),
- RoadizAssert\SimpleLatinString()
- ]
+ RoadizAssert\SimpleLatinString()]
protected string $name;
/**
* If current field data should be the same over translations or not.
*/
- #[
- Serializer\Groups(['node_type', 'node_type:import']),
- ]
+ #[Serializer\Groups(['node_type', 'node_type:import']),]
private bool $universal = false;
/**
* Exclude current field from full-text search engines.
*/
- #[
- Serializer\Groups(['node_type', 'node_type:import']),
- ]
+ #[Serializer\Groups(['node_type', 'node_type:import']),]
private bool $excludeFromSearch = false;
- #[
- Serializer\Ignore
- ]
+ #[Serializer\Ignore]
private NodeTypeInterface $nodeType;
- #[
- Serializer\Groups(['node_type', 'node_type:import']),
- ]
+ #[Serializer\Groups(['node_type', 'node_type:import']),]
private ?string $serializationExclusionExpression = null;
- #[
- Serializer\Groups(['node_type', 'node_type:import']),
- ]
+ #[Serializer\Groups(['node_type', 'node_type:import']),]
private ?array $serializationGroups = null;
- #[
- Serializer\Groups(['node_type', 'node_type:import']),
- ]
+ #[Serializer\Groups(['node_type', 'node_type:import']),]
private ?array $normalizationContext = null;
- #[
- Serializer\Groups(['node_type', 'node_type:import']),
- ]
+ #[Serializer\Groups(['node_type', 'node_type:import']),]
private ?int $serializationMaxDepth = null;
- #[
- Serializer\Groups(['node_type', 'node_type:import']),
- ]
+ #[Serializer\Groups(['node_type', 'node_type:import']),]
private bool $excludedFromSerialization = false;
- #[
- Serializer\Groups(['node_type', 'node_type:import']),
- ]
+ #[Serializer\Groups(['node_type', 'node_type:import']),]
private ?int $minLength = null;
- #[
- Serializer\Groups(['node_type', 'node_type:import']),
- ]
+ #[Serializer\Groups(['node_type', 'node_type:import']),]
private ?int $maxLength = null;
- #[
- Serializer\Groups(['node_type', 'node_type:import']),
- ]
+ #[Serializer\Groups(['node_type', 'node_type:import']),]
private bool $indexed = false;
- #[
- Serializer\Groups(['node_type', 'node_type:import']),
- ]
+ #[Serializer\Groups(['node_type', 'node_type:import']),]
private bool $visible = true;
- #[
- Serializer\Groups(['node_type'])
- ]
+ #[Serializer\Groups(['node_type'])]
public function getNodeTypeName(): string
{
return $this->getNodeType()->getName();
diff --git a/lib/RoadizCoreBundle/src/Entity/NodesCustomForms.php b/lib/RoadizCoreBundle/src/Entity/NodesCustomForms.php
index a41b678f1..6da47402b 100644
--- a/lib/RoadizCoreBundle/src/Entity/NodesCustomForms.php
+++ b/lib/RoadizCoreBundle/src/Entity/NodesCustomForms.php
@@ -13,13 +13,11 @@
* Describes a complex ManyToMany relation
* between Nodes, CustomForms and NodeTypeFields.
*/
-#[
- ORM\Entity(repositoryClass: NodesCustomFormsRepository::class),
+#[ORM\Entity(repositoryClass: NodesCustomFormsRepository::class),
ORM\Table(name: 'nodes_custom_forms'),
ORM\Index(columns: ['position']),
ORM\Index(columns: ['node_id', 'position'], name: 'customform_node_position'),
- ORM\Index(columns: ['node_id', 'field_name', 'position'], name: 'customform_node_field_position')
-]
+ ORM\Index(columns: ['node_id', 'field_name', 'position'], name: 'customform_node_field_position')]
class NodesCustomForms extends AbstractPositioned
{
use FieldAwareEntityTrait;
diff --git a/lib/RoadizCoreBundle/src/Entity/NodesSources.php b/lib/RoadizCoreBundle/src/Entity/NodesSources.php
index 324e0e1e0..9797b1893 100644
--- a/lib/RoadizCoreBundle/src/Entity/NodesSources.php
+++ b/lib/RoadizCoreBundle/src/Entity/NodesSources.php
@@ -31,8 +31,7 @@
/**
* NodesSources store Node content according to a translation and a NodeType.
*/
-#[
- ORM\Entity(repositoryClass: NodesSourcesRepository::class),
+#[ORM\Entity(repositoryClass: NodesSourcesRepository::class),
ORM\Table(name: 'nodes_sources'),
ORM\Index(columns: ['discr']),
ORM\Index(columns: ['title']),
@@ -57,8 +56,7 @@
ApiFilter(NodeTypeReachableFilter::class),
ApiFilter(NodeTypePublishableFilter::class),
ApiFilter(RoadizFilter\LocaleFilter::class),
- ApiFilter(RoadizFilter\TagGroupFilter::class),
-]
+ ApiFilter(RoadizFilter\TagGroupFilter::class),]
class NodesSources extends AbstractEntity implements Loggable
{
#[SymfonySerializer\Ignore]
@@ -495,9 +493,9 @@ public function getParent(): ?NodesSources
$nodeSources = $parent->getNodeSourcesByTranslation($this->translation)->first();
return $nodeSources ?: null;
- } else {
- return null;
}
+
+ return null;
}
public function __toString(): string
diff --git a/lib/RoadizCoreBundle/src/Entity/NodesSourcesDocuments.php b/lib/RoadizCoreBundle/src/Entity/NodesSourcesDocuments.php
index 2e260a811..a3349d88b 100644
--- a/lib/RoadizCoreBundle/src/Entity/NodesSourcesDocuments.php
+++ b/lib/RoadizCoreBundle/src/Entity/NodesSourcesDocuments.php
@@ -14,13 +14,11 @@
* Describes a complex ManyToMany relation
* between NodesSources, Documents and NodeTypeFields.
*/
-#[
- ORM\Entity(repositoryClass: NodesSourcesDocumentsRepository::class),
+#[ORM\Entity(repositoryClass: NodesSourcesDocumentsRepository::class),
ORM\Table(name: 'nodes_sources_documents'),
ORM\Index(columns: ['position']),
ORM\Index(columns: ['ns_id', 'field_name'], name: 'nsdoc_field'),
- ORM\Index(columns: ['ns_id', 'field_name', 'position'], name: 'nsdoc_field_position')
-]
+ ORM\Index(columns: ['ns_id', 'field_name', 'position'], name: 'nsdoc_field_position')]
class NodesSourcesDocuments extends AbstractPositioned
{
use FieldAwareEntityTrait;
diff --git a/lib/RoadizCoreBundle/src/Entity/NodesTags.php b/lib/RoadizCoreBundle/src/Entity/NodesTags.php
index 746dff6d8..4912cc949 100644
--- a/lib/RoadizCoreBundle/src/Entity/NodesTags.php
+++ b/lib/RoadizCoreBundle/src/Entity/NodesTags.php
@@ -12,29 +12,24 @@
use RZ\Roadiz\CoreBundle\Repository\NodesTagsRepository;
use Symfony\Component\Serializer\Annotation as SymfonySerializer;
-#[
- ORM\Entity(repositoryClass: NodesTagsRepository::class),
+#[ORM\Entity(repositoryClass: NodesTagsRepository::class),
ORM\Table(name: 'nodes_tags'),
ORM\Index(columns: ['node_id', 'position'], name: 'nodes_tags_node_id_position'),
ORM\Index(columns: ['tag_id', 'position'], name: 'nodes_tags_tag_id_position'),
ORM\Index(columns: ['position'], name: 'nodes_tags_position'),
ORM\Index(columns: ['tag_id'], name: 'nodes_tags_tag_id'),
- ORM\Index(columns: ['node_id'], name: 'nodes_tags_node_id'),
-]
+ ORM\Index(columns: ['node_id'], name: 'nodes_tags_node_id'),]
class NodesTags implements PositionedInterface, Comparable
{
use PositionedTrait;
- #[
- ORM\Id,
+ #[ORM\Id,
ORM\Column(type: 'string', length: 36),
- SymfonySerializer\Ignore
- ]
+ SymfonySerializer\Ignore]
/** @phpstan-ignore-next-line */
protected ?string $id = null;
- #[
- ORM\ManyToOne(targetEntity: Node::class, inversedBy: 'nodesTags'),
+ #[ORM\ManyToOne(targetEntity: Node::class, inversedBy: 'nodesTags'),
ORM\JoinColumn(
name: 'node_id',
referencedColumnName: 'id',
@@ -43,12 +38,10 @@ class NodesTags implements PositionedInterface, Comparable
onDelete: 'CASCADE'
),
SymfonySerializer\Ignore,
- Serializer\Exclude,
- ]
+ Serializer\Exclude,]
private Node $node;
- #[
- ORM\ManyToOne(targetEntity: Tag::class, inversedBy: 'nodesTags'),
+ #[ORM\ManyToOne(targetEntity: Tag::class, inversedBy: 'nodesTags'),
ORM\JoinColumn(
name: 'tag_id',
referencedColumnName: 'id',
@@ -57,15 +50,12 @@ class NodesTags implements PositionedInterface, Comparable
onDelete: 'CASCADE'
),
SymfonySerializer\Groups(['nodes_sources', 'nodes_sources_base', 'node']),
- Serializer\Groups(['nodes_sources', 'nodes_sources_base', 'node']),
- ]
+ Serializer\Groups(['nodes_sources', 'nodes_sources_base', 'node']),]
private Tag $tag;
- #[
- ORM\Column(type: 'float', nullable: false, options: ['default' => 1]),
+ #[ORM\Column(type: 'float', nullable: false, options: ['default' => 1]),
SymfonySerializer\Ignore,
- Serializer\Exclude,
- ]
+ Serializer\Exclude,]
protected float $position = 0.0;
public function __construct(?string $uuid = null)
diff --git a/lib/RoadizCoreBundle/src/Entity/NodesToNodes.php b/lib/RoadizCoreBundle/src/Entity/NodesToNodes.php
index 6b24f4ca1..faab5f29e 100644
--- a/lib/RoadizCoreBundle/src/Entity/NodesToNodes.php
+++ b/lib/RoadizCoreBundle/src/Entity/NodesToNodes.php
@@ -13,15 +13,13 @@
* Describes a complex ManyToMany relation
* between two Nodes and NodeTypeFields.
*/
-#[
- ORM\Entity(repositoryClass: NodesToNodesRepository::class),
+#[ORM\Entity(repositoryClass: NodesToNodesRepository::class),
ORM\Table(name: 'nodes_to_nodes'),
ORM\Index(columns: ['position']),
ORM\Index(columns: ['node_a_id', 'field_name'], name: 'node_a_field'),
ORM\Index(columns: ['node_a_id', 'field_name', 'position'], name: 'node_a_field_position'),
ORM\Index(columns: ['node_b_id', 'field_name'], name: 'node_b_field'),
- ORM\Index(columns: ['node_b_id', 'field_name', 'position'], name: 'node_b_field_position')
-]
+ ORM\Index(columns: ['node_b_id', 'field_name', 'position'], name: 'node_b_field_position')]
class NodesToNodes extends AbstractPositioned
{
use FieldAwareEntityTrait;
diff --git a/lib/RoadizCoreBundle/src/Entity/Realm.php b/lib/RoadizCoreBundle/src/Entity/Realm.php
index 2f063c1ec..dd93105fd 100644
--- a/lib/RoadizCoreBundle/src/Entity/Realm.php
+++ b/lib/RoadizCoreBundle/src/Entity/Realm.php
@@ -25,8 +25,7 @@
* It supports plain_password (in query string), role-based and user-based authentication.
* All behaviours except for serializationGroups are only applied when using API WebResponse.
*/
-#[
- ORM\Entity(repositoryClass: RealmRepository::class),
+#[ORM\Entity(repositoryClass: RealmRepository::class),
ORM\Table(name: 'realms'),
ORM\Index(columns: ['type'], name: 'realms_type'),
ORM\Index(columns: ['behaviour'], name: 'realms_behaviour'),
@@ -36,8 +35,7 @@
'type' => 'exact',
'behaviour' => 'exact',
'name' => 'exact',
- ])
-]
+ ])]
class Realm extends AbstractEntity implements RealmInterface
{
#[ORM\Column(name: 'type', type: 'string', length: 30)]
diff --git a/lib/RoadizCoreBundle/src/Entity/RealmNode.php b/lib/RoadizCoreBundle/src/Entity/RealmNode.php
index e06235697..3e584d22e 100644
--- a/lib/RoadizCoreBundle/src/Entity/RealmNode.php
+++ b/lib/RoadizCoreBundle/src/Entity/RealmNode.php
@@ -13,16 +13,14 @@
use Symfony\Component\Serializer\Annotation as SymfonySerializer;
use Symfony\Component\Validator\Constraints as Assert;
-#[
- ORM\Entity(repositoryClass: RealmNodeRepository::class),
+#[ORM\Entity(repositoryClass: RealmNodeRepository::class),
ORM\Table(name: 'realms_nodes'),
ORM\Index(columns: ['inheritance_type'], name: 'realms_nodes_inheritance_type'),
ORM\Index(columns: ['realm_id'], name: 'realms_nodes_realm'),
ORM\Index(columns: ['node_id'], name: 'realms_nodes_node'),
ORM\Index(columns: ['node_id', 'inheritance_type'], name: 'realms_nodes_node_inheritance_type'),
ORM\UniqueConstraint(name: 'realms_nodes_unique', columns: ['node_id', 'realm_id']),
- UniqueEntity(fields: ['node', 'realm'])
-]
+ UniqueEntity(fields: ['node', 'realm'])]
class RealmNode extends AbstractEntity
{
#[ORM\ManyToOne(targetEntity: Node::class)]
diff --git a/lib/RoadizCoreBundle/src/Entity/Redirection.php b/lib/RoadizCoreBundle/src/Entity/Redirection.php
index aeedd3984..0fe896d61 100644
--- a/lib/RoadizCoreBundle/src/Entity/Redirection.php
+++ b/lib/RoadizCoreBundle/src/Entity/Redirection.php
@@ -15,15 +15,13 @@
/**
* Http redirection which are editable by BO users.
*/
-#[
- ORM\Entity(repositoryClass: RedirectionRepository::class),
+#[ORM\Entity(repositoryClass: RedirectionRepository::class),
ORM\Table(name: 'redirections'),
ORM\HasLifecycleCallbacks,
UniqueEntity(fields: ['query']),
ORM\Index(columns: ['use_count'], name: 'redirection_use_count'),
ORM\Index(columns: ['created_at'], name: 'redirection_created_at'),
- ORM\Index(columns: ['updated_at'], name: 'redirection_updated_at'),
-]
+ ORM\Index(columns: ['updated_at'], name: 'redirection_updated_at'),]
class Redirection extends AbstractDateTimed
{
#[ORM\Column(type: 'string', length: 255, unique: true)]
diff --git a/lib/RoadizCoreBundle/src/Entity/Role.php b/lib/RoadizCoreBundle/src/Entity/Role.php
index 92e2630a2..625d4f8a3 100644
--- a/lib/RoadizCoreBundle/src/Entity/Role.php
+++ b/lib/RoadizCoreBundle/src/Entity/Role.php
@@ -17,22 +17,18 @@
/**
* Roles are persisted version of string Symfony's roles.
*/
-#[
- ORM\Entity(repositoryClass: RoleRepository::class),
+#[ORM\Entity(repositoryClass: RoleRepository::class),
ORM\Table(name: 'roles'),
- UniqueEntity(fields: ['name'])
-]
+ UniqueEntity(fields: ['name'])]
class Role implements PersistableInterface
{
public const ROLE_DEFAULT = 'ROLE_USER';
public const ROLE_SUPERADMIN = 'ROLE_SUPERADMIN';
public const ROLE_BACKEND_USER = 'ROLE_BACKEND_USER';
- #[
- ORM\Id,
+ #[ORM\Id,
ORM\Column(type: 'integer'),
- ORM\GeneratedValue(strategy: 'AUTO')
- ]
+ ORM\GeneratedValue(strategy: 'AUTO')]
protected ?int $id = null;
#[ORM\Column(type: 'string', length: 250, unique: true)]
diff --git a/lib/RoadizCoreBundle/src/Entity/Setting.php b/lib/RoadizCoreBundle/src/Entity/Setting.php
index 292baece4..0350df0cb 100644
--- a/lib/RoadizCoreBundle/src/Entity/Setting.php
+++ b/lib/RoadizCoreBundle/src/Entity/Setting.php
@@ -17,14 +17,12 @@
/**
* Settings entity are a simple key-value configuration system.
*/
-#[
- ORM\Entity(repositoryClass: SettingRepository::class),
+#[ORM\Entity(repositoryClass: SettingRepository::class),
ORM\Table(name: 'settings'),
ORM\Index(columns: ['type']),
ORM\Index(columns: ['name']),
ORM\Index(columns: ['visible']),
- UniqueEntity(fields: ['name']),
-]
+ UniqueEntity(fields: ['name']),]
class Setting extends AbstractEntity
{
use FieldTypeTrait;
diff --git a/lib/RoadizCoreBundle/src/Entity/SettingGroup.php b/lib/RoadizCoreBundle/src/Entity/SettingGroup.php
index 364661b48..4746e911a 100644
--- a/lib/RoadizCoreBundle/src/Entity/SettingGroup.php
+++ b/lib/RoadizCoreBundle/src/Entity/SettingGroup.php
@@ -17,11 +17,9 @@
/**
* Settings entity are a simple key-value configuration system.
*/
-#[
- ORM\Entity(repositoryClass: SettingGroupRepository::class),
+#[ORM\Entity(repositoryClass: SettingGroupRepository::class),
ORM\Table(name: 'settings_groups'),
- UniqueEntity(fields: ['name'])
-]
+ UniqueEntity(fields: ['name'])]
class SettingGroup extends AbstractEntity
{
#[ORM\Column(name: 'in_menu', type: 'boolean', nullable: false, options: ['default' => false])]
diff --git a/lib/RoadizCoreBundle/src/Entity/StackType.php b/lib/RoadizCoreBundle/src/Entity/StackType.php
index da697ce89..ee1aad51b 100644
--- a/lib/RoadizCoreBundle/src/Entity/StackType.php
+++ b/lib/RoadizCoreBundle/src/Entity/StackType.php
@@ -8,10 +8,8 @@
use RZ\Roadiz\CoreBundle\Repository\StackTypeRepository;
use Symfony\Component\Validator\Constraints as Assert;
-#[
- ORM\Entity(repositoryClass: StackTypeRepository::class),
- ORM\Table(name: 'stack_types'),
-]
+#[ORM\Entity(repositoryClass: StackTypeRepository::class),
+ ORM\Table(name: 'stack_types'),]
class StackType
{
public function __construct(
diff --git a/lib/RoadizCoreBundle/src/Entity/Tag.php b/lib/RoadizCoreBundle/src/Entity/Tag.php
index 5c89a0662..705c7fb7e 100644
--- a/lib/RoadizCoreBundle/src/Entity/Tag.php
+++ b/lib/RoadizCoreBundle/src/Entity/Tag.php
@@ -26,8 +26,7 @@
/**
* Tags are hierarchical entities used to qualify Nodes.
*/
-#[
- ORM\Entity(repositoryClass: TagRepository::class),
+#[ORM\Entity(repositoryClass: TagRepository::class),
ORM\HasLifecycleCallbacks,
ORM\Table(name: 'tags'),
ORM\Index(columns: ['visible']),
@@ -46,8 +45,7 @@
'position',
'createdAt',
'updatedAt',
- ])
-]
+ ])]
class Tag extends AbstractDateTimedPositioned implements LeafInterface
{
use LeafTrait;
diff --git a/lib/RoadizCoreBundle/src/Entity/TagTranslation.php b/lib/RoadizCoreBundle/src/Entity/TagTranslation.php
index bb1d51250..6d43b8b48 100644
--- a/lib/RoadizCoreBundle/src/Entity/TagTranslation.php
+++ b/lib/RoadizCoreBundle/src/Entity/TagTranslation.php
@@ -21,13 +21,11 @@
*
* It stores their name and description.
*/
-#[
- ORM\Entity(repositoryClass: TagTranslationRepository::class),
+#[ORM\Entity(repositoryClass: TagTranslationRepository::class),
ORM\Table(name: 'tags_translations'),
ORM\UniqueConstraint(columns: ['tag_id', 'translation_id']),
Gedmo\Loggable(logEntryClass: UserLogEntry::class),
- UniqueEntity(fields: ['tag', 'translation'])
-]
+ UniqueEntity(fields: ['tag', 'translation'])]
class TagTranslation extends AbstractEntity
{
#[ORM\Column(type: 'string', length: 250)]
diff --git a/lib/RoadizCoreBundle/src/Entity/TagTranslationDocuments.php b/lib/RoadizCoreBundle/src/Entity/TagTranslationDocuments.php
index cb350fb9e..30f472fbd 100644
--- a/lib/RoadizCoreBundle/src/Entity/TagTranslationDocuments.php
+++ b/lib/RoadizCoreBundle/src/Entity/TagTranslationDocuments.php
@@ -14,12 +14,10 @@
* Describes a complex ManyToMany relation
* between TagTranslation and Documents.
*/
-#[
- ORM\Entity(repositoryClass: TagTranslationDocumentsRepository::class),
+#[ORM\Entity(repositoryClass: TagTranslationDocumentsRepository::class),
ORM\Table(name: 'tags_translations_documents'),
ORM\Index(columns: ['position']),
- ORM\Index(columns: ['tag_translation_id', 'position'], name: 'tagtranslation_position')
-]
+ ORM\Index(columns: ['tag_translation_id', 'position'], name: 'tagtranslation_position')]
class TagTranslationDocuments extends AbstractPositioned
{
#[ORM\ManyToOne(
diff --git a/lib/RoadizCoreBundle/src/Entity/Translation.php b/lib/RoadizCoreBundle/src/Entity/Translation.php
index 1eddec96d..cdfc61842 100644
--- a/lib/RoadizCoreBundle/src/Entity/Translation.php
+++ b/lib/RoadizCoreBundle/src/Entity/Translation.php
@@ -24,8 +24,7 @@
* Translations describe language locales to be used by Nodes,
* Tags, UrlAliases and Documents.
*/
-#[
- ORM\Entity(repositoryClass: TranslationRepository::class),
+#[ORM\Entity(repositoryClass: TranslationRepository::class),
ORM\Table(name: 'translations'),
ORM\Index(columns: ['available']),
ORM\Index(columns: ['default_translation']),
@@ -52,8 +51,7 @@
ApiFilter(BaseFilter\SearchFilter::class, properties: [
'locale' => 'exact',
'name' => 'exact',
- ])
-]
+ ])]
class Translation extends AbstractDateTimed implements TranslationInterface
{
/**
diff --git a/lib/RoadizCoreBundle/src/Entity/UrlAlias.php b/lib/RoadizCoreBundle/src/Entity/UrlAlias.php
index 9718184ab..313f20c8a 100644
--- a/lib/RoadizCoreBundle/src/Entity/UrlAlias.php
+++ b/lib/RoadizCoreBundle/src/Entity/UrlAlias.php
@@ -16,10 +16,8 @@
/**
* UrlAliases are used to translate Nodes URLs.
*/
-#[
- ORM\Entity(repositoryClass: UrlAliasRepository::class),
- ORM\Table(name: 'url_aliases')
-]
+#[ORM\Entity(repositoryClass: UrlAliasRepository::class),
+ ORM\Table(name: 'url_aliases')]
class UrlAlias extends AbstractEntity
{
#[ORM\Column(type: 'string', length: 250, unique: true)]
diff --git a/lib/RoadizCoreBundle/src/Entity/User.php b/lib/RoadizCoreBundle/src/Entity/User.php
index 306ef6825..aa5926966 100644
--- a/lib/RoadizCoreBundle/src/Entity/User.php
+++ b/lib/RoadizCoreBundle/src/Entity/User.php
@@ -18,8 +18,7 @@
use Symfony\Component\Serializer\Annotation as Serializer;
use Symfony\Component\Validator\Constraints as Assert;
-#[
- ORM\Entity(repositoryClass: UserRepository::class),
+#[ORM\Entity(repositoryClass: UserRepository::class),
ORM\Table(name: 'users'),
ORM\Index(columns: ['username'], name: 'idx_users_username'),
ORM\Index(columns: ['email'], name: 'idx_users_email'),
@@ -34,8 +33,7 @@
ORM\Index(columns: ['updated_at'], name: 'idx_user_updated_at'),
ORM\HasLifecycleCallbacks,
UniqueEntity('email'),
- UniqueEntity('username')
-]
+ UniqueEntity('username')]
class User extends AbstractHuman implements UserInterface, AdvancedUserInterface, EquatableInterface, PasswordAuthenticatedUserInterface
{
/**
@@ -194,9 +192,9 @@ public function getIdentifier(): string
return $this->getFirstName().' '.$this->getLastName();
} elseif ('' != $this->getFirstName()) {
return $this->getFirstName();
- } else {
- return $this->getUsername();
}
+
+ return $this->getUsername();
}
#[Serializer\SerializedName('identifier')]
diff --git a/lib/RoadizCoreBundle/src/Entity/UserLogEntry.php b/lib/RoadizCoreBundle/src/Entity/UserLogEntry.php
index 84dc6b61f..73e731d47 100644
--- a/lib/RoadizCoreBundle/src/Entity/UserLogEntry.php
+++ b/lib/RoadizCoreBundle/src/Entity/UserLogEntry.php
@@ -11,14 +11,12 @@
/**
* Add User to Gedmo\Loggable\Entity\LogEntry.
*/
-#[
- ORM\Entity(repositoryClass: UserLogEntryRepository::class),
+#[ORM\Entity(repositoryClass: UserLogEntryRepository::class),
ORM\Table(name: 'user_log_entries', options: ['row_format' => 'DYNAMIC']),
ORM\Index(columns: ['object_class'], name: 'log_class_lookup_idx'),
ORM\Index(columns: ['logged_at'], name: 'log_date_lookup_idx'),
ORM\Index(columns: ['username'], name: 'log_user_lookup_idx'),
- ORM\Index(columns: ['object_id', 'object_class', 'version'], name: 'log_version_lookup_idx')
-]
+ ORM\Index(columns: ['object_id', 'object_class', 'version'], name: 'log_version_lookup_idx')]
class UserLogEntry extends AbstractLogEntry
{
}
diff --git a/lib/RoadizCoreBundle/src/Entity/Webhook.php b/lib/RoadizCoreBundle/src/Entity/Webhook.php
index bb02f6ed5..8784c0dca 100644
--- a/lib/RoadizCoreBundle/src/Entity/Webhook.php
+++ b/lib/RoadizCoreBundle/src/Entity/Webhook.php
@@ -12,8 +12,7 @@
use Symfony\Component\Serializer\Annotation as SymfonySerializer;
use Symfony\Component\Validator\Constraints as Assert;
-#[
- ORM\Entity(repositoryClass: WebhookRepository::class),
+#[ORM\Entity(repositoryClass: WebhookRepository::class),
ORM\Table(name: 'webhooks'),
ORM\Index(columns: ['message_type'], name: 'webhook_message_type'),
ORM\Index(columns: ['created_at'], name: 'webhook_created_at'),
@@ -21,17 +20,14 @@
ORM\Index(columns: ['automatic'], name: 'webhook_automatic'),
ORM\Index(columns: ['root_node'], name: 'webhook_root_node'),
ORM\Index(columns: ['last_triggered_at'], name: 'webhook_last_triggered_at'),
- ORM\HasLifecycleCallbacks
-]
+ ORM\HasLifecycleCallbacks]
class Webhook extends AbstractDateTimed implements WebhookInterface
{
- #[
- ORM\Id,
+ #[ORM\Id,
ORM\Column(type: 'string', length: 36),
Serializer\Groups(['id']),
SymfonySerializer\Groups(['id']),
- Serializer\Type('string')
- ]
+ Serializer\Type('string')]
/** @phpstan-ignore-next-line */
protected int|string|null $id = null;
diff --git a/lib/RoadizCoreBundle/src/EntityHandler/FolderHandler.php b/lib/RoadizCoreBundle/src/EntityHandler/FolderHandler.php
index 5233f87df..85f2d4b70 100644
--- a/lib/RoadizCoreBundle/src/EntityHandler/FolderHandler.php
+++ b/lib/RoadizCoreBundle/src/EntityHandler/FolderHandler.php
@@ -84,9 +84,9 @@ public function cleanPositions(bool $setPositions = true): float
$parentHandler->setFolder($parent);
return $parentHandler->cleanChildrenPositions($setPositions);
- } else {
- return $this->cleanRootFoldersPositions($setPositions);
}
+
+ return $this->cleanRootFoldersPositions($setPositions);
}
/**
diff --git a/lib/RoadizCoreBundle/src/EntityHandler/NodeHandler.php b/lib/RoadizCoreBundle/src/EntityHandler/NodeHandler.php
index fd695e06a..e32174a6d 100644
--- a/lib/RoadizCoreBundle/src/EntityHandler/NodeHandler.php
+++ b/lib/RoadizCoreBundle/src/EntityHandler/NodeHandler.php
@@ -401,9 +401,9 @@ public function cleanPositions(bool $setPositions = true): float
$parentHandler->setNode($parent);
return $parentHandler->cleanChildrenPositions($setPositions);
- } else {
- return $this->cleanRootNodesPositions($setPositions);
}
+
+ return $this->cleanRootNodesPositions($setPositions);
}
/**
diff --git a/lib/RoadizCoreBundle/src/EntityHandler/NodesSourcesHandler.php b/lib/RoadizCoreBundle/src/EntityHandler/NodesSourcesHandler.php
index 23467a2f9..3d87ecd70 100644
--- a/lib/RoadizCoreBundle/src/EntityHandler/NodesSourcesHandler.php
+++ b/lib/RoadizCoreBundle/src/EntityHandler/NodesSourcesHandler.php
@@ -315,11 +315,10 @@ public function getFirstSibling(
$parentHandler->setNodeSource($this->nodeSource->getParent());
return $parentHandler->getFirstChild($criteria, $order);
- } else {
- $criteria['node.parent'] = null;
-
- return $this->getFirstChild($criteria, $order);
}
+ $criteria['node.parent'] = null;
+
+ return $this->getFirstChild($criteria, $order);
}
/**
@@ -336,11 +335,10 @@ public function getLastSibling(
$parentHandler->setNodeSource($this->nodeSource->getParent());
return $parentHandler->getLastChild($criteria, $order);
- } else {
- $criteria['node.parent'] = null;
-
- return $this->getLastChild($criteria, $order);
}
+ $criteria['node.parent'] = null;
+
+ return $this->getLastChild($criteria, $order);
}
/**
diff --git a/lib/RoadizCoreBundle/src/EntityHandler/TagHandler.php b/lib/RoadizCoreBundle/src/EntityHandler/TagHandler.php
index 180a1a5e0..c1c8e5176 100644
--- a/lib/RoadizCoreBundle/src/EntityHandler/TagHandler.php
+++ b/lib/RoadizCoreBundle/src/EntityHandler/TagHandler.php
@@ -91,9 +91,9 @@ public function cleanPositions(bool $setPositions = true): float
$tagHandler->setTag($parent);
return $tagHandler->cleanChildrenPositions($setPositions);
- } else {
- return $this->cleanRootTagsPositions($setPositions);
}
+
+ return $this->cleanRootTagsPositions($setPositions);
}
/**
diff --git a/lib/RoadizCoreBundle/src/EventSubscriber/AutomaticWebhookSubscriber.php b/lib/RoadizCoreBundle/src/EventSubscriber/AutomaticWebhookSubscriber.php
index 970ad3885..b5228237f 100644
--- a/lib/RoadizCoreBundle/src/EventSubscriber/AutomaticWebhookSubscriber.php
+++ b/lib/RoadizCoreBundle/src/EventSubscriber/AutomaticWebhookSubscriber.php
@@ -48,7 +48,7 @@ public static function getSubscribedEvents(): array
];
}
- protected function isEventRelatedToNode(mixed $event): bool
+ private function isEventRelatedToNode(mixed $event): bool
{
return $event instanceof Event
|| $event instanceof NodeVisibilityChangedEvent
diff --git a/lib/RoadizCoreBundle/src/EventSubscriber/CloudflareCacheEventSubscriber.php b/lib/RoadizCoreBundle/src/EventSubscriber/CloudflareCacheEventSubscriber.php
index cd378c7a0..52ad34527 100644
--- a/lib/RoadizCoreBundle/src/EventSubscriber/CloudflareCacheEventSubscriber.php
+++ b/lib/RoadizCoreBundle/src/EventSubscriber/CloudflareCacheEventSubscriber.php
@@ -38,7 +38,7 @@ public static function getSubscribedEvents(): array
];
}
- protected function supportConfig(): bool
+ private function supportConfig(): bool
{
return null !== $this->reverseProxyCacheLocator->getCloudflareProxyCache()
&& (
@@ -117,7 +117,7 @@ private function getCloudflareCacheProxy(): CloudflareProxyCache
/**
* @throws \JsonException
*/
- protected function createRequest(array $body): HttpRequestMessageInterface
+ private function createRequest(array $body): HttpRequestMessageInterface
{
$headers = [
'Content-type' => 'application/json',
@@ -150,7 +150,7 @@ protected function createRequest(array $body): HttpRequestMessageInterface
/**
* @throws \JsonException
*/
- protected function createBanRequest(): HttpRequestMessageInterface
+ private function createBanRequest(): HttpRequestMessageInterface
{
return $this->createRequest([
'purge_everything' => true,
@@ -162,14 +162,14 @@ protected function createBanRequest(): HttpRequestMessageInterface
*
* @throws \JsonException
*/
- protected function createPurgeRequest(array $uris = []): HttpRequestMessageInterface
+ private function createPurgeRequest(array $uris = []): HttpRequestMessageInterface
{
return $this->createRequest([
'files' => $uris,
]);
}
- protected function sendRequest(HttpRequestMessageInterface $requestMessage): void
+ private function sendRequest(HttpRequestMessageInterface $requestMessage): void
{
try {
$this->bus->dispatch(new Envelope($requestMessage));
diff --git a/lib/RoadizCoreBundle/src/EventSubscriber/JwtAuthenticationSuccessEventSubscriber.php b/lib/RoadizCoreBundle/src/EventSubscriber/JwtAuthenticationSuccessEventSubscriber.php
index b39f1a692..aa3370094 100644
--- a/lib/RoadizCoreBundle/src/EventSubscriber/JwtAuthenticationSuccessEventSubscriber.php
+++ b/lib/RoadizCoreBundle/src/EventSubscriber/JwtAuthenticationSuccessEventSubscriber.php
@@ -28,7 +28,7 @@ public function onAuthenticationSuccess(AuthenticationSuccessEvent $event): void
{
$user = $event->getUser();
- if (!($user instanceof User)) {
+ if (!$user instanceof User) {
return;
}
diff --git a/lib/RoadizCoreBundle/src/EventSubscriber/ReverseProxyCacheEventSubscriber.php b/lib/RoadizCoreBundle/src/EventSubscriber/ReverseProxyCacheEventSubscriber.php
index 2fb5327cc..ccdc60095 100644
--- a/lib/RoadizCoreBundle/src/EventSubscriber/ReverseProxyCacheEventSubscriber.php
+++ b/lib/RoadizCoreBundle/src/EventSubscriber/ReverseProxyCacheEventSubscriber.php
@@ -37,7 +37,7 @@ public static function getSubscribedEvents(): array
];
}
- protected function supportConfig(): bool
+ private function supportConfig(): bool
{
return count($this->reverseProxyCacheLocator->getFrontends()) > 0;
}
@@ -83,7 +83,7 @@ public function onPurgeRequest(NodesSourcesUpdatedEvent $event): void
/**
* @return HttpRequestMessageInterface[]
*/
- protected function createBanRequests(): array
+ private function createBanRequests(): array
{
$requests = [];
foreach ($this->reverseProxyCacheLocator->getFrontends() as $frontend) {
@@ -109,7 +109,7 @@ protected function createBanRequests(): array
return $requests;
}
- protected function purgeNodesSources(NodesSources $nodeSource): void
+ private function purgeNodesSources(NodesSources $nodeSource): void
{
try {
$this->bus->dispatch(new Envelope(new PurgeReverseProxyCacheMessage($nodeSource->getId())));
@@ -118,7 +118,7 @@ protected function purgeNodesSources(NodesSources $nodeSource): void
}
}
- protected function sendRequest(HttpRequestMessageInterface $requestMessage): void
+ private function sendRequest(HttpRequestMessageInterface $requestMessage): void
{
try {
$this->bus->dispatch(new Envelope($requestMessage));
diff --git a/lib/RoadizCoreBundle/src/Form/CaptchaType.php b/lib/RoadizCoreBundle/src/Form/CaptchaType.php
index f15eb7394..745bdb882 100644
--- a/lib/RoadizCoreBundle/src/Form/CaptchaType.php
+++ b/lib/RoadizCoreBundle/src/Form/CaptchaType.php
@@ -22,7 +22,7 @@ public function __construct(
/**
* (non-PHPdoc).
*
- * @see \Symfony\Component\Form\AbstractType::buildView()
+ * @see AbstractType::buildView()
*/
public function buildView(FormView $view, FormInterface $form, array $options): void
{
@@ -30,7 +30,7 @@ public function buildView(FormView $view, FormInterface $form, array $options):
}
/**
- * @see \Symfony\Component\Form\AbstractType::configureOptions()
+ * @see AbstractType::configureOptions()
*/
public function configureOptions(OptionsResolver $resolver): void
{
diff --git a/lib/RoadizCoreBundle/src/Form/Constraint/CaptchaValidator.php b/lib/RoadizCoreBundle/src/Form/Constraint/CaptchaValidator.php
index ffd503288..9f056e908 100644
--- a/lib/RoadizCoreBundle/src/Form/Constraint/CaptchaValidator.php
+++ b/lib/RoadizCoreBundle/src/Form/Constraint/CaptchaValidator.php
@@ -18,7 +18,7 @@ public function __construct(
}
/**
- * @see \Symfony\Component\Validator\ConstraintValidator::validate()
+ * @see ConstraintValidator::validate()
*/
public function validate(mixed $data, Constraint $constraint): void
{
diff --git a/lib/RoadizCoreBundle/src/Form/Constraint/RecaptchaValidator.php b/lib/RoadizCoreBundle/src/Form/Constraint/RecaptchaValidator.php
index dba321bc7..10a82c5f1 100644
--- a/lib/RoadizCoreBundle/src/Form/Constraint/RecaptchaValidator.php
+++ b/lib/RoadizCoreBundle/src/Form/Constraint/RecaptchaValidator.php
@@ -27,7 +27,7 @@ public function __construct(
}
/**
- * @see \Symfony\Component\Validator\ConstraintValidator::validate()
+ * @see ConstraintValidator::validate()
*/
public function validate(mixed $data, Constraint $constraint): void
{
diff --git a/lib/RoadizCoreBundle/src/Form/DataTransformer/ExplorerProviderItemTransformer.php b/lib/RoadizCoreBundle/src/Form/DataTransformer/ExplorerProviderItemTransformer.php
index a42bfa1fd..36ee89421 100644
--- a/lib/RoadizCoreBundle/src/Form/DataTransformer/ExplorerProviderItemTransformer.php
+++ b/lib/RoadizCoreBundle/src/Form/DataTransformer/ExplorerProviderItemTransformer.php
@@ -13,9 +13,9 @@
final readonly class ExplorerProviderItemTransformer implements DataTransformerInterface
{
public function __construct(
- protected ExplorerProviderInterface $explorerProvider,
- protected bool $multiple = true,
- protected bool $useCollection = false,
+ private ExplorerProviderInterface $explorerProvider,
+ private bool $multiple = true,
+ private bool $useCollection = false,
) {
}
diff --git a/lib/RoadizCoreBundle/src/Form/DataTransformer/TranslationTransformer.php b/lib/RoadizCoreBundle/src/Form/DataTransformer/TranslationTransformer.php
index f9337bebb..cb5035b8d 100644
--- a/lib/RoadizCoreBundle/src/Form/DataTransformer/TranslationTransformer.php
+++ b/lib/RoadizCoreBundle/src/Form/DataTransformer/TranslationTransformer.php
@@ -21,7 +21,7 @@ public function __construct(private ManagerRegistry $managerRegistry)
*/
public function transform(mixed $value): int|string|null
{
- if (!($value instanceof PersistableInterface)) {
+ if (!$value instanceof PersistableInterface) {
return null;
}
diff --git a/lib/RoadizCoreBundle/src/Form/NodeTypeFieldsType.php b/lib/RoadizCoreBundle/src/Form/NodeTypeFieldsType.php
index 73214ac83..f92234e54 100644
--- a/lib/RoadizCoreBundle/src/Form/NodeTypeFieldsType.php
+++ b/lib/RoadizCoreBundle/src/Form/NodeTypeFieldsType.php
@@ -30,17 +30,16 @@ public function configureOptions(OptionsResolver $resolver): void
$resolver->setNormalizer('choices', function (Options $options) {
if (null !== $options['nodeType']) {
return $options['nodeType']->getFields();
- } else {
- $nodeTypeFields = [];
- foreach ($this->nodeTypesBag->all() as $nodeType) {
- $nodeTypeFields = [
- ...$nodeTypeFields,
- ...$nodeType->getFields()->toArray(),
- ];
- }
-
- return $nodeTypeFields;
}
+ $nodeTypeFields = [];
+ foreach ($this->nodeTypesBag->all() as $nodeType) {
+ $nodeTypeFields = [
+ ...$nodeTypeFields,
+ ...$nodeType->getFields()->toArray(),
+ ];
+ }
+
+ return $nodeTypeFields;
});
}
diff --git a/lib/RoadizCoreBundle/src/Form/NodeTypesType.php b/lib/RoadizCoreBundle/src/Form/NodeTypesType.php
index 913b6849b..2634f3727 100644
--- a/lib/RoadizCoreBundle/src/Form/NodeTypesType.php
+++ b/lib/RoadizCoreBundle/src/Form/NodeTypesType.php
@@ -50,9 +50,9 @@ public function configureOptions(OptionsResolver $resolver): void
}
if ($nodeType->isReachable()) {
return 'reachable';
- } else {
- return 'not_reachable';
}
+
+ return 'not_reachable';
}
return null;
diff --git a/lib/RoadizCoreBundle/src/Form/RecaptchaType.php b/lib/RoadizCoreBundle/src/Form/RecaptchaType.php
index 3ff52904e..90787cd25 100644
--- a/lib/RoadizCoreBundle/src/Form/RecaptchaType.php
+++ b/lib/RoadizCoreBundle/src/Form/RecaptchaType.php
@@ -23,7 +23,7 @@ final class RecaptchaType extends AbstractType
/**
* (non-PHPdoc).
*
- * @see \Symfony\Component\Form\AbstractType::buildView()
+ * @see AbstractType::buildView()
*/
public function buildView(FormView $view, FormInterface $form, array $options): void
{
@@ -31,7 +31,7 @@ public function buildView(FormView $view, FormInterface $form, array $options):
}
/**
- * @see \Symfony\Component\Form\AbstractType::configureOptions()
+ * @see AbstractType::configureOptions()
*/
public function configureOptions(OptionsResolver $resolver): void
{
@@ -43,7 +43,7 @@ public function configureOptions(OptionsResolver $resolver): void
}
/**
- * @see \Symfony\Component\Form\AbstractType::getParent()
+ * @see AbstractType::getParent()
*/
public function getParent(): ?string
{
diff --git a/lib/RoadizCoreBundle/src/ListManager/EntityListManager.php b/lib/RoadizCoreBundle/src/ListManager/EntityListManager.php
index 3f8254bc9..06933cee7 100644
--- a/lib/RoadizCoreBundle/src/ListManager/EntityListManager.php
+++ b/lib/RoadizCoreBundle/src/ListManager/EntityListManager.php
@@ -204,18 +204,17 @@ public function getEntities(): array
$this->paginator->setItemsPerPage($this->getItemPerPage());
return $this->paginator->findByAtPage($this->orderingArray, $this->currentPage);
- } else {
- $repository = $this->entityManager->getRepository($this->entityName);
- if ($repository instanceof StatusAwareRepository) {
- $repository->setDisplayingNotPublishedNodes($this->isDisplayingNotPublishedNodes());
- $repository->setDisplayingAllNodesStatuses($this->isDisplayingAllNodesStatuses());
- }
-
- return $repository->findBy(
- $this->filteringArray,
- $this->orderingArray,
- $this->itemPerPage
- );
}
+ $repository = $this->entityManager->getRepository($this->entityName);
+ if ($repository instanceof StatusAwareRepository) {
+ $repository->setDisplayingNotPublishedNodes($this->isDisplayingNotPublishedNodes());
+ $repository->setDisplayingAllNodesStatuses($this->isDisplayingAllNodesStatuses());
+ }
+
+ return $repository->findBy(
+ $this->filteringArray,
+ $this->orderingArray,
+ $this->itemPerPage
+ );
}
}
diff --git a/lib/RoadizCoreBundle/src/ListManager/NodePaginator.php b/lib/RoadizCoreBundle/src/ListManager/NodePaginator.php
index eb451ac6e..6992d56b3 100644
--- a/lib/RoadizCoreBundle/src/ListManager/NodePaginator.php
+++ b/lib/RoadizCoreBundle/src/ListManager/NodePaginator.php
@@ -37,26 +37,25 @@ public function findByAtPage(array $order = [], int $page = 1): array
{
if (null !== $this->searchPattern) {
return $this->searchByAtPage($order, $page);
- } else {
- /** @var NodeRepository $repository */
- $repository = $this->getRepository();
- if ($repository instanceof NodeRepository) {
- return $repository->findBy(
- $this->criteria,
- $order,
- $this->getItemsPerPage(),
- $this->getItemsPerPage() * ($page - 1),
- $this->getTranslation()
- );
- }
-
+ }
+ /** @var NodeRepository $repository */
+ $repository = $this->getRepository();
+ if ($repository instanceof NodeRepository) {
return $repository->findBy(
$this->criteria,
$order,
$this->getItemsPerPage(),
- $this->getItemsPerPage() * ($page - 1)
+ $this->getItemsPerPage() * ($page - 1),
+ $this->getTranslation()
);
}
+
+ return $repository->findBy(
+ $this->criteria,
+ $order,
+ $this->getItemsPerPage(),
+ $this->getItemsPerPage() * ($page - 1)
+ );
}
public function getTotalCount(): int
diff --git a/lib/RoadizCoreBundle/src/ListManager/NodeTreeDtoListManager.php b/lib/RoadizCoreBundle/src/ListManager/NodeTreeDtoListManager.php
index 55d8a426f..8f2d3fdc9 100644
--- a/lib/RoadizCoreBundle/src/ListManager/NodeTreeDtoListManager.php
+++ b/lib/RoadizCoreBundle/src/ListManager/NodeTreeDtoListManager.php
@@ -35,18 +35,17 @@ public function getEntities(): array
// @phpstan-ignore-next-line
return $this->paginator->findByAtPage($this->orderingArray, $this->currentPage);
- } else {
- $repository = $this->entityManager->getRepository(Node::class);
- if ($repository instanceof StatusAwareRepository) {
- $repository->setDisplayingNotPublishedNodes($this->isDisplayingNotPublishedNodes());
- $repository->setDisplayingAllNodesStatuses($this->isDisplayingAllNodesStatuses());
- }
-
- return $repository->findByAsNodeTreeDto(
- $this->filteringArray,
- $this->orderingArray,
- $this->itemPerPage
- );
}
+ $repository = $this->entityManager->getRepository(Node::class);
+ if ($repository instanceof StatusAwareRepository) {
+ $repository->setDisplayingNotPublishedNodes($this->isDisplayingNotPublishedNodes());
+ $repository->setDisplayingAllNodesStatuses($this->isDisplayingAllNodesStatuses());
+ }
+
+ return $repository->findByAsNodeTreeDto(
+ $this->filteringArray,
+ $this->orderingArray,
+ $this->itemPerPage
+ );
}
}
diff --git a/lib/RoadizCoreBundle/src/ListManager/NodeTreeDtoPaginator.php b/lib/RoadizCoreBundle/src/ListManager/NodeTreeDtoPaginator.php
index 6a61fac6c..665877c2f 100644
--- a/lib/RoadizCoreBundle/src/ListManager/NodeTreeDtoPaginator.php
+++ b/lib/RoadizCoreBundle/src/ListManager/NodeTreeDtoPaginator.php
@@ -46,15 +46,15 @@ public function findByAtPage(array $order = [], int $page = 1): array
$this->getItemsPerPage(),
$this->getItemsPerPage() * ($page - 1)
);
- } else {
- return $repository->findByAsNodeTreeDto(
- $this->criteria,
- $order,
- $this->getItemsPerPage(),
- $this->getItemsPerPage() * ($page - 1),
- $this->getTranslation()
- );
}
+
+ return $repository->findByAsNodeTreeDto(
+ $this->criteria,
+ $order,
+ $this->getItemsPerPage(),
+ $this->getItemsPerPage() * ($page - 1),
+ $this->getTranslation()
+ );
}
public function getTotalCount(): int
diff --git a/lib/RoadizCoreBundle/src/ListManager/NodesSourcesPaginator.php b/lib/RoadizCoreBundle/src/ListManager/NodesSourcesPaginator.php
index c71502234..23f4c549b 100644
--- a/lib/RoadizCoreBundle/src/ListManager/NodesSourcesPaginator.php
+++ b/lib/RoadizCoreBundle/src/ListManager/NodesSourcesPaginator.php
@@ -35,14 +35,14 @@ public function findByAtPage(array $order = [], int $page = 1): array
{
if (null !== $this->searchPattern) {
return $this->searchByAtPage($order, $page);
- } else {
- return $this->getRepository()->findBy(
- $this->criteria,
- $order,
- $this->getItemsPerPage(),
- $this->getItemsPerPage() * ($page - 1)
- );
}
+
+ return $this->getRepository()->findBy(
+ $this->criteria,
+ $order,
+ $this->getItemsPerPage(),
+ $this->getItemsPerPage() * ($page - 1)
+ );
}
protected function getRepository(): NodesSourcesRepository
diff --git a/lib/RoadizCoreBundle/src/ListManager/Paginator.php b/lib/RoadizCoreBundle/src/ListManager/Paginator.php
index 1e087cea5..d3ec30b4b 100644
--- a/lib/RoadizCoreBundle/src/ListManager/Paginator.php
+++ b/lib/RoadizCoreBundle/src/ListManager/Paginator.php
@@ -144,15 +144,15 @@ public function findByAtPage(array $order = [], int $page = 1): array
{
if (null !== $this->searchPattern) {
return $this->searchByAtPage($order, $page);
- } else {
- return $this->getRepository()
- ->findBy(
- $this->criteria,
- $order,
- $this->getItemsPerPage(),
- $this->getItemsPerPage() * ($page - 1)
- );
}
+
+ return $this->getRepository()
+ ->findBy(
+ $this->criteria,
+ $order,
+ $this->getItemsPerPage(),
+ $this->getItemsPerPage() * ($page - 1)
+ );
}
/**
@@ -228,7 +228,7 @@ protected function getSearchQueryBuilder(string $alias): QueryBuilder
protected function getSearchableFields(): array
{
$metadata = $this->em->getClassMetadata($this->entityName);
- if (!($metadata instanceof ClassMetadataInfo)) {
+ if (!$metadata instanceof ClassMetadataInfo) {
throw new \RuntimeException('Entity has no metadata.');
}
diff --git a/lib/RoadizCoreBundle/src/ListManager/TagListManager.php b/lib/RoadizCoreBundle/src/ListManager/TagListManager.php
index a0d290e36..3ced7e66d 100644
--- a/lib/RoadizCoreBundle/src/ListManager/TagListManager.php
+++ b/lib/RoadizCoreBundle/src/ListManager/TagListManager.php
@@ -37,9 +37,9 @@ public function getEntities(): array
return $this->entityManager
->getRepository(TagTranslation::class)
->searchBy($this->searchPattern, $this->filteringArray, $this->orderingArray);
- } else {
- return $this->paginator->findByAtPage($this->filteringArray, $this->currentPage);
}
+
+ return $this->paginator->findByAtPage($this->filteringArray, $this->currentPage);
} catch (\Exception $e) {
return [];
}
diff --git a/lib/RoadizCoreBundle/src/Logger/Entity/Log.php b/lib/RoadizCoreBundle/src/Logger/Entity/Log.php
index 8da1875c9..f081a17ae 100644
--- a/lib/RoadizCoreBundle/src/Logger/Entity/Log.php
+++ b/lib/RoadizCoreBundle/src/Logger/Entity/Log.php
@@ -14,8 +14,7 @@
use Symfony\Component\Serializer\Annotation as SymfonySerializer;
use Symfony\Component\Validator\Constraints as Assert;
-#[
- ORM\Entity(repositoryClass: LogRepository::class),
+#[ORM\Entity(repositoryClass: LogRepository::class),
ORM\Table(name: 'log'),
ORM\Index(columns: ['datetime']),
ORM\Index(columns: ['entity_class']),
@@ -29,8 +28,7 @@
ORM\Index(columns: ['level']),
ORM\Index(columns: ['username']),
ORM\Index(columns: ['channel']),
- ORM\HasLifecycleCallbacks
-]
+ ORM\HasLifecycleCallbacks]
class Log extends AbstractEntity
{
#[ORM\Column(name: 'user_id', type: 'string', length: 36, unique: false, nullable: true)]
diff --git a/lib/RoadizCoreBundle/src/Mailer/ContactFormManager.php b/lib/RoadizCoreBundle/src/Mailer/ContactFormManager.php
index 397c6514e..07412f5ac 100644
--- a/lib/RoadizCoreBundle/src/Mailer/ContactFormManager.php
+++ b/lib/RoadizCoreBundle/src/Mailer/ContactFormManager.php
@@ -289,18 +289,17 @@ public function handle(?callable $onValid = null): ?Response
$this->send();
if ($returnJson) {
return new JsonResponse([], Response::HTTP_ACCEPTED);
- } else {
- if ($request->hasPreviousSession()) {
- /** @var Session $session */
- $session = $request->getSession();
- $session->getFlashBag()
- ->add('confirm', $this->translator->trans($this->successMessage));
- }
+ }
+ if ($request->hasPreviousSession()) {
+ /** @var Session $session */
+ $session = $request->getSession();
+ $session->getFlashBag()
+ ->add('confirm', $this->translator->trans($this->successMessage));
+ }
- $this->redirectUrl = null !== $this->redirectUrl ? $this->redirectUrl : $request->getUri();
+ $this->redirectUrl = null !== $this->redirectUrl ? $this->redirectUrl : $request->getUri();
- return new RedirectResponse($this->redirectUrl);
- }
+ return new RedirectResponse($this->redirectUrl);
} catch (BadFormRequestException $e) {
if (null !== $e->getFieldErrored() && $this->form->has($e->getFieldErrored())) {
$this->form->get($e->getFieldErrored())->addError(new FormError($e->getMessage()));
@@ -393,9 +392,8 @@ protected function addUploadedFile(string $name, UploadedFile $uploadedFile): Co
|| $uploadedFile->getSize() > $this->maxFileSize
) {
throw new BadFormRequestException($this->translator->trans('file.not.accepted'), Response::HTTP_FORBIDDEN, 'danger', $name);
- } else {
- $this->uploadedFiles[$name] = $uploadedFile;
}
+ $this->uploadedFiles[$name] = $uploadedFile;
return $this;
}
diff --git a/lib/RoadizCoreBundle/src/Message/Handler/PurgeReverseProxyCacheMessageHandler.php b/lib/RoadizCoreBundle/src/Message/Handler/PurgeReverseProxyCacheMessageHandler.php
index 86531c884..7b379eb5a 100644
--- a/lib/RoadizCoreBundle/src/Message/Handler/PurgeReverseProxyCacheMessageHandler.php
+++ b/lib/RoadizCoreBundle/src/Message/Handler/PurgeReverseProxyCacheMessageHandler.php
@@ -57,7 +57,7 @@ public function __invoke(PurgeReverseProxyCacheMessage $message): void
/**
* @return HttpRequestMessageInterface[]
*/
- protected function createPurgeRequests(string $path = '/'): array
+ private function createPurgeRequests(string $path = '/'): array
{
$requests = [];
foreach ($this->reverseProxyCacheLocator->getFrontends() as $frontend) {
@@ -78,7 +78,7 @@ protected function createPurgeRequests(string $path = '/'): array
return $requests;
}
- protected function sendRequest(HttpRequestMessageInterface $requestMessage): void
+ private function sendRequest(HttpRequestMessageInterface $requestMessage): void
{
try {
$this->bus->dispatch(new Envelope($requestMessage));
diff --git a/lib/RoadizCoreBundle/src/Model/AttributeGroupTrait.php b/lib/RoadizCoreBundle/src/Model/AttributeGroupTrait.php
index 7f4eb522e..126560328 100644
--- a/lib/RoadizCoreBundle/src/Model/AttributeGroupTrait.php
+++ b/lib/RoadizCoreBundle/src/Model/AttributeGroupTrait.php
@@ -13,36 +13,30 @@
trait AttributeGroupTrait
{
- #[
- ORM\Column(name: 'canonical_name', type: 'string', length: 255, unique: true, nullable: false),
+ #[ORM\Column(name: 'canonical_name', type: 'string', length: 255, unique: true, nullable: false),
SymfonySerializer\Groups(['attribute_group', 'attribute:export', 'attribute:import', 'attribute', 'node', 'nodes_sources']),
Assert\NotNull(),
Assert\Length(max: 255),
- Assert\NotBlank()
- ]
+ Assert\NotBlank()]
protected string $canonicalName = '';
/**
* @var Collection
*/
- #[
- ORM\OneToMany(mappedBy: 'group', targetEntity: AttributeInterface::class),
- SymfonySerializer\Ignore(),
- ]
+ #[ORM\OneToMany(mappedBy: 'group', targetEntity: AttributeInterface::class),
+ SymfonySerializer\Ignore(),]
protected Collection $attributes;
/**
* @var Collection
*/
- #[
- ORM\OneToMany(
- mappedBy: 'attributeGroup',
- targetEntity: AttributeGroupTranslationInterface::class,
- cascade: ['all'],
- orphanRemoval: true
- ),
- SymfonySerializer\Groups(['attribute_group', 'attribute:export', 'attribute', 'node', 'nodes_sources']),
- ]
+ #[ORM\OneToMany(
+ mappedBy: 'attributeGroup',
+ targetEntity: AttributeGroupTranslationInterface::class,
+ cascade: ['all'],
+ orphanRemoval: true
+ ),
+ SymfonySerializer\Groups(['attribute_group', 'attribute:export', 'attribute', 'node', 'nodes_sources']),]
protected Collection $attributeGroupTranslations;
public function getName(): ?string
diff --git a/lib/RoadizCoreBundle/src/Model/AttributeGroupTranslationTrait.php b/lib/RoadizCoreBundle/src/Model/AttributeGroupTranslationTrait.php
index 8b7260c83..19ff759a8 100644
--- a/lib/RoadizCoreBundle/src/Model/AttributeGroupTranslationTrait.php
+++ b/lib/RoadizCoreBundle/src/Model/AttributeGroupTranslationTrait.php
@@ -11,25 +11,19 @@
trait AttributeGroupTranslationTrait
{
- #[
- ORM\ManyToOne(targetEntity: "RZ\Roadiz\Core\AbstractEntities\TranslationInterface"),
+ #[ORM\ManyToOne(targetEntity: "RZ\Roadiz\Core\AbstractEntities\TranslationInterface"),
ORM\JoinColumn(name: 'translation_id', referencedColumnName: 'id', nullable: false, onDelete: 'CASCADE'),
- SymfonySerializer\Groups(['attribute_group', 'attribute', 'attribute:export', 'node', 'nodes_sources']),
- ]
+ SymfonySerializer\Groups(['attribute_group', 'attribute', 'attribute:export', 'node', 'nodes_sources']),]
protected TranslationInterface $translation;
- #[
- ORM\Column(type: 'string', length: 255, unique: false, nullable: false),
+ #[ORM\Column(type: 'string', length: 255, unique: false, nullable: false),
SymfonySerializer\Groups(['attribute_group', 'attribute:export', 'attribute', 'node', 'nodes_sources']),
- Assert\Length(max: 255)
- ]
+ Assert\Length(max: 255)]
protected string $name = '';
- #[
- ORM\ManyToOne(targetEntity: AttributeGroupInterface::class, cascade: ['persist'], inversedBy: 'attributeGroupTranslations'),
+ #[ORM\ManyToOne(targetEntity: AttributeGroupInterface::class, cascade: ['persist'], inversedBy: 'attributeGroupTranslations'),
ORM\JoinColumn(name: 'attribute_group_id', referencedColumnName: 'id', nullable: false, onDelete: 'CASCADE'),
- SymfonySerializer\Ignore
- ]
+ SymfonySerializer\Ignore]
protected AttributeGroupInterface $attributeGroup;
public function getName(): string
diff --git a/lib/RoadizCoreBundle/src/Model/AttributeTrait.php b/lib/RoadizCoreBundle/src/Model/AttributeTrait.php
index a1a9c177c..28a51b087 100644
--- a/lib/RoadizCoreBundle/src/Model/AttributeTrait.php
+++ b/lib/RoadizCoreBundle/src/Model/AttributeTrait.php
@@ -13,74 +13,60 @@
trait AttributeTrait
{
- #[
- ORM\Column(type: 'string', length: 255, unique: true, nullable: false),
+ #[ORM\Column(type: 'string', length: 255, unique: true, nullable: false),
SymfonySerializer\Groups(['attribute', 'attribute:export', 'attribute:import', 'node', 'nodes_sources']),
Assert\NotNull(),
Assert\NotBlank(),
- Assert\Length(max: 255)
- ]
+ Assert\Length(max: 255)]
protected string $code = '';
- #[
- ORM\Column(type: 'boolean', unique: false, nullable: false, options: ['default' => false]),
- SymfonySerializer\Groups(['attribute', 'attribute:export', 'attribute:import']),
- ]
+ #[ORM\Column(type: 'boolean', unique: false, nullable: false, options: ['default' => false]),
+ SymfonySerializer\Groups(['attribute', 'attribute:export', 'attribute:import']),]
protected bool $searchable = false;
- #[
- ORM\Column(type: 'integer', unique: false, nullable: false),
- SymfonySerializer\Groups(['attribute', 'attribute:export', 'attribute:import']),
- ]
+ #[ORM\Column(type: 'integer', unique: false, nullable: false),
+ SymfonySerializer\Groups(['attribute', 'attribute:export', 'attribute:import']),]
protected int $type = AttributeInterface::STRING_T;
- #[
- ORM\Column(type: 'string', length: 7, unique: false, nullable: true),
+ #[ORM\Column(type: 'string', length: 7, unique: false, nullable: true),
SymfonySerializer\Groups(['attribute', 'node', 'nodes_sources', 'attribute:export', 'attribute:import']),
- Assert\Length(max: 7)
- ]
+ Assert\Length(max: 7)]
protected ?string $color = null;
- #[
- ORM\ManyToOne(
- targetEntity: AttributeGroupInterface::class,
- cascade: ['persist', 'merge'],
- fetch: 'EAGER',
- inversedBy: 'attributes'
- ),
+ #[ORM\ManyToOne(
+ targetEntity: AttributeGroupInterface::class,
+ cascade: ['persist', 'merge'],
+ fetch: 'EAGER',
+ inversedBy: 'attributes'
+ ),
ORM\JoinColumn(name: 'group_id', onDelete: 'SET NULL'),
- SymfonySerializer\Groups(['attribute', 'node', 'nodes_sources', 'attribute:export', 'attribute:import']),
- ]
+ SymfonySerializer\Groups(['attribute', 'node', 'nodes_sources', 'attribute:export', 'attribute:import']),]
protected ?AttributeGroupInterface $group = null;
/**
* @var Collection
*/
- #[
- ORM\OneToMany(
- mappedBy: 'attribute',
- targetEntity: AttributeTranslationInterface::class,
- cascade: ['all'],
- fetch: 'EAGER',
- orphanRemoval: true
- ),
- SymfonySerializer\Groups(['attribute', 'node', 'nodes_sources', 'attribute:export']),
- ]
+ #[ORM\OneToMany(
+ mappedBy: 'attribute',
+ targetEntity: AttributeTranslationInterface::class,
+ cascade: ['all'],
+ fetch: 'EAGER',
+ orphanRemoval: true
+ ),
+ SymfonySerializer\Groups(['attribute', 'node', 'nodes_sources', 'attribute:export']),]
protected Collection $attributeTranslations;
/**
* @var Collection
*/
- #[
- ORM\OneToMany(
- mappedBy: 'attribute',
- targetEntity: AttributeValueInterface::class,
- cascade: ['persist', 'remove'],
- fetch: 'EXTRA_LAZY',
- orphanRemoval: true
- ),
- SymfonySerializer\Ignore
- ]
+ #[ORM\OneToMany(
+ mappedBy: 'attribute',
+ targetEntity: AttributeValueInterface::class,
+ cascade: ['persist', 'remove'],
+ fetch: 'EXTRA_LAZY',
+ orphanRemoval: true
+ ),
+ SymfonySerializer\Ignore]
protected Collection $attributeValues;
public function getCode(): string
diff --git a/lib/RoadizCoreBundle/src/Model/AttributeTranslationTrait.php b/lib/RoadizCoreBundle/src/Model/AttributeTranslationTrait.php
index 2af6ceb85..ca223962a 100644
--- a/lib/RoadizCoreBundle/src/Model/AttributeTranslationTrait.php
+++ b/lib/RoadizCoreBundle/src/Model/AttributeTranslationTrait.php
@@ -11,34 +11,26 @@
trait AttributeTranslationTrait
{
- #[
- ORM\ManyToOne(targetEntity: TranslationInterface::class),
+ #[ORM\ManyToOne(targetEntity: TranslationInterface::class),
ORM\JoinColumn(name: 'translation_id', referencedColumnName: 'id', nullable: false, onDelete: 'CASCADE'),
- SymfonySerializer\Groups(['attribute', 'attribute:export', 'node', 'nodes_sources']),
- ]
+ SymfonySerializer\Groups(['attribute', 'attribute:export', 'node', 'nodes_sources']),]
protected TranslationInterface $translation;
- #[
- ORM\Column(type: 'string', length: 250, unique: false, nullable: false),
+ #[ORM\Column(type: 'string', length: 250, unique: false, nullable: false),
SymfonySerializer\Groups(['attribute', 'attribute:export', 'node', 'nodes_sources']),
- Assert\Length(max: 250)
- ]
+ Assert\Length(max: 250)]
protected string $label = '';
/**
* @var array|null
*/
- #[
- ORM\Column(type: 'simple_array', unique: false, nullable: true),
- SymfonySerializer\Groups(['attribute', 'attribute:export']),
- ]
+ #[ORM\Column(type: 'simple_array', unique: false, nullable: true),
+ SymfonySerializer\Groups(['attribute', 'attribute:export']),]
protected ?array $options = [];
- #[
- ORM\ManyToOne(targetEntity: AttributeInterface::class, cascade: ['persist'], inversedBy: 'attributeTranslations'),
+ #[ORM\ManyToOne(targetEntity: AttributeInterface::class, cascade: ['persist'], inversedBy: 'attributeTranslations'),
ORM\JoinColumn(name: 'attribute_id', referencedColumnName: 'id', nullable: false, onDelete: 'CASCADE'),
- SymfonySerializer\Ignore,
- ]
+ SymfonySerializer\Ignore,]
protected AttributeInterface $attribute;
public function getLabel(): ?string
diff --git a/lib/RoadizCoreBundle/src/Model/AttributeValueTrait.php b/lib/RoadizCoreBundle/src/Model/AttributeValueTrait.php
index 869071e08..7c7f0a717 100644
--- a/lib/RoadizCoreBundle/src/Model/AttributeValueTrait.php
+++ b/lib/RoadizCoreBundle/src/Model/AttributeValueTrait.php
@@ -12,8 +12,7 @@
trait AttributeValueTrait
{
- #[
- ORM\ManyToOne(targetEntity: AttributeInterface::class, fetch: 'EAGER', inversedBy: 'attributeValues'),
+ #[ORM\ManyToOne(targetEntity: AttributeInterface::class, fetch: 'EAGER', inversedBy: 'attributeValues'),
ORM\JoinColumn(name: 'attribute_id', referencedColumnName: 'id', nullable: false, onDelete: 'CASCADE'),
ApiFilter(BaseFilter\SearchFilter::class, properties: [
'attribute.id' => 'exact',
@@ -33,21 +32,19 @@ trait AttributeValueTrait
]),
ApiFilter(BaseFilter\OrderFilter::class, properties: [
'attribute.weight' => 'DESC',
- ])
- ]
+ ])]
protected AttributeInterface $attribute;
/**
* @var Collection
*/
- #[
- ORM\OneToMany(
- mappedBy: 'attributeValue',
- targetEntity: AttributeValueTranslationInterface::class,
- cascade: ['persist', 'remove'],
- fetch: 'EAGER',
- orphanRemoval: true
- ),
+ #[ORM\OneToMany(
+ mappedBy: 'attributeValue',
+ targetEntity: AttributeValueTranslationInterface::class,
+ cascade: ['persist', 'remove'],
+ fetch: 'EAGER',
+ orphanRemoval: true
+ ),
ApiFilter(BaseFilter\SearchFilter::class, properties: [
'attributeValueTranslations.value' => 'partial',
]),
@@ -56,8 +53,7 @@ trait AttributeValueTrait
]),
ApiFilter(BaseFilter\ExistsFilter::class, properties: [
'attributeValueTranslations.value',
- ]),
- ]
+ ]),]
protected Collection $attributeValueTranslations;
public function getAttribute(): ?AttributeInterface
diff --git a/lib/RoadizCoreBundle/src/Model/AttributeValueTranslationTrait.php b/lib/RoadizCoreBundle/src/Model/AttributeValueTranslationTrait.php
index be371ebee..4d50bb231 100644
--- a/lib/RoadizCoreBundle/src/Model/AttributeValueTranslationTrait.php
+++ b/lib/RoadizCoreBundle/src/Model/AttributeValueTranslationTrait.php
@@ -10,22 +10,16 @@
trait AttributeValueTranslationTrait
{
- #[
- ORM\ManyToOne(targetEntity: TranslationInterface::class),
- ORM\JoinColumn(name: 'translation_id', referencedColumnName: 'id', nullable: false, onDelete: 'CASCADE'),
- ]
+ #[ORM\ManyToOne(targetEntity: TranslationInterface::class),
+ ORM\JoinColumn(name: 'translation_id', referencedColumnName: 'id', nullable: false, onDelete: 'CASCADE'),]
protected TranslationInterface $translation;
- #[
- ORM\Column(type: 'string', length: 255, unique: false, nullable: true),
- Assert\Length(max: 255)
- ]
+ #[ORM\Column(type: 'string', length: 255, unique: false, nullable: true),
+ Assert\Length(max: 255)]
protected ?string $value = null;
- #[
- ORM\ManyToOne(targetEntity: AttributeValueInterface::class, cascade: ['persist'], inversedBy: 'attributeValueTranslations'),
- ORM\JoinColumn(name: 'attribute_value', referencedColumnName: 'id', nullable: false, onDelete: 'CASCADE'),
- ]
+ #[ORM\ManyToOne(targetEntity: AttributeValueInterface::class, cascade: ['persist'], inversedBy: 'attributeValueTranslations'),
+ ORM\JoinColumn(name: 'attribute_value', referencedColumnName: 'id', nullable: false, onDelete: 'CASCADE'),]
protected AttributeValueInterface $attributeValue;
/**
diff --git a/lib/RoadizCoreBundle/src/Node/NodeMover.php b/lib/RoadizCoreBundle/src/Node/NodeMover.php
index 9dbda8cda..215d3bcde 100644
--- a/lib/RoadizCoreBundle/src/Node/NodeMover.php
+++ b/lib/RoadizCoreBundle/src/Node/NodeMover.php
@@ -125,7 +125,7 @@ public function redirectAll(Node $node, array $previousPaths, bool $permanently
/**
* Warning: this method DOES NOT flush entity manager.
*/
- protected function redirect(NodesSources $nodeSource, string $previousPath, bool $permanently = true): NodesSources
+ private function redirect(NodesSources $nodeSource, string $previousPath, bool $permanently = true): NodesSources
{
if (empty($previousPath) || '/' === $previousPath) {
$this->logger->warning('Cannot redirect empty or root path: '.$nodeSource->getTitle());
diff --git a/lib/RoadizCoreBundle/src/Node/NodeTranslator.php b/lib/RoadizCoreBundle/src/Node/NodeTranslator.php
index b2c1ab16d..17f2710a4 100644
--- a/lib/RoadizCoreBundle/src/Node/NodeTranslator.php
+++ b/lib/RoadizCoreBundle/src/Node/NodeTranslator.php
@@ -56,7 +56,7 @@ private function translateSingleNode(
})->first() ?:
$node->getNodeSources()->first();
- if (!($baseSource instanceof NodesSources)) {
+ if (!$baseSource instanceof NodesSources) {
throw new \RuntimeException('Cannot translate a Node without any NodesSources');
}
$source = clone $baseSource;
@@ -74,8 +74,8 @@ private function translateSingleNode(
$this->dispatcher->dispatch(new NodesSourcesCreatedEvent($source));
return $source;
- } else {
- return $existing;
}
+
+ return $existing;
}
}
diff --git a/lib/RoadizCoreBundle/src/Node/NodeTranstyper.php b/lib/RoadizCoreBundle/src/Node/NodeTranstyper.php
index 9fd93e775..2244ca927 100644
--- a/lib/RoadizCoreBundle/src/Node/NodeTranstyper.php
+++ b/lib/RoadizCoreBundle/src/Node/NodeTranstyper.php
@@ -135,7 +135,7 @@ public function transtype(Node $node, NodeTypeInterface $destinationNodeType, bo
return $node;
}
- protected function removeOldSources(Node $node, array &$sources): void
+ private function removeOldSources(Node $node, array &$sources): void
{
/** @var NodesSources $existingSource */
foreach ($sources as $existingSource) {
@@ -153,7 +153,7 @@ protected function removeOldSources(Node $node, array &$sources): void
*
* @param class-string $sourceClass
*/
- protected function doTranstypeSingleSource(
+ private function doTranstypeSingleSource(
Node $node,
NodesSources $existingSource,
TranslationInterface $translation,
@@ -228,7 +228,7 @@ protected function doTranstypeSingleSource(
*
* @throws \InvalidArgumentException if mock fails due to Source class not existing
*/
- protected function mockTranstype(NodeTypeInterface $nodeType): void
+ private function mockTranstype(NodeTypeInterface $nodeType): void
{
$sourceClass = $nodeType->getSourceEntityFullQualifiedClassName();
if (!class_exists($sourceClass)) {
diff --git a/lib/RoadizCoreBundle/src/Node/UniversalDataDuplicator.php b/lib/RoadizCoreBundle/src/Node/UniversalDataDuplicator.php
index b23c2d009..8206a5284 100644
--- a/lib/RoadizCoreBundle/src/Node/UniversalDataDuplicator.php
+++ b/lib/RoadizCoreBundle/src/Node/UniversalDataDuplicator.php
@@ -99,7 +99,7 @@ private function hasDefaultTranslation(NodesSources $source): bool
return 1 === $sourceCount;
}
- protected function duplicateNonVirtualField(
+ private function duplicateNonVirtualField(
NodesSources $universalSource,
NodesSources $destSource,
NodeTypeFieldInterface $field,
@@ -110,7 +110,7 @@ protected function duplicateNonVirtualField(
$destSource->$setter($universalSource->$getter());
}
- protected function duplicateDocumentsField(
+ private function duplicateDocumentsField(
NodesSources $universalSource,
NodesSources $destSource,
NodeTypeFieldInterface $field,
diff --git a/lib/RoadizCoreBundle/src/NodeType/ApiResourceGenerator.php b/lib/RoadizCoreBundle/src/NodeType/ApiResourceGenerator.php
index ec1afcbd2..26b0f27ee 100644
--- a/lib/RoadizCoreBundle/src/NodeType/ApiResourceGenerator.php
+++ b/lib/RoadizCoreBundle/src/NodeType/ApiResourceGenerator.php
@@ -75,9 +75,9 @@ public function generate(NodeTypeInterface $nodeType): ?string
\clearstatcache(true, $resourcePath);
return $resourcePath;
- } else {
- return null;
}
+
+ return null;
}
public function remove(NodeTypeInterface $nodeType): void
@@ -121,12 +121,12 @@ public function getResourcePath(NodeTypeInterface $nodeType): string
->toString();
}
- protected function getWebResponseResourcePath(): string
+ private function getWebResponseResourcePath(): string
{
return $this->apiResourcesDir.'/web_response.yml';
}
- protected function getResourceName(string $nodeTypeName): string
+ private function getResourceName(string $nodeTypeName): string
{
return (new UnicodeString($nodeTypeName))
->snake()
@@ -134,14 +134,14 @@ protected function getResourceName(string $nodeTypeName): string
->toString();
}
- protected function getResourceUriPrefix(NodeTypeInterface $nodeType): string
+ private function getResourceUriPrefix(NodeTypeInterface $nodeType): string
{
$pluralNodeTypeName = InflectorFactory::create()->build()->pluralize($nodeType->getName());
return '/'.$this->getResourceName($pluralNodeTypeName);
}
- protected function getApiResourceDefinition(NodeTypeInterface $nodeType): array
+ private function getApiResourceDefinition(NodeTypeInterface $nodeType): array
{
$fqcn = (new UnicodeString($nodeType->getSourceEntityFullQualifiedClassName()))
->trimStart('\\')
@@ -161,7 +161,7 @@ protected function getApiResourceDefinition(NodeTypeInterface $nodeType): array
];
}
- protected function addWebResponseResourceOperation(NodeTypeInterface $nodeType, string $webResponseResourcePath): array
+ private function addWebResponseResourceOperation(NodeTypeInterface $nodeType, string $webResponseResourcePath): array
{
$getByPathOperationName = $this->apiResourceOperationNameGenerator->generateGetByPath(
$nodeType->getSourceEntityFullQualifiedClassName()
@@ -237,7 +237,7 @@ protected function addWebResponseResourceOperation(NodeTypeInterface $nodeType,
return $webResponseResource;
}
- protected function removeWebResponseResourceOperation(NodeTypeInterface $nodeType, string $webResponseResourcePath): array
+ private function removeWebResponseResourceOperation(NodeTypeInterface $nodeType, string $webResponseResourcePath): array
{
$getByPathOperationName = $this->apiResourceOperationNameGenerator->generateGetByPath(
$nodeType->getSourceEntityFullQualifiedClassName()
@@ -263,7 +263,7 @@ protected function removeWebResponseResourceOperation(NodeTypeInterface $nodeTyp
return $webResponseResource;
}
- protected function getCollectionOperations(NodeTypeInterface $nodeType): array
+ private function getCollectionOperations(NodeTypeInterface $nodeType): array
{
if (!$nodeType->isReachable()) {
return [];
@@ -329,7 +329,7 @@ protected function getCollectionOperations(NodeTypeInterface $nodeType): array
return $operations;
}
- protected function getItemOperationSerializationGroups(NodeTypeInterface $nodeType): array
+ private function getItemOperationSerializationGroups(NodeTypeInterface $nodeType): array
{
return [
'nodes_sources',
@@ -344,7 +344,7 @@ protected function getItemOperationSerializationGroups(NodeTypeInterface $nodeTy
];
}
- protected function getItemOperations(NodeTypeInterface $nodeType): array
+ private function getItemOperations(NodeTypeInterface $nodeType): array
{
if (!$nodeType->isReachable()) {
return [];
@@ -367,7 +367,7 @@ protected function getItemOperations(NodeTypeInterface $nodeType): array
];
}
- protected function getGroupedFieldsSerializationGroups(NodeTypeInterface $nodeType): array
+ private function getGroupedFieldsSerializationGroups(NodeTypeInterface $nodeType): array
{
$groups = [];
foreach ($nodeType->getFields() as $field) {
diff --git a/lib/RoadizCoreBundle/src/NodeType/DefaultValuesResolver.php b/lib/RoadizCoreBundle/src/NodeType/DefaultValuesResolver.php
index 9d76ad914..60d56e93d 100644
--- a/lib/RoadizCoreBundle/src/NodeType/DefaultValuesResolver.php
+++ b/lib/RoadizCoreBundle/src/NodeType/DefaultValuesResolver.php
@@ -25,29 +25,28 @@ public function getDefaultValuesAmongAllFields(NodeTypeFieldInterface $field): a
*/
if (Configuration::INHERITANCE_TYPE_JOINED === $this->inheritanceType) {
return array_map('trim', $field->getDefaultValuesAsArray());
- } else {
- /*
- * With single table inheritance, we need to get all default values
- * from all fields of all node types.
- */
- $defaultValues = [];
- $nodeTypeFields = [];
- $nodeTypes = $this->nodeTypesBag->all();
- foreach ($nodeTypes as $nodeType) {
- $nodeTypeFields = [
- ...$nodeTypeFields,
- ...$nodeType->getFields()->filter(function (NodeTypeFieldInterface $nodeTypeField) use ($field) {
- return $nodeTypeField->getName() === $field->getName() && $nodeTypeField->getType() === $field->getType();
- })->toArray(),
- ];
- }
- foreach ($nodeTypeFields as $nodeTypeField) {
- $values = array_filter(array_map('trim', $nodeTypeField->getDefaultValuesAsArray()));
- $defaultValues = array_merge($defaultValues, $values);
- }
-
- return $defaultValues;
}
+ /*
+ * With single table inheritance, we need to get all default values
+ * from all fields of all node types.
+ */
+ $defaultValues = [];
+ $nodeTypeFields = [];
+ $nodeTypes = $this->nodeTypesBag->all();
+ foreach ($nodeTypes as $nodeType) {
+ $nodeTypeFields = [
+ ...$nodeTypeFields,
+ ...$nodeType->getFields()->filter(function (NodeTypeFieldInterface $nodeTypeField) use ($field) {
+ return $nodeTypeField->getName() === $field->getName() && $nodeTypeField->getType() === $field->getType();
+ })->toArray(),
+ ];
+ }
+ foreach ($nodeTypeFields as $nodeTypeField) {
+ $values = array_filter(array_map('trim', $nodeTypeField->getDefaultValuesAsArray()));
+ $defaultValues = array_merge($defaultValues, $values);
+ }
+
+ return $defaultValues;
}
public function getMaxDefaultValuesLengthAmongAllFields(NodeTypeFieldInterface $field): int
diff --git a/lib/RoadizCoreBundle/src/NodeType/NodeTypeResolver.php b/lib/RoadizCoreBundle/src/NodeType/NodeTypeResolver.php
index 998b261b7..47516309a 100644
--- a/lib/RoadizCoreBundle/src/NodeType/NodeTypeResolver.php
+++ b/lib/RoadizCoreBundle/src/NodeType/NodeTypeResolver.php
@@ -18,7 +18,7 @@ public function __construct(private CacheItemPoolInterface $cacheAdapter)
/**
* @return array
*/
- protected function getNodeTypeList(NodeTypeFieldInterface $field): array
+ private function getNodeTypeList(NodeTypeFieldInterface $field): array
{
return array_filter($field->getDefaultValuesAsArray());
}
diff --git a/lib/RoadizCoreBundle/src/Preview/EventSubscriber/PreviewBarSubscriber.php b/lib/RoadizCoreBundle/src/Preview/EventSubscriber/PreviewBarSubscriber.php
index 725c1a018..c6b2d912c 100644
--- a/lib/RoadizCoreBundle/src/Preview/EventSubscriber/PreviewBarSubscriber.php
+++ b/lib/RoadizCoreBundle/src/Preview/EventSubscriber/PreviewBarSubscriber.php
@@ -23,7 +23,7 @@ public static function getSubscribedEvents(): array
];
}
- protected function supports(ResponseEvent $event): bool
+ private function supports(ResponseEvent $event): bool
{
$response = $event->getResponse();
if (
diff --git a/lib/RoadizCoreBundle/src/Preview/EventSubscriber/PreviewModeSubscriber.php b/lib/RoadizCoreBundle/src/Preview/EventSubscriber/PreviewModeSubscriber.php
index b2390efe6..be642183e 100644
--- a/lib/RoadizCoreBundle/src/Preview/EventSubscriber/PreviewModeSubscriber.php
+++ b/lib/RoadizCoreBundle/src/Preview/EventSubscriber/PreviewModeSubscriber.php
@@ -33,7 +33,7 @@ public static function getSubscribedEvents(): array
];
}
- protected function supports(): bool
+ private function supports(): bool
{
return $this->previewResolver->isPreview();
}
diff --git a/lib/RoadizCoreBundle/src/Repository/DocumentRepository.php b/lib/RoadizCoreBundle/src/Repository/DocumentRepository.php
index 1f937e58a..078edc0bf 100644
--- a/lib/RoadizCoreBundle/src/Repository/DocumentRepository.php
+++ b/lib/RoadizCoreBundle/src/Repository/DocumentRepository.php
@@ -425,9 +425,9 @@ public function findBy(
* if a limit is set because of the default inner join
*/
return (new Paginator($query))->getIterator()->getArrayCopy();
- } else {
- return $query->getResult();
}
+
+ return $query->getResult();
}
/**
diff --git a/lib/RoadizCoreBundle/src/Repository/EntityRepository.php b/lib/RoadizCoreBundle/src/Repository/EntityRepository.php
index 63c461d2a..633c53c37 100644
--- a/lib/RoadizCoreBundle/src/Repository/EntityRepository.php
+++ b/lib/RoadizCoreBundle/src/Repository/EntityRepository.php
@@ -330,9 +330,9 @@ public function searchBy(
* if a limit is set because of the default inner join
*/
return (new Paginator($query))->getIterator()->getArrayCopy();
- } else {
- return $query->getResult();
}
+
+ return $query->getResult();
}
/**
diff --git a/lib/RoadizCoreBundle/src/Repository/NodeRepository.php b/lib/RoadizCoreBundle/src/Repository/NodeRepository.php
index c0bb77cf9..a6ac92684 100644
--- a/lib/RoadizCoreBundle/src/Repository/NodeRepository.php
+++ b/lib/RoadizCoreBundle/src/Repository/NodeRepository.php
@@ -291,9 +291,9 @@ public function findBy(
* if a limit is set because of the default inner join
*/
return (new Paginator($query))->getIterator()->getArrayCopy();
- } else {
- return $query->getResult();
}
+
+ return $query->getResult();
}
/**
diff --git a/lib/RoadizCoreBundle/src/Repository/NodesSourcesRepository.php b/lib/RoadizCoreBundle/src/Repository/NodesSourcesRepository.php
index a6470c4bb..d948447d7 100644
--- a/lib/RoadizCoreBundle/src/Repository/NodesSourcesRepository.php
+++ b/lib/RoadizCoreBundle/src/Repository/NodesSourcesRepository.php
@@ -391,9 +391,9 @@ public function findBy(
* if a limit is set because of the default inner join
*/
return (new Paginator($query))->getIterator()->getArrayCopy();
- } else {
- return $query->getResult();
}
+
+ return $query->getResult();
}
/**
diff --git a/lib/RoadizCoreBundle/src/Repository/PrefixAwareRepository.php b/lib/RoadizCoreBundle/src/Repository/PrefixAwareRepository.php
index fcde69c94..058588321 100644
--- a/lib/RoadizCoreBundle/src/Repository/PrefixAwareRepository.php
+++ b/lib/RoadizCoreBundle/src/Repository/PrefixAwareRepository.php
@@ -174,9 +174,9 @@ public function findBy(
* if a limit is set because of the default inner join
*/
return (new Paginator($query))->getIterator()->getArrayCopy();
- } else {
- return $query->getResult();
}
+
+ return $query->getResult();
}
/**
@@ -260,9 +260,9 @@ public function searchBy(
* if a limit is set because of the default inner join
*/
return (new Paginator($query))->getIterator()->getArrayCopy();
- } else {
- return $query->getResult();
}
+
+ return $query->getResult();
}
public function countSearchBy(string $pattern, array $criteria = []): int
diff --git a/lib/RoadizCoreBundle/src/Repository/TagRepository.php b/lib/RoadizCoreBundle/src/Repository/TagRepository.php
index 4f35b3f08..8b80c64d5 100644
--- a/lib/RoadizCoreBundle/src/Repository/TagRepository.php
+++ b/lib/RoadizCoreBundle/src/Repository/TagRepository.php
@@ -240,9 +240,9 @@ public function findBy(
* if a limit is set because of the default inner join
*/
return (new Paginator($query))->getIterator()->getArrayCopy();
- } else {
- return $query->getResult();
}
+
+ return $query->getResult();
}
/**
diff --git a/lib/RoadizCoreBundle/src/Routing/NodeRouteHelper.php b/lib/RoadizCoreBundle/src/Routing/NodeRouteHelper.php
index 2c5518767..f6cca9969 100644
--- a/lib/RoadizCoreBundle/src/Routing/NodeRouteHelper.php
+++ b/lib/RoadizCoreBundle/src/Routing/NodeRouteHelper.php
@@ -68,7 +68,7 @@ public function getController(): ?string
return $this->controller;
}
- protected function getControllerNamespace(): string
+ private function getControllerNamespace(): string
{
$namespace = $this->defaultControllerNamespace;
if (null !== $this->theme) {
diff --git a/lib/RoadizCoreBundle/src/Routing/NodesSourcesUrlGenerator.php b/lib/RoadizCoreBundle/src/Routing/NodesSourcesUrlGenerator.php
index 5441fbd48..26e93e8cf 100644
--- a/lib/RoadizCoreBundle/src/Routing/NodesSourcesUrlGenerator.php
+++ b/lib/RoadizCoreBundle/src/Routing/NodesSourcesUrlGenerator.php
@@ -20,7 +20,7 @@ public function __construct(
) {
}
- protected function isNodeSourceHome(NodesSources $nodeSource): bool
+ private function isNodeSourceHome(NodesSources $nodeSource): bool
{
if ($nodeSource->getNode()->isHome()) {
return true;
@@ -44,9 +44,9 @@ public function getNonContextualUrl(?Theme $theme = null, array $parameters = []
&& false === $this->forceLocale
) {
return '';
- } else {
- return $this->nodeSource->getTranslation()->getPreferredLocale();
}
+
+ return $this->nodeSource->getTranslation()->getPreferredLocale();
}
$path = $this->pathAggregator->aggregatePath($this->nodeSource, $parameters);
@@ -70,12 +70,11 @@ public function getNonContextualUrl(?Theme $theme = null, array $parameters = []
}
return $path;
- } else {
- throw new \RuntimeException('Cannot generate Url for a NULL NodesSources', 1);
}
+ throw new \RuntimeException('Cannot generate Url for a NULL NodesSources', 1);
}
- protected function useUrlAlias(NodesSources $nodesSources): bool
+ private function useUrlAlias(NodesSources $nodesSources): bool
{
if ($nodesSources->getIdentifier() !== $nodesSources->getNode()->getNodeName()) {
return true;
@@ -84,7 +83,7 @@ protected function useUrlAlias(NodesSources $nodesSources): bool
return false;
}
- protected function urlNeedsLocalePrefix(NodesSources $nodesSources): bool
+ private function urlNeedsLocalePrefix(NodesSources $nodesSources): bool
{
/*
* Needs a prefix only if translation is not default AND nodeSource does not have an Url alias
diff --git a/lib/RoadizCoreBundle/src/Routing/ResourceInfo.php b/lib/RoadizCoreBundle/src/Routing/ResourceInfo.php
index 47b128d7f..7e06ab88c 100644
--- a/lib/RoadizCoreBundle/src/Routing/ResourceInfo.php
+++ b/lib/RoadizCoreBundle/src/Routing/ResourceInfo.php
@@ -9,10 +9,10 @@
final class ResourceInfo
{
- protected ?PersistableInterface $resource = null;
- protected ?TranslationInterface $translation = null;
- protected ?string $format = null;
- protected ?string $locale = null;
+ private ?PersistableInterface $resource = null;
+ private ?TranslationInterface $translation = null;
+ private ?string $format = null;
+ private ?string $locale = null;
public function getResource(): ?PersistableInterface
{
diff --git a/lib/RoadizCoreBundle/src/SearchEngine/AbstractSearchHandler.php b/lib/RoadizCoreBundle/src/SearchEngine/AbstractSearchHandler.php
index b51639f3b..af485dfe3 100644
--- a/lib/RoadizCoreBundle/src/SearchEngine/AbstractSearchHandler.php
+++ b/lib/RoadizCoreBundle/src/SearchEngine/AbstractSearchHandler.php
@@ -30,6 +30,8 @@ public function __construct(
protected readonly ObjectManager $em,
LoggerInterface $searchEngineLogger,
protected readonly EventDispatcherInterface $eventDispatcher,
+ protected readonly int $fuzzyProximity,
+ protected readonly int $fuzzyMinTermLength,
) {
$this->logger = $searchEngineLogger;
}
@@ -219,10 +221,10 @@ protected function getFormattedQuery(string $q): array
$fuzzyiedQuery = implode(' ', array_map(function (string $word) {
/*
* Do not fuzz short words: Solr crashes
- * Proximity is set to 1 by default for single-words
+ * Proximity is configurable and can be disabled.
*/
- if (\mb_strlen($word) > 3) {
- return $this->escapeQuery($word).'~2';
+ if ($this->shouldFuzzify($word)) {
+ return $this->escapeQuery($word).$this->getFuzzySuffix();
}
return $this->escapeQuery($word);
@@ -234,7 +236,10 @@ protected function getFormattedQuery(string $q): array
/*
* Wildcard search for allowing autocomplete
*/
- $wildcardQuery = $this->escapeQuery($q).'*~2';
+ $wildcardQuery = $this->escapeQuery($q).'*';
+ if ($this->shouldFuzzify($q)) {
+ $wildcardQuery .= $this->getFuzzySuffix();
+ }
return [$exactQuery, $fuzzyiedQuery, $wildcardQuery];
}
@@ -266,29 +271,43 @@ protected function buildQuery(string $q, array &$args, bool $searchTags = false)
$exactQuery,
$fuzzyiedQuery
);
- } else {
- return sprintf(
- '('.$titleField.':%s)^10 ('.$titleField.':%s) ('.$titleField.':%s) ('.$collectionField.':%s)^2 ('.$collectionField.':%s)',
- $exactQuery,
- $fuzzyiedQuery,
- $wildcardQuery,
- $exactQuery,
- $fuzzyiedQuery
- );
}
+
+ return sprintf(
+ '('.$titleField.':%s)^10 ('.$titleField.':%s) ('.$titleField.':%s) ('.$collectionField.':%s)^2 ('.$collectionField.':%s)',
+ $exactQuery,
+ $fuzzyiedQuery,
+ $wildcardQuery,
+ $exactQuery,
+ $fuzzyiedQuery
+ );
}
protected function buildHighlightingQuery(string $q): string
{
$q = trim($q);
$words = preg_split('#[\s,]+#', $q, -1, PREG_SPLIT_NO_EMPTY);
- if (\is_array($words) && \count($words) > 1) {
+ if (!\is_array($words) || \count($words) > 1) {
return $this->escapeQuery($q);
}
- $q = $this->escapeQuery($q);
+ $escapedQuery = $this->escapeQuery($q);
+ if (!$this->shouldFuzzify($q)) {
+ return $escapedQuery;
+ }
+
+ return $escapedQuery.$this->getFuzzySuffix();
+ }
+
+ private function shouldFuzzify(string $word): bool
+ {
+ return $this->fuzzyProximity > 0
+ && \mb_strlen($word) >= $this->fuzzyMinTermLength;
+ }
- return sprintf('%s~2', $q);
+ private function getFuzzySuffix(): string
+ {
+ return '~'.$this->fuzzyProximity;
}
protected function buildQueryFields(array &$args, bool $searchTags = true): string
diff --git a/lib/RoadizCoreBundle/src/SearchEngine/AbstractSolarium.php b/lib/RoadizCoreBundle/src/SearchEngine/AbstractSolarium.php
index d2173c8ca..7924934ff 100644
--- a/lib/RoadizCoreBundle/src/SearchEngine/AbstractSolarium.php
+++ b/lib/RoadizCoreBundle/src/SearchEngine/AbstractSolarium.php
@@ -142,9 +142,9 @@ public function remove(Query $update): bool
$update->addDeleteById($this->document->id);
return true;
- } else {
- return false;
}
+
+ return false;
}
/**
@@ -249,12 +249,11 @@ public function getDocumentFromIndex(): bool
if (0 === $resultset->getNumFound()) {
return false;
- } else {
- foreach ($resultset as $document) {
- $this->document = $document;
+ }
+ foreach ($resultset as $document) {
+ $this->document = $document;
- return true;
- }
+ return true;
}
return false;
diff --git a/lib/RoadizCoreBundle/src/SearchEngine/ClientRegistry.php b/lib/RoadizCoreBundle/src/SearchEngine/ClientRegistry.php
index 5d87d45fe..12a451999 100644
--- a/lib/RoadizCoreBundle/src/SearchEngine/ClientRegistry.php
+++ b/lib/RoadizCoreBundle/src/SearchEngine/ClientRegistry.php
@@ -22,7 +22,7 @@ public function getClient(): ?Client
if (null === $client) {
return null;
}
- if (!($client instanceof Client)) {
+ if (!$client instanceof Client) {
throw new \RuntimeException('Solr client must be an instance of '.Client::class);
}
diff --git a/lib/RoadizCoreBundle/src/SearchEngine/GlobalNodeSourceSearchHandler.php b/lib/RoadizCoreBundle/src/SearchEngine/GlobalNodeSourceSearchHandler.php
index 82fb7c4fd..966260a82 100644
--- a/lib/RoadizCoreBundle/src/SearchEngine/GlobalNodeSourceSearchHandler.php
+++ b/lib/RoadizCoreBundle/src/SearchEngine/GlobalNodeSourceSearchHandler.php
@@ -17,7 +17,7 @@ public function __construct(
) {
}
- protected function getRepository(): NodesSourcesRepository
+ private function getRepository(): NodesSourcesRepository
{
return $this->allStatusesNodesSourcesRepository;
}
diff --git a/lib/RoadizCoreBundle/src/Security/Authorization/AccessDeniedHandler.php b/lib/RoadizCoreBundle/src/Security/Authorization/AccessDeniedHandler.php
index 2899141b4..f0226bfc8 100644
--- a/lib/RoadizCoreBundle/src/Security/Authorization/AccessDeniedHandler.php
+++ b/lib/RoadizCoreBundle/src/Security/Authorization/AccessDeniedHandler.php
@@ -53,15 +53,14 @@ public function handle(Request $request, AccessDeniedException $accessDeniedExce
],
Response::HTTP_FORBIDDEN
);
+ }
+ if ('' !== $this->redirectRoute) {
+ $redirectUrl = $this->urlGenerator->generate($this->redirectRoute, $this->redirectParameters);
} else {
- if ('' !== $this->redirectRoute) {
- $redirectUrl = $this->urlGenerator->generate($this->redirectRoute, $this->redirectParameters);
- } else {
- $redirectUrl = $request->getBaseUrl();
- }
-
- // Forbidden code should be set on final response, not the redirection!
- return new RedirectResponse($redirectUrl, Response::HTTP_FOUND);
+ $redirectUrl = $request->getBaseUrl();
}
+
+ // Forbidden code should be set on final response, not the redirection!
+ return new RedirectResponse($redirectUrl, Response::HTTP_FOUND);
}
}
diff --git a/lib/RoadizCoreBundle/src/Security/Authorization/Chroot/NodeChrootChainResolver.php b/lib/RoadizCoreBundle/src/Security/Authorization/Chroot/NodeChrootChainResolver.php
index 6c21dcc82..a4aba54ad 100644
--- a/lib/RoadizCoreBundle/src/Security/Authorization/Chroot/NodeChrootChainResolver.php
+++ b/lib/RoadizCoreBundle/src/Security/Authorization/Chroot/NodeChrootChainResolver.php
@@ -17,7 +17,7 @@
public function __construct(private array $resolvers)
{
foreach ($this->resolvers as $resolver) {
- if (!($resolver instanceof NodeChrootResolver)) {
+ if (!$resolver instanceof NodeChrootResolver) {
throw new \InvalidArgumentException('Resolver must implements '.NodeChrootResolver::class);
}
}
diff --git a/lib/RoadizCoreBundle/src/Security/Authorization/Voter/GroupVoter.php b/lib/RoadizCoreBundle/src/Security/Authorization/Voter/GroupVoter.php
index 8bfda2353..28cc356ba 100644
--- a/lib/RoadizCoreBundle/src/Security/Authorization/Voter/GroupVoter.php
+++ b/lib/RoadizCoreBundle/src/Security/Authorization/Voter/GroupVoter.php
@@ -35,7 +35,7 @@ public function vote(TokenInterface $token, $subject, array $attributes): int
$user = $token->getUser();
foreach ($attributes as $attribute) {
- if (!($attribute instanceof Group)) {
+ if (!$attribute instanceof Group) {
return VoterInterface::ACCESS_ABSTAIN;
}
diff --git a/lib/RoadizCoreBundle/src/Security/LogTrail.php b/lib/RoadizCoreBundle/src/Security/LogTrail.php
index 81fabb652..0802fd1ec 100644
--- a/lib/RoadizCoreBundle/src/Security/LogTrail.php
+++ b/lib/RoadizCoreBundle/src/Security/LogTrail.php
@@ -37,7 +37,7 @@ public function publishErrorMessage(Request $request, string $msg, ?object $sour
* Publish a message in Session flash bag and
* logger interface.
*/
- protected function publishMessage(
+ private function publishMessage(
Request $request,
string $msg,
string $level = 'confirm',
diff --git a/lib/RoadizCoreBundle/src/Security/User/UserProvider.php b/lib/RoadizCoreBundle/src/Security/User/UserProvider.php
index a4071e861..480ab255d 100644
--- a/lib/RoadizCoreBundle/src/Security/User/UserProvider.php
+++ b/lib/RoadizCoreBundle/src/Security/User/UserProvider.php
@@ -25,7 +25,7 @@ public function loadUserByUsername(string $username): UserInterface
return $this->loadUserByUsernameOrEmail($username);
}
- protected function loadUserByUsernameOrEmail(string $identifier): UserInterface
+ private function loadUserByUsernameOrEmail(string $identifier): UserInterface
{
/** @var User|null $user */
$user = $this->managerRegistry
@@ -41,9 +41,8 @@ protected function loadUserByUsernameOrEmail(string $identifier): UserInterface
if (null !== $user) {
return $user;
- } else {
- throw new UserNotFoundException();
}
+ throw new UserNotFoundException();
}
public function loadUserByIdentifier(string $identifier): UserInterface
@@ -77,9 +76,8 @@ public function refreshUser(UserInterface $user): UserInterface
) {
// Always refresh User from database: too much related entities to rely only on token.
return $refreshUser;
- } else {
- throw new UserNotFoundException('Token user does not exist anymore, authenticate again…');
}
+ throw new UserNotFoundException('Token user does not exist anymore, authenticate again…');
}
throw new UnsupportedUserException();
}
diff --git a/lib/RoadizCoreBundle/src/Security/User/UserViewer.php b/lib/RoadizCoreBundle/src/Security/User/UserViewer.php
index 035827592..07aaaae42 100644
--- a/lib/RoadizCoreBundle/src/Security/User/UserViewer.php
+++ b/lib/RoadizCoreBundle/src/Security/User/UserViewer.php
@@ -105,7 +105,7 @@ public function sendLoginLink(
$this->loginLinkSender->sendLoginLink($user, $loginLinkDetails);
}
- protected function getContactEmail(): string
+ private function getContactEmail(): string
{
$emailContact = $this->settingsBag->get('email_sender') ?? '';
if (empty($emailContact)) {
@@ -115,7 +115,7 @@ protected function getContactEmail(): string
return $emailContact;
}
- protected function getSiteName(): string
+ private function getSiteName(): string
{
$siteName = $this->settingsBag->get('site_name') ?? '';
if (empty($siteName)) {
diff --git a/lib/RoadizCoreBundle/src/Serializer/Normalizer/RealmSerializationGroupNormalizer.php b/lib/RoadizCoreBundle/src/Serializer/Normalizer/RealmSerializationGroupNormalizer.php
index 06713d950..68ead37ac 100644
--- a/lib/RoadizCoreBundle/src/Serializer/Normalizer/RealmSerializationGroupNormalizer.php
+++ b/lib/RoadizCoreBundle/src/Serializer/Normalizer/RealmSerializationGroupNormalizer.php
@@ -29,7 +29,7 @@ public function __construct(
public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool
{
- if (!($data instanceof NodesSources)) {
+ if (!$data instanceof NodesSources) {
return false;
}
// Make sure we're not called twice
diff --git a/lib/RoadizCoreBundle/src/Serializer/Normalizer/TranslationAwareNormalizer.php b/lib/RoadizCoreBundle/src/Serializer/Normalizer/TranslationAwareNormalizer.php
index 3f8402795..5a78f4f80 100644
--- a/lib/RoadizCoreBundle/src/Serializer/Normalizer/TranslationAwareNormalizer.php
+++ b/lib/RoadizCoreBundle/src/Serializer/Normalizer/TranslationAwareNormalizer.php
@@ -65,9 +65,9 @@ private function getTranslationFromLocale(string $locale): ?TranslationInterface
if ($this->previewResolver->isPreview()) {
return $repository->findOneByLocaleOrOverrideLocale($locale);
- } else {
- return $repository->findOneAvailableByLocaleOrOverrideLocale($locale);
}
+
+ return $repository->findOneAvailableByLocaleOrOverrideLocale($locale);
}
private function getTranslationFromRequest(): ?TranslationInterface
diff --git a/lib/RoadizCoreBundle/src/TwigExtension/BlockRenderExtension.php b/lib/RoadizCoreBundle/src/TwigExtension/BlockRenderExtension.php
index c023d81ba..0543e9032 100644
--- a/lib/RoadizCoreBundle/src/TwigExtension/BlockRenderExtension.php
+++ b/lib/RoadizCoreBundle/src/TwigExtension/BlockRenderExtension.php
@@ -49,9 +49,8 @@ public function blockRender(?NodesSources $nodeSource = null, string $themeName
return $this->handler->render($controllerReference, 'inline', [
'ignore_errors' => false,
]);
- } else {
- throw new RuntimeError($class.'::blockAction() action does not exist.');
}
+ throw new RuntimeError($class.'::blockAction() action does not exist.');
} else {
throw new RuntimeError('Invalid name formatting for your theme.');
}
diff --git a/lib/RoadizCoreBundle/src/TwigExtension/DocumentUrlExtension.php b/lib/RoadizCoreBundle/src/TwigExtension/DocumentUrlExtension.php
index 07c5c002b..52bb96b72 100644
--- a/lib/RoadizCoreBundle/src/TwigExtension/DocumentUrlExtension.php
+++ b/lib/RoadizCoreBundle/src/TwigExtension/DocumentUrlExtension.php
@@ -44,9 +44,9 @@ public function getUrl(?PersistableInterface $mixed = null, array $criteria = []
if (null === $mixed) {
if ($this->throwExceptions) {
throw new RuntimeError('Twig “url” filter must be used with a not null object');
- } else {
- return '';
}
+
+ return '';
}
if ($mixed instanceof DocumentInterface) {
diff --git a/lib/RoadizCoreBundle/src/TwigExtension/NodesSourcesExtension.php b/lib/RoadizCoreBundle/src/TwigExtension/NodesSourcesExtension.php
index 108bf2755..b4fdb16f8 100644
--- a/lib/RoadizCoreBundle/src/TwigExtension/NodesSourcesExtension.php
+++ b/lib/RoadizCoreBundle/src/TwigExtension/NodesSourcesExtension.php
@@ -72,9 +72,9 @@ public function getChildren(?NodesSources $ns = null, ?array $criteria = null, ?
if (null === $ns) {
if ($this->throwExceptions) {
throw new RuntimeError('Cannot get children from a NULL node-source.');
- } else {
- return [];
}
+
+ return [];
}
if ($displayNotPublished) {
@@ -94,9 +94,9 @@ public function getNext(?NodesSources $ns = null, ?array $criteria = null, ?arra
if (null === $ns) {
if ($this->throwExceptions) {
throw new RuntimeError('Cannot get next sibling from a NULL node-source.');
- } else {
- return null;
}
+
+ return null;
}
if ($displayNotPublished) {
@@ -116,9 +116,9 @@ public function getPrevious(?NodesSources $ns = null, ?array $criteria = null, ?
if (null === $ns) {
if ($this->throwExceptions) {
throw new RuntimeError('Cannot get previous sibling from a NULL node-source.');
- } else {
- return null;
}
+
+ return null;
}
if ($displayNotPublished) {
@@ -138,9 +138,9 @@ public function getLastSibling(?NodesSources $ns = null, ?array $criteria = null
if (null === $ns) {
if ($this->throwExceptions) {
throw new RuntimeError('Cannot get last sibling from a NULL node-source.');
- } else {
- return null;
}
+
+ return null;
}
if ($displayNotPublished) {
@@ -160,9 +160,9 @@ public function getFirstSibling(?NodesSources $ns = null, ?array $criteria = nul
if (null === $ns) {
if ($this->throwExceptions) {
throw new RuntimeError('Cannot get first sibling from a NULL node-source.');
- } else {
- return null;
}
+
+ return null;
}
if ($displayNotPublished) {
@@ -182,9 +182,9 @@ public function getParent(?NodesSources $ns = null): ?NodesSources
if (null === $ns) {
if ($this->throwExceptions) {
throw new RuntimeError('Cannot get parent from a NULL node-source.');
- } else {
- return null;
}
+
+ return null;
}
return $ns->getParent();
@@ -201,9 +201,9 @@ public function getParents(?NodesSources $ns = null, ?array $criteria = null, bo
if (null === $ns) {
if ($this->throwExceptions) {
throw new RuntimeError('Cannot get parents from a NULL node-source.');
- } else {
- return [];
}
+
+ return [];
}
if ($displayNotPublished) {
@@ -227,9 +227,9 @@ public function getTags(?NodesSources $ns = null): iterable
if (null === $ns) {
if ($this->throwExceptions) {
throw new RuntimeError('Cannot get tags from a NULL node-source.');
- } else {
- return [];
}
+
+ return [];
}
return $this->tagRepository->findByNodesSources($ns);
diff --git a/lib/RoadizFontBundle/src/Entity/Font.php b/lib/RoadizFontBundle/src/Entity/Font.php
index ebb3316a0..bbfecaac8 100644
--- a/lib/RoadizFontBundle/src/Entity/Font.php
+++ b/lib/RoadizFontBundle/src/Entity/Font.php
@@ -16,14 +16,12 @@
* Fonts are entities which store each webfont file for a
* font-family and a font-variant.
*/
-#[
- ORM\Entity(repositoryClass: FontRepository::class),
+#[ORM\Entity(repositoryClass: FontRepository::class),
ORM\Table(name: 'fonts'),
ORM\UniqueConstraint(columns: ['name', 'variant']),
ORM\Index(columns: ['created_at'], name: 'font_created_at'),
ORM\Index(columns: ['updated_at'], name: 'font_updated_at'),
- UniqueEntity(fields: ['name', 'variant'])
-]
+ UniqueEntity(fields: ['name', 'variant'])]
class Font extends AbstractDateTimed
{
public const REGULAR = 0;
diff --git a/lib/RoadizRozierBundle/src/Controller/Document/DocumentEmbedController.php b/lib/RoadizRozierBundle/src/Controller/Document/DocumentEmbedController.php
index a6d08456e..604bd9a62 100644
--- a/lib/RoadizRozierBundle/src/Controller/Document/DocumentEmbedController.php
+++ b/lib/RoadizRozierBundle/src/Controller/Document/DocumentEmbedController.php
@@ -189,9 +189,8 @@ private function embedDocument(array $data, ?int $folderId = null): DocumentInte
}
return $this->createDocumentFromFinder($finder, $folderId);
- } else {
- throw new \RuntimeException('bad.request', 1);
}
+ throw new \RuntimeException('bad.request', 1);
}
/**
diff --git a/lib/RoadizRozierBundle/src/Controller/Node/SeoController.php b/lib/RoadizRozierBundle/src/Controller/Node/SeoController.php
index 0c448ffcc..287adf3b9 100644
--- a/lib/RoadizRozierBundle/src/Controller/Node/SeoController.php
+++ b/lib/RoadizRozierBundle/src/Controller/Node/SeoController.php
@@ -189,12 +189,11 @@ private function addNodeUrlAlias(UrlAlias $alias, Node $node, Translation $trans
$entityManager->flush();
return $alias;
- } else {
- $msg = $this->translator->trans('url_alias.no_translation.%translation%', [
- '%translation%' => $translation->getName(),
- ]);
- throw new NoTranslationAvailableException($msg);
}
+ $msg = $this->translator->trans('url_alias.no_translation.%translation%', [
+ '%translation%' => $translation->getName(),
+ ]);
+ throw new NoTranslationAvailableException($msg);
}
private function handleSingleUrlAlias(
diff --git a/lib/RoadizRozierBundle/src/Controller/SecurityController.php b/lib/RoadizRozierBundle/src/Controller/SecurityController.php
index c5253788e..2c31bff4d 100644
--- a/lib/RoadizRozierBundle/src/Controller/SecurityController.php
+++ b/lib/RoadizRozierBundle/src/Controller/SecurityController.php
@@ -72,7 +72,7 @@ public function requestLoginLink(
$email = $request->getPayload()->get('email');
$user = $userRepository->findOneBy(['email' => $email]);
- if (!($user instanceof UserInterface)) {
+ if (!$user instanceof UserInterface) {
// Do not reveal whether a user account exists or not
return $this->redirectToRoute('roadiz_rozier_login_link_sent');
}
diff --git a/lib/RoadizRozierBundle/src/DependencyInjection/Configuration.php b/lib/RoadizRozierBundle/src/DependencyInjection/Configuration.php
index 9f941ab21..ad45ad7d3 100644
--- a/lib/RoadizRozierBundle/src/DependencyInjection/Configuration.php
+++ b/lib/RoadizRozierBundle/src/DependencyInjection/Configuration.php
@@ -64,7 +64,7 @@ public function getConfigTreeBuilder(): TreeBuilder
return $builder;
}
- protected function addOpenIdNode(): NodeDefinition
+ private function addOpenIdNode(): NodeDefinition
{
$builder = new TreeBuilder('open_id');
$node = $builder->getRootNode();
@@ -149,7 +149,7 @@ protected function addOpenIdNode(): NodeDefinition
return $node;
}
- protected function addCsvNode(): NodeDefinition
+ private function addCsvNode(): NodeDefinition
{
$builder = new TreeBuilder('csv_encoder_options');
$node = $builder->getRootNode();
diff --git a/lib/RoadizTwoFactorBundle/src/Backup/BackupCodeManager.php b/lib/RoadizTwoFactorBundle/src/Backup/BackupCodeManager.php
index 6b8451423..b4a423f23 100644
--- a/lib/RoadizTwoFactorBundle/src/Backup/BackupCodeManager.php
+++ b/lib/RoadizTwoFactorBundle/src/Backup/BackupCodeManager.php
@@ -37,7 +37,7 @@ public function invalidateBackupCode(object $user, string $code): void
$user = $this->twoFactorUserProvider->getFromUser($user);
}
- if (!($user instanceof BackupCodeInterface)) {
+ if (!$user instanceof BackupCodeInterface) {
return;
}
diff --git a/lib/RoadizTwoFactorBundle/src/Controller/BackupCodesAdminController.php b/lib/RoadizTwoFactorBundle/src/Controller/BackupCodesAdminController.php
index d56a8c780..631de46f1 100644
--- a/lib/RoadizTwoFactorBundle/src/Controller/BackupCodesAdminController.php
+++ b/lib/RoadizTwoFactorBundle/src/Controller/BackupCodesAdminController.php
@@ -29,7 +29,7 @@ public function backupCodesAdminAction(Request $request, TokenStorageInterface $
}
$user = $tokenStorage->getToken()->getUser();
- if (!($user instanceof User)) {
+ if (!$user instanceof User) {
throw $this->createAccessDeniedException('You must be logged in to access this page.');
}
$twoFactorUser = $this->twoFactorUserProvider->getFromUser($user);
diff --git a/lib/RoadizTwoFactorBundle/src/Controller/QrCodeController.php b/lib/RoadizTwoFactorBundle/src/Controller/QrCodeController.php
index 82df278e1..6c9452668 100644
--- a/lib/RoadizTwoFactorBundle/src/Controller/QrCodeController.php
+++ b/lib/RoadizTwoFactorBundle/src/Controller/QrCodeController.php
@@ -37,12 +37,12 @@ public function totpQrCodeAction(TokenStorageInterface $tokenStorage): Response
}
$user = $tokenStorage->getToken()->getUser();
- if (!($user instanceof User)) {
+ if (!$user instanceof User) {
throw $this->createAccessDeniedException('You must be logged in to access this page.');
}
$twoFactorUser = $this->twoFactorUserProvider->getFromUser($user);
- if (!($twoFactorUser instanceof TwoFactorInterface)) {
+ if (!$twoFactorUser instanceof TwoFactorInterface) {
throw $this->createNotFoundException('Cannot display QR code');
}
diff --git a/lib/RoadizTwoFactorBundle/src/Controller/TwoFactorAdminController.php b/lib/RoadizTwoFactorBundle/src/Controller/TwoFactorAdminController.php
index 07d9618c2..2e8a355b5 100644
--- a/lib/RoadizTwoFactorBundle/src/Controller/TwoFactorAdminController.php
+++ b/lib/RoadizTwoFactorBundle/src/Controller/TwoFactorAdminController.php
@@ -34,7 +34,7 @@ public function twoFactorAdminAction(Request $request, TokenStorageInterface $to
}
$user = $tokenStorage->getToken()->getUser();
- if (!($user instanceof User)) {
+ if (!$user instanceof User) {
throw $this->createAccessDeniedException('You must be logged in to access this page.');
}
$assignation = [];
@@ -82,7 +82,7 @@ public function twoFactorDisableAction(Request $request, TokenStorageInterface $
$this->denyAccessUnlessGranted('ROLE_BACKEND_USER');
$user = $tokenStorage->getToken()->getUser();
- if (!($user instanceof User)) {
+ if (!$user instanceof User) {
throw $this->createAccessDeniedException('You must be logged in to access this page.');
}
$twoFactorUser = $this->twoFactorUserProvider->getFromUser($user);
diff --git a/lib/RoadizTwoFactorBundle/src/Entity/TwoFactorUser.php b/lib/RoadizTwoFactorBundle/src/Entity/TwoFactorUser.php
index ee01c1aa6..659ee3952 100644
--- a/lib/RoadizTwoFactorBundle/src/Entity/TwoFactorUser.php
+++ b/lib/RoadizTwoFactorBundle/src/Entity/TwoFactorUser.php
@@ -15,11 +15,9 @@
use Scheb\TwoFactorBundle\Model\TrustedDeviceInterface;
use Symfony\Component\Validator\Constraints as Assert;
-#[
- ORM\Entity(repositoryClass: TwoFactorUserRepository::class),
+#[ORM\Entity(repositoryClass: TwoFactorUserRepository::class),
ORM\Table(name: 'two_factor_users'),
- ORM\UniqueConstraint(columns: ['user_id']),
-]
+ ORM\UniqueConstraint(columns: ['user_id']),]
class TwoFactorUser implements TotpTwoFactorInterface, BackupCodeInterface, TrustedDeviceInterface, GoogleAuthenticatorTwoFactorInterface
{
#[ORM\OneToOne(targetEntity: User::class)]
diff --git a/lib/RoadizTwoFactorBundle/src/Security/Provider/AuthenticatorTwoFactorProvider.php b/lib/RoadizTwoFactorBundle/src/Security/Provider/AuthenticatorTwoFactorProvider.php
index 0e054d962..fc224629d 100644
--- a/lib/RoadizTwoFactorBundle/src/Security/Provider/AuthenticatorTwoFactorProvider.php
+++ b/lib/RoadizTwoFactorBundle/src/Security/Provider/AuthenticatorTwoFactorProvider.php
@@ -25,7 +25,7 @@ public function __construct(
public function beginAuthentication(AuthenticationContextInterface $context): bool
{
$user = $context->getUser();
- if (!($user instanceof User)) {
+ if (!$user instanceof User) {
return false;
}
@@ -58,7 +58,7 @@ public function validateAuthenticationCode(object $user, string $authenticationC
$user = $this->getTwoFactorFromUser($user);
}
- if (!($user instanceof TwoFactorInterface)) {
+ if (!$user instanceof TwoFactorInterface) {
return false;
}
diff --git a/lib/RoadizUserBundle/composer.json b/lib/RoadizUserBundle/composer.json
index 8889a4541..661e03f32 100644
--- a/lib/RoadizUserBundle/composer.json
+++ b/lib/RoadizUserBundle/composer.json
@@ -21,7 +21,7 @@
"prefer-stable": true,
"require": {
"php": ">=8.2",
- "api-platform/core": "~3.3.11",
+ "api-platform/core": "~3.4.17",
"doctrine/orm": "~2.20.0",
"roadiz/core-bundle": "2.5.*",
"symfony/framework-bundle": "6.4.*",
diff --git a/lib/RoadizUserBundle/src/Entity/UserValidationToken.php b/lib/RoadizUserBundle/src/Entity/UserValidationToken.php
index 129355bd4..79ecd1b14 100644
--- a/lib/RoadizUserBundle/src/Entity/UserValidationToken.php
+++ b/lib/RoadizUserBundle/src/Entity/UserValidationToken.php
@@ -10,11 +10,9 @@
use Symfony\Component\Security\Core\User\UserInterface;
use Symfony\Component\Validator\Constraints as Assert;
-#[
- ORM\Table(name: 'user_validation_tokens'),
+#[ORM\Table(name: 'user_validation_tokens'),
UniqueEntity('token'),
- ORM\Entity(repositoryClass: UserValidationTokenRepository::class)
-]
+ ORM\Entity(repositoryClass: UserValidationTokenRepository::class)]
class UserValidationToken
{
#[ORM\Column(name: 'id', type: 'integer')]
diff --git a/lib/RoadizUserBundle/src/Manager/UserValidationTokenManager.php b/lib/RoadizUserBundle/src/Manager/UserValidationTokenManager.php
index 3f228d78c..373ecc408 100644
--- a/lib/RoadizUserBundle/src/Manager/UserValidationTokenManager.php
+++ b/lib/RoadizUserBundle/src/Manager/UserValidationTokenManager.php
@@ -76,7 +76,7 @@ private function sendUserValidationEmail(UserValidationToken $userValidationToke
$user = $userValidationToken->getUser();
- if (!($user instanceof User)) {
+ if (!$user instanceof User) {
return;
}
diff --git a/lib/RoadizUserBundle/src/State/UserValidationTokenProcessor.php b/lib/RoadizUserBundle/src/State/UserValidationTokenProcessor.php
index c20752a8b..8f2a9b3ec 100644
--- a/lib/RoadizUserBundle/src/State/UserValidationTokenProcessor.php
+++ b/lib/RoadizUserBundle/src/State/UserValidationTokenProcessor.php
@@ -56,7 +56,7 @@ public function process($data, Operation $operation, array $uriVariables = [], a
throw new AccessDeniedHttpException('Token does not belong to current account');
}
- if (!($user instanceof User)) {
+ if (!$user instanceof User) {
throw new UnprocessableEntityHttpException('User is not a valid user.');
}
diff --git a/lib/Rozier/src/Controllers/AbstractAdminController.php b/lib/Rozier/src/Controllers/AbstractAdminController.php
index 50aa51bf5..2b499f764 100644
--- a/lib/Rozier/src/Controllers/AbstractAdminController.php
+++ b/lib/Rozier/src/Controllers/AbstractAdminController.php
@@ -173,7 +173,7 @@ public function editAction(Request $request, $id): ?Response
/** @var mixed|object|null $item */
$item = $this->em()->find($this->getEntityClass(), $id);
- if (!($item instanceof PersistableInterface)) {
+ if (!$item instanceof PersistableInterface) {
throw $this->createNotFoundException();
}
@@ -259,7 +259,7 @@ public function deleteAction(Request $request, $id): ?Response
/** @var mixed|object|null $item */
$item = $this->em()->find($this->getEntityClass(), $id);
- if (!($item instanceof PersistableInterface)) {
+ if (!$item instanceof PersistableInterface) {
throw $this->createNotFoundException();
}
diff --git a/lib/Rozier/src/Controllers/Documents/DocumentsController.php b/lib/Rozier/src/Controllers/Documents/DocumentsController.php
index 47c0d3be9..bcd057515 100644
--- a/lib/Rozier/src/Controllers/Documents/DocumentsController.php
+++ b/lib/Rozier/src/Controllers/Documents/DocumentsController.php
@@ -225,19 +225,18 @@ public function uploadAction(Request $request, ?int $folderId = null, string $_f
'success' => true,
'document' => $documentModel->toArray(),
], Response::HTTP_CREATED);
- } else {
- return $this->redirectToRoute('documentsHomePage', ['folderId' => $folderId]);
}
- } else {
- $msg = $this->translator->trans('document.cannot_persist');
- $this->logTrail->publishErrorMessage($request, $msg, $document);
- if ('json' === $_format || $request->isXmlHttpRequest()) {
- throw $this->createNotFoundException($msg);
- } else {
- return $this->redirectToRoute('documentsHomePage', ['folderId' => $folderId]);
- }
+ return $this->redirectToRoute('documentsHomePage', ['folderId' => $folderId]);
+ }
+ $msg = $this->translator->trans('document.cannot_persist');
+ $this->logTrail->publishErrorMessage($request, $msg, $document);
+
+ if ('json' === $_format || $request->isXmlHttpRequest()) {
+ throw $this->createNotFoundException($msg);
}
+
+ return $this->redirectToRoute('documentsHomePage', ['folderId' => $folderId]);
} elseif ('json' === $_format || $request->isXmlHttpRequest()) {
/*
* Bad form submitted
diff --git a/lib/Rozier/src/Controllers/GroupsController.php b/lib/Rozier/src/Controllers/GroupsController.php
index 2da4cd71a..9c56446a9 100644
--- a/lib/Rozier/src/Controllers/GroupsController.php
+++ b/lib/Rozier/src/Controllers/GroupsController.php
@@ -139,11 +139,11 @@ public function removeRolesAction(Request $request, int $id, int $roleId): Respo
/** @var Role|null $role */
$role = $this->em()->find(Role::class, $roleId);
- if (!($item instanceof Group)) {
+ if (!$item instanceof Group) {
throw $this->createNotFoundException();
}
- if (!($role instanceof Role)) {
+ if (!$role instanceof Role) {
throw $this->createNotFoundException();
}
@@ -185,7 +185,7 @@ public function editUsersAction(Request $request, int $id): Response
/** @var Group|null $item */
$item = $this->em()->find($this->getEntityClass(), $id);
- if (!($item instanceof Group)) {
+ if (!$item instanceof Group) {
throw $this->createNotFoundException();
}
@@ -233,7 +233,7 @@ public function removeUsersAction(Request $request, int $id, int $userId): Respo
/** @var User|null $user */
$user = $this->em()->find(User::class, $userId);
- if (!($item instanceof Group)) {
+ if (!$item instanceof Group) {
throw $this->createNotFoundException();
}
diff --git a/lib/Rozier/src/Controllers/Nodes/NodesAttributesController.php b/lib/Rozier/src/Controllers/Nodes/NodesAttributesController.php
index 525f7f849..6c74214d9 100644
--- a/lib/Rozier/src/Controllers/Nodes/NodesAttributesController.php
+++ b/lib/Rozier/src/Controllers/Nodes/NodesAttributesController.php
@@ -151,21 +151,20 @@ public function editAction(Request $request, int $nodeId, int $translationId): R
'nodeId' => $node->getId(),
'translationId' => $translation->getId(),
]);
- } else {
- $errors = $this->formErrorSerializer->getErrorsAsArray($attributeValueTranslationForm);
- /*
- * Handle errors when Ajax POST requests
- */
- if ($isJson) {
- return new JsonResponse([
- 'status' => 'fail',
- 'errors' => $errors,
- 'message' => $this->translator->trans('form_has_errors.check_you_fields'),
- ], Response::HTTP_BAD_REQUEST);
- }
- foreach ($errors as $error) {
- $this->logTrail->publishErrorMessage($request, $error);
- }
+ }
+ $errors = $this->formErrorSerializer->getErrorsAsArray($attributeValueTranslationForm);
+ /*
+ * Handle errors when Ajax POST requests
+ */
+ if ($isJson) {
+ return new JsonResponse([
+ 'status' => 'fail',
+ 'errors' => $errors,
+ 'message' => $this->translator->trans('form_has_errors.check_you_fields'),
+ ], Response::HTTP_BAD_REQUEST);
+ }
+ foreach ($errors as $error) {
+ $this->logTrail->publishErrorMessage($request, $error);
}
}
diff --git a/lib/Rozier/src/Controllers/Nodes/NodesTreesController.php b/lib/Rozier/src/Controllers/Nodes/NodesTreesController.php
index 0d2d69cd5..1df8dbb91 100644
--- a/lib/Rozier/src/Controllers/Nodes/NodesTreesController.php
+++ b/lib/Rozier/src/Controllers/Nodes/NodesTreesController.php
@@ -207,9 +207,9 @@ public function bulkDeleteAction(Request $request): Response
if (!empty($form->getData()['referer'])) {
return $this->redirect($form->getData()['referer']);
- } else {
- return $this->redirectToRoute('nodesHomePage');
}
+
+ return $this->redirectToRoute('nodesHomePage');
}
$assignation['nodes'] = $nodes;
@@ -264,9 +264,9 @@ public function bulkStatusAction(Request $request): Response
if (!empty($form->getData()['referer'])) {
return $this->redirect($form->getData()['referer']);
- } else {
- return $this->redirectToRoute('nodesHomePage');
}
+
+ return $this->redirectToRoute('nodesHomePage');
}
$assignation['nodes'] = $nodes;
diff --git a/lib/Rozier/src/Controllers/RedirectionsController.php b/lib/Rozier/src/Controllers/RedirectionsController.php
index 308c3ea38..46540a690 100644
--- a/lib/Rozier/src/Controllers/RedirectionsController.php
+++ b/lib/Rozier/src/Controllers/RedirectionsController.php
@@ -75,7 +75,7 @@ protected function getDefaultOrder(Request $request): array
protected function createPostCreateEvent(PersistableInterface $item): RedirectionEvent
{
- if (!($item instanceof Redirection)) {
+ if (!$item instanceof Redirection) {
throw new \InvalidArgumentException('Item should be instance of '.Redirection::class);
}
@@ -84,7 +84,7 @@ protected function createPostCreateEvent(PersistableInterface $item): Redirectio
protected function createPostUpdateEvent(PersistableInterface $item): RedirectionEvent
{
- if (!($item instanceof Redirection)) {
+ if (!$item instanceof Redirection) {
throw new \InvalidArgumentException('Item should be instance of '.Redirection::class);
}
@@ -93,7 +93,7 @@ protected function createPostUpdateEvent(PersistableInterface $item): Redirectio
protected function createDeleteEvent(PersistableInterface $item): RedirectionEvent
{
- if (!($item instanceof Redirection)) {
+ if (!$item instanceof Redirection) {
throw new \InvalidArgumentException('Item should be instance of '.Redirection::class);
}
diff --git a/lib/Rozier/src/Controllers/SearchController.php b/lib/Rozier/src/Controllers/SearchController.php
index ac6ab3438..27f7990a3 100644
--- a/lib/Rozier/src/Controllers/SearchController.php
+++ b/lib/Rozier/src/Controllers/SearchController.php
@@ -324,14 +324,14 @@ protected function handleNodeTypeForm(FormInterface $nodeTypeForm): ?RedirectRes
if ($nodeTypeForm->isSubmitted() && $nodeTypeForm->isValid()) {
if (empty($nodeTypeForm->getData()['nodetype'])) {
return $this->redirectToRoute('searchNodePage');
- } else {
- return $this->redirectToRoute(
- 'searchNodeSourcePage',
- [
- 'nodeTypeName' => $nodeTypeForm->getData()['nodetype'],
- ]
- );
}
+
+ return $this->redirectToRoute(
+ 'searchNodeSourcePage',
+ [
+ 'nodeTypeName' => $nodeTypeForm->getData()['nodetype'],
+ ]
+ );
}
return null;
diff --git a/lib/Rozier/src/Controllers/SettingsController.php b/lib/Rozier/src/Controllers/SettingsController.php
index e95c6701a..b15534bc0 100644
--- a/lib/Rozier/src/Controllers/SettingsController.php
+++ b/lib/Rozier/src/Controllers/SettingsController.php
@@ -159,11 +159,11 @@ private function handleSingleSettingForm(
'settingGroupsSettingsPage',
['settingGroupId' => $settingGroup->getId()]
);
- } else {
- return $this->redirectToRoute(
- 'settingsHomePage'
- );
}
+
+ return $this->redirectToRoute(
+ 'settingsHomePage'
+ );
} catch (\RuntimeException $e) {
$form->addError(new FormError($e->getMessage()));
}
diff --git a/lib/Rozier/src/Controllers/Tags/TagsController.php b/lib/Rozier/src/Controllers/Tags/TagsController.php
index e3606ecee..7fcf41e2b 100644
--- a/lib/Rozier/src/Controllers/Tags/TagsController.php
+++ b/lib/Rozier/src/Controllers/Tags/TagsController.php
@@ -276,9 +276,9 @@ public function bulkDeleteAction(Request $request): Response
if (!empty($form->getData()['referer'])) {
return $this->redirect($form->getData()['referer']);
- } else {
- return $this->redirectToRoute('tagsHomePage');
}
+
+ return $this->redirectToRoute('tagsHomePage');
}
$assignation = [];
diff --git a/lib/Rozier/src/Controllers/Users/UsersController.php b/lib/Rozier/src/Controllers/Users/UsersController.php
index 2403de25e..a16b25e46 100644
--- a/lib/Rozier/src/Controllers/Users/UsersController.php
+++ b/lib/Rozier/src/Controllers/Users/UsersController.php
@@ -154,7 +154,7 @@ public function editDetailsAction(Request $request, int $id): Response
/** @var mixed|object|null $item */
$item = $this->em()->find($this->getEntityClass(), $id);
- if (!($item instanceof PersistableInterface)) {
+ if (!$item instanceof PersistableInterface) {
throw $this->createNotFoundException();
}
diff --git a/lib/Rozier/src/Controllers/WebhookController.php b/lib/Rozier/src/Controllers/WebhookController.php
index c5930fb86..09fdaa8b8 100644
--- a/lib/Rozier/src/Controllers/WebhookController.php
+++ b/lib/Rozier/src/Controllers/WebhookController.php
@@ -35,7 +35,7 @@ public function triggerAction(Request $request, string $id): Response
/** @var Webhook|null $item */
$item = $this->em()->find($this->getEntityClass(), $id);
- if (!($item instanceof PersistableInterface)) {
+ if (!$item instanceof PersistableInterface) {
throw $this->createNotFoundException();
}
diff --git a/lib/Rozier/src/Explorer/DocumentExplorerItem.php b/lib/Rozier/src/Explorer/DocumentExplorerItem.php
index 446ec3c67..30761fa88 100644
--- a/lib/Rozier/src/Explorer/DocumentExplorerItem.php
+++ b/lib/Rozier/src/Explorer/DocumentExplorerItem.php
@@ -74,7 +74,7 @@ public function getOriginal(): DocumentInterface
protected function getEditItemPath(): ?string
{
- if (!($this->document instanceof PersistableInterface)) {
+ if (!$this->document instanceof PersistableInterface) {
return null;
}
diff --git a/lib/Rozier/src/Explorer/NodeExplorerItem.php b/lib/Rozier/src/Explorer/NodeExplorerItem.php
index d78ad3061..fe2429007 100644
--- a/lib/Rozier/src/Explorer/NodeExplorerItem.php
+++ b/lib/Rozier/src/Explorer/NodeExplorerItem.php
@@ -52,7 +52,7 @@ public function getAlternativeDisplayable(): ?string
{
$parent = $this->node->getParent();
- if (!($parent instanceof Node)) {
+ if (!$parent instanceof Node) {
return null;
}
diff --git a/lib/Rozier/src/Explorer/NodeSourceExplorerItem.php b/lib/Rozier/src/Explorer/NodeSourceExplorerItem.php
index 55b7a3b67..bb11b0fc4 100644
--- a/lib/Rozier/src/Explorer/NodeSourceExplorerItem.php
+++ b/lib/Rozier/src/Explorer/NodeSourceExplorerItem.php
@@ -31,7 +31,7 @@ public function getAlternativeDisplayable(): ?string
{
$parent = $this->nodeSource->getParent();
- if (!($parent instanceof NodesSources)) {
+ if (!$parent instanceof NodesSources) {
return null;
}
diff --git a/lib/Rozier/src/Forms/NodeTypeDecoratorType.php b/lib/Rozier/src/Forms/NodeTypeDecoratorType.php
index d69951849..7ca498040 100644
--- a/lib/Rozier/src/Forms/NodeTypeDecoratorType.php
+++ b/lib/Rozier/src/Forms/NodeTypeDecoratorType.php
@@ -77,9 +77,9 @@ private function getValueType(NodeTypeDecorator $nodeTypeDecorator): string
return CheckboxType::class;
} elseif (NodeTypeDecoratorProperty::NODE_TYPE_COLOR === $property) {
return ColorType::class;
- } else {
- return TextType::class;
}
+
+ return TextType::class;
}
private function getExplodedPath(string $path): array
diff --git a/src/Entity/PositionedPageUser.php b/src/Entity/PositionedPageUser.php
index 069f390fb..f58d3b42b 100644
--- a/src/Entity/PositionedPageUser.php
+++ b/src/Entity/PositionedPageUser.php
@@ -9,12 +9,10 @@
use RZ\Roadiz\Core\AbstractEntities\AbstractPositioned;
use RZ\Roadiz\CoreBundle\Entity\User;
-#[
- ORM\Entity(),
+#[ORM\Entity(),
ORM\Table(name: 'positioned_page_user'),
ORM\Index(columns: ['position'], name: 'ppu_position'),
- ORM\Index(columns: ['node_source_id', 'position'], name: 'ppu_node_source_id_position'),
-]
+ ORM\Index(columns: ['node_source_id', 'position'], name: 'ppu_node_source_id_position'),]
class PositionedPageUser extends AbstractPositioned
{
#[ORM\ManyToOne(targetEntity: '\App\GeneratedEntity\NSPage', inversedBy: 'usersProxy')]
diff --git a/src/EventSubscriber/CustomFormAnswerSubmittedSubscriber.php b/src/EventSubscriber/CustomFormAnswerSubmittedSubscriber.php
deleted file mode 100644
index 81b1d9844..000000000
--- a/src/EventSubscriber/CustomFormAnswerSubmittedSubscriber.php
+++ /dev/null
@@ -1,54 +0,0 @@
-getCustomFormAnswer();
- if (null === $email = $customFormAnswer->getEmail()) {
- return;
- }
-
- $to = Address::create($email);
- $title = $customFormAnswer->getCustomForm()->getName();
-
- $this->notifier->send(
- new BaseEmailNotification(
- [
- 'title' => '(TEST) Thanks for your submission: '.$customFormAnswer->getCustomForm()->getName(),
- 'content' => <<getAddress()}* after you submitted "{$title}" custom-form.
-MD,
- ],
- '(TEST) Thanks for your submission: '.$customFormAnswer->getCustomForm()->getName(),
- ['email']
- ),
- new Recipient($to->getAddress())
- );
- }
-
- #[\Override]
- public static function getSubscribedEvents(): array
- {
- return [
- CustomFormAnswerSubmittedEvent::class => 'onCustomFormAnswerSubmittedEvent',
- ];
- }
-}
diff --git a/src/TreeWalker/Definition/ArticleFeedBlockDefinition.php b/src/TreeWalker/Definition/ArticleFeedBlockDefinition.php
index 52efdbfe4..cc255a37c 100644
--- a/src/TreeWalker/Definition/ArticleFeedBlockDefinition.php
+++ b/src/TreeWalker/Definition/ArticleFeedBlockDefinition.php
@@ -26,7 +26,7 @@ public function isStoppingCollectionOnceInvoked(): bool
*/
public function __invoke(NodesSources $source, WalkerInterface $walker): array
{
- if (!($this->context instanceof NodeSourceWalkerContext)) {
+ if (!$this->context instanceof NodeSourceWalkerContext) {
throw new \InvalidArgumentException('Context should be instance of '.NodeSourceWalkerContext::class);
}