Skip to content

Commit f51a74d

Browse files
author
roadiz-ci
committed
Merge branch hotfix/v2.6.22
1 parent 0712373 commit f51a74d

26 files changed

Lines changed: 522 additions & 1468 deletions

.github/workflows/run-test.yml

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ jobs:
1919
runs-on: ubuntu-latest
2020
strategy:
2121
matrix:
22-
php-version: ['8.1', '8.2', '8.3']
22+
php-version: ['8.3', '8.4']
2323
steps:
2424
- uses: shivammathur/setup-php@v2
2525
with:
@@ -37,7 +37,5 @@ jobs:
3737
run: composer install --no-scripts --no-ansi --no-interaction --no-progress
3838
- name: Run PHPUnit tests
3939
run: vendor/bin/phpunit -v --whitelist ./src tests
40-
- name: Run PHP Code Sniffer
41-
run: vendor/bin/phpcs -p ./src
4240
- name: Run PHPStan
4341
run: vendor/bin/phpstan analyse --no-progress -c phpstan.neon

LICENSE.md

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

3-
Copyright © 2024 Ambroise Maupate
3+
Copyright © 2025 Ambroise Maupate
44

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

composer.json

Lines changed: 16 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -18,20 +18,24 @@
1818
}
1919
],
2020
"require": {
21-
"php": ">=8.1",
22-
"doctrine/orm": "~2.19.0",
23-
"jms/serializer": "^3.9.0",
24-
"symfony/string": "6.4.*",
21+
"php": ">=8.3",
22+
"doctrine/orm": "~2.20.0",
23+
"api-platform/doctrine-orm": "^4.1.18",
24+
"api-platform/metadata": "^4.1.18",
25+
"roadiz/nodetype-contracts": "^3.0.0",
26+
"symfony/string": "7.3.*",
2527
"symfony/translation-contracts": "^3.0",
26-
"symfony/http-foundation": "6.4.*",
27-
"symfony/serializer": "6.4.*",
28-
"symfony/validator": "6.4.*"
28+
"symfony/http-foundation": "7.3.*",
29+
"symfony/serializer": "7.3.*",
30+
"symfony/uid": "7.3.*",
31+
"symfony/validator": "7.3.*"
2932
},
3033
"require-dev": {
31-
"phpunit/phpunit": "^9.5",
34+
"doctrine/doctrine-bundle": "^2.8.1",
3235
"php-coveralls/php-coveralls": "^2.4",
33-
"squizlabs/php_codesniffer": "^3.5",
34-
"phpstan/phpstan": "^1.5.3"
36+
"phpstan/phpstan": "^1.5.3",
37+
"phpstan/phpdoc-parser": "<2",
38+
"phpunit/phpunit": "^9.6"
3539
},
3640
"autoload": {
3741
"psr-4": {
@@ -51,8 +55,8 @@
5155
},
5256
"extra": {
5357
"branch-alias": {
54-
"dev-master": "2.3.x-dev",
55-
"dev-develop": "2.4.x-dev"
58+
"dev-master": "2.6.x-dev",
59+
"dev-develop": "2.7.x-dev"
5660
}
5761
}
5862
}

phpcs.xml.dist

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

src/Bag/LazyParameterBag.php

Lines changed: 11 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -19,10 +19,11 @@ public function __construct()
1919
}
2020

2121
/**
22-
* @param string $key
2322
* @param mixed|null $default
23+
*
2424
* @return mixed|null
2525
*/
26+
#[\Override]
2627
public function get(string $key, $default = null): mixed
2728
{
2829
if (!$this->ready) {
@@ -32,11 +33,8 @@ public function get(string $key, $default = null): mixed
3233
return parent::get($key, $default);
3334
}
3435

35-
/**
36-
* @param string|null $key
37-
* @return array
38-
*/
39-
public function all(string $key = null): array
36+
#[\Override]
37+
public function all(?string $key = null): array
4038
{
4139
if (!$this->ready) {
4240
$this->populateParameters();
@@ -45,11 +43,7 @@ public function all(string $key = null): array
4543
return parent::all();
4644
}
4745

48-
/**
49-
* @param string $key
50-
*
51-
* @return bool
52-
*/
46+
#[\Override]
5347
public function has(string $key): bool
5448
{
5549
if (!$this->ready) {
@@ -59,9 +53,7 @@ public function has(string $key): bool
5953
return parent::has($key);
6054
}
6155

62-
/**
63-
* @return array
64-
*/
56+
#[\Override]
6557
public function keys(): array
6658
{
6759
if (!$this->ready) {
@@ -71,10 +63,8 @@ public function keys(): array
7163
return parent::keys();
7264
}
7365

74-
/**
75-
* @return \ArrayIterator
76-
*/
7766
#[\ReturnTypeWillChange]
67+
#[\Override]
7868
public function getIterator(): \ArrayIterator
7969
{
8070
if (!$this->ready) {
@@ -84,10 +74,8 @@ public function getIterator(): \ArrayIterator
8474
return parent::getIterator();
8575
}
8676

87-
/**
88-
* @return int
89-
*/
9077
#[\ReturnTypeWillChange]
78+
#[\Override]
9179
public function count(): int
9280
{
9381
if (!$this->ready) {
@@ -98,13 +86,10 @@ public function count(): int
9886
}
9987

10088
/**
101-
* @param string $key
102-
* @param null $default
103-
* @param int $filter
104-
* @param array $options
105-
*
106-
* @return mixed
89+
* @param null $default
90+
* @param array $options
10791
*/
92+
#[\Override]
10893
public function filter(string $key, $default = null, int $filter = \FILTER_DEFAULT, $options = []): mixed
10994
{
11095
if (!$this->ready) {

src/Core/AbstractEntities/AbstractDateTimed.php

Lines changed: 6 additions & 98 deletions
Original file line numberDiff line numberDiff line change
@@ -4,113 +4,21 @@
44

55
namespace RZ\Roadiz\Core\AbstractEntities;
66

7-
use DateTime;
87
use Doctrine\ORM\Mapping as ORM;
9-
use JMS\Serializer\Annotation as Serializer;
10-
use Symfony\Component\Serializer\Annotation as SymfonySerializer;
118

129
/**
1310
* An AbstractEntity with datetime fields to keep track of time with your items.
11+
*
12+
* @deprecated since 2.6, use composition with DateTimedTrait instead.
1413
*/
15-
1614
#[
1715
ORM\MappedSuperclass,
1816
ORM\HasLifecycleCallbacks,
1917
ORM\Table,
20-
ORM\Index(columns: ["created_at"]),
21-
ORM\Index(columns: ["updated_at"]),
18+
ORM\Index(columns: ['created_at']),
19+
ORM\Index(columns: ['updated_at']),
2220
]
23-
abstract class AbstractDateTimed extends AbstractEntity
21+
abstract class AbstractDateTimed extends AbstractEntity implements DateTimedInterface
2422
{
25-
/**
26-
* @var DateTime|null
27-
*/
28-
#[
29-
ORM\Column(name: "created_at", type: "datetime", nullable: true),
30-
Serializer\Groups(["timestamps"]),
31-
SymfonySerializer\Groups(["timestamps"]),
32-
]
33-
protected ?DateTime $createdAt = null;
34-
35-
/**
36-
* @var DateTime|null
37-
*/
38-
#[
39-
ORM\Column(name: "updated_at", type: "datetime", nullable: true),
40-
Serializer\Groups(["timestamps"]),
41-
SymfonySerializer\Groups(["timestamps"]),
42-
]
43-
protected ?DateTime $updatedAt = null;
44-
45-
/**
46-
* @return DateTime|null
47-
*/
48-
public function getCreatedAt(): ?DateTime
49-
{
50-
return $this->createdAt;
51-
}
52-
53-
/**
54-
* @param DateTime|null $createdAt
55-
* @return AbstractDateTimed
56-
*/
57-
public function setCreatedAt(?DateTime $createdAt)
58-
{
59-
$this->createdAt = $createdAt;
60-
return $this;
61-
}
62-
63-
/**
64-
* @return DateTime|null
65-
*/
66-
public function getUpdatedAt(): ?DateTime
67-
{
68-
return $this->updatedAt;
69-
}
70-
71-
/**
72-
* @param DateTime|null $updatedAt
73-
* @return AbstractDateTimed
74-
*/
75-
public function setUpdatedAt(?DateTime $updatedAt)
76-
{
77-
$this->updatedAt = $updatedAt;
78-
return $this;
79-
}
80-
81-
protected function initAbstractDateTimed(): void
82-
{
83-
$this->setUpdatedAt(new DateTime("now"));
84-
$this->setCreatedAt(new DateTime("now"));
85-
}
86-
87-
/**
88-
* @return void
89-
*/
90-
#[ORM\PreUpdate]
91-
public function preUpdate()
92-
{
93-
$this->setUpdatedAt(new DateTime("now"));
94-
}
95-
/**
96-
* @return void
97-
*/
98-
#[ORM\PrePersist]
99-
public function prePersist()
100-
{
101-
$this->setUpdatedAt(new DateTime("now"));
102-
$this->setCreatedAt(new DateTime("now"));
103-
}
104-
/**
105-
* Set creation and update date to *now*.
106-
*
107-
* @return AbstractEntity
108-
*/
109-
public function resetDates()
110-
{
111-
$this->setCreatedAt(new DateTime("now"));
112-
$this->setUpdatedAt(new DateTime("now"));
113-
114-
return $this;
115-
}
23+
use DateTimedTrait;
11624
}

src/Core/AbstractEntities/AbstractEntity.php

Lines changed: 3 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -5,46 +5,17 @@
55
namespace RZ\Roadiz\Core\AbstractEntities;
66

77
use Doctrine\ORM\Mapping as ORM;
8-
use JMS\Serializer\Annotation as Serializer;
9-
use Symfony\Component\Serializer\Annotation as SymfonySerializer;
108

119
/**
1210
* Base entity implementing PersistableInterface to offer a unique ID.
11+
*
12+
* @deprecated since 2.6, use composition with PersistableInterface and SequentialIdTrait or UuidTrait instead.
1313
*/
1414
#[
1515
ORM\MappedSuperclass,
1616
ORM\Table
1717
]
1818
abstract class AbstractEntity implements PersistableInterface
1919
{
20-
/**
21-
* @var int|string|null
22-
*/
23-
#[
24-
ORM\Id,
25-
ORM\Column(type: "integer"),
26-
ORM\GeneratedValue,
27-
Serializer\Groups(["id"]),
28-
Serializer\Type("integer"),
29-
SymfonySerializer\Groups(["id"])
30-
]
31-
protected int|string|null $id = null;
32-
33-
/**
34-
* @return int|string|null
35-
*/
36-
public function getId(): int|string|null
37-
{
38-
return $this->id;
39-
}
40-
41-
/**
42-
* @param int|string|null $id
43-
* @return AbstractEntity
44-
*/
45-
public function setId(int|string|null $id): self
46-
{
47-
$this->id = $id;
48-
return $this;
49-
}
20+
use SequentialIdTrait;
5021
}

0 commit comments

Comments
 (0)