Skip to content

Commit 55bd084

Browse files
author
roadiz-ci
committed
chore: Bumped
1 parent 748324c commit 55bd084

20 files changed

Lines changed: 145 additions & 253 deletions

.github/workflows/run-test.yml

Lines changed: 1 addition & 1 deletion
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.3', '8.4']
22+
php-version: ['8.2', '8.3']
2323
steps:
2424
- uses: shivammathur/setup-php@v2
2525
with:

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 © 2025 Ambroise Maupate
3+
Copyright © 2024 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: 10 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -18,24 +18,22 @@
1818
}
1919
],
2020
"require": {
21-
"php": ">=8.3",
21+
"php": ">=8.2",
2222
"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.*",
23+
"jms/serializer": "^3.32.3",
24+
"roadiz/nodetype-contracts": "^2.0.0",
25+
"symfony/string": "6.4.*",
2726
"symfony/translation-contracts": "^3.0",
28-
"symfony/http-foundation": "7.3.*",
29-
"symfony/serializer": "7.3.*",
30-
"symfony/uid": "7.3.*",
31-
"symfony/validator": "7.3.*"
27+
"symfony/http-foundation": "6.4.*",
28+
"symfony/serializer": "6.4.*",
29+
"symfony/validator": "6.4.*"
3230
},
3331
"require-dev": {
3432
"doctrine/doctrine-bundle": "^2.8.1",
3533
"php-coveralls/php-coveralls": "^2.4",
3634
"phpstan/phpstan": "^1.5.3",
3735
"phpstan/phpdoc-parser": "<2",
38-
"phpunit/phpunit": "^9.6"
36+
"phpunit/phpunit": "^9.5"
3937
},
4038
"autoload": {
4139
"psr-4": {
@@ -55,8 +53,8 @@
5553
},
5654
"extra": {
5755
"branch-alias": {
58-
"dev-master": "2.6.x-dev",
59-
"dev-develop": "2.7.x-dev"
56+
"dev-master": "2.5.x-dev",
57+
"dev-develop": "2.6.x-dev"
6058
}
6159
}
6260
}

src/Bag/LazyParameterBag.php

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@ public function __construct()
2323
*
2424
* @return mixed|null
2525
*/
26-
#[\Override]
2726
public function get(string $key, $default = null): mixed
2827
{
2928
if (!$this->ready) {
@@ -33,7 +32,6 @@ public function get(string $key, $default = null): mixed
3332
return parent::get($key, $default);
3433
}
3534

36-
#[\Override]
3735
public function all(?string $key = null): array
3836
{
3937
if (!$this->ready) {
@@ -43,7 +41,6 @@ public function all(?string $key = null): array
4341
return parent::all();
4442
}
4543

46-
#[\Override]
4744
public function has(string $key): bool
4845
{
4946
if (!$this->ready) {
@@ -53,7 +50,6 @@ public function has(string $key): bool
5350
return parent::has($key);
5451
}
5552

56-
#[\Override]
5753
public function keys(): array
5854
{
5955
if (!$this->ready) {
@@ -64,7 +60,6 @@ public function keys(): array
6460
}
6561

6662
#[\ReturnTypeWillChange]
67-
#[\Override]
6863
public function getIterator(): \ArrayIterator
6964
{
7065
if (!$this->ready) {
@@ -75,7 +70,6 @@ public function getIterator(): \ArrayIterator
7570
}
7671

7772
#[\ReturnTypeWillChange]
78-
#[\Override]
7973
public function count(): int
8074
{
8175
if (!$this->ready) {
@@ -89,7 +83,6 @@ public function count(): int
8983
* @param null $default
9084
* @param array $options
9185
*/
92-
#[\Override]
9386
public function filter(string $key, $default = null, int $filter = \FILTER_DEFAULT, $options = []): mixed
9487
{
9588
if (!$this->ready) {

src/Core/AbstractEntities/AbstractDateTimed.php

Lines changed: 78 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,11 @@
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;
810

911
/**
1012
* An AbstractEntity with datetime fields to keep track of time with your items.
11-
*
12-
* @deprecated since 2.6, use composition with DateTimedTrait instead.
1313
*/
1414
#[
1515
ORM\MappedSuperclass,
@@ -18,7 +18,81 @@
1818
ORM\Index(columns: ['created_at']),
1919
ORM\Index(columns: ['updated_at']),
2020
]
21-
abstract class AbstractDateTimed extends AbstractEntity implements DateTimedInterface
21+
abstract class AbstractDateTimed extends AbstractEntity
2222
{
23-
use DateTimedTrait;
23+
#[
24+
ORM\Column(name: 'created_at', type: 'datetime', nullable: true),
25+
Serializer\Groups(['timestamps']),
26+
SymfonySerializer\Groups(['timestamps']),
27+
]
28+
protected ?\DateTime $createdAt = null;
29+
30+
#[
31+
ORM\Column(name: 'updated_at', type: 'datetime', nullable: true),
32+
Serializer\Groups(['timestamps']),
33+
SymfonySerializer\Groups(['timestamps']),
34+
]
35+
protected ?\DateTime $updatedAt = null;
36+
37+
public function getCreatedAt(): ?\DateTime
38+
{
39+
return $this->createdAt;
40+
}
41+
42+
/**
43+
* @return $this
44+
*/
45+
public function setCreatedAt(?\DateTime $createdAt): self
46+
{
47+
$this->createdAt = $createdAt;
48+
49+
return $this;
50+
}
51+
52+
public function getUpdatedAt(): ?\DateTime
53+
{
54+
return $this->updatedAt;
55+
}
56+
57+
/**
58+
* @return $this
59+
*/
60+
public function setUpdatedAt(?\DateTime $updatedAt): self
61+
{
62+
$this->updatedAt = $updatedAt;
63+
64+
return $this;
65+
}
66+
67+
protected function initAbstractDateTimed(): void
68+
{
69+
$this->setUpdatedAt(new \DateTime('now'));
70+
$this->setCreatedAt(new \DateTime('now'));
71+
}
72+
73+
#[ORM\PreUpdate]
74+
public function preUpdate(): void
75+
{
76+
$this->setUpdatedAt(new \DateTime('now'));
77+
}
78+
79+
#[ORM\PrePersist]
80+
public function prePersist(): void
81+
{
82+
$this->setUpdatedAt(new \DateTime('now'));
83+
$this->setCreatedAt(new \DateTime('now'));
84+
}
85+
86+
/**
87+
* Set creation and update date to *now*.
88+
*
89+
* @return $this
90+
*/
91+
public function resetDates(): self
92+
{
93+
$this->setCreatedAt(new \DateTime('now'));
94+
$this->setUpdatedAt(new \DateTime('now'));
95+
96+
return $this;
97+
}
2498
}

src/Core/AbstractEntities/AbstractEntity.php

Lines changed: 23 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,17 +5,37 @@
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;
810

911
/**
1012
* 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-
use SequentialIdTrait;
20+
#[
21+
ORM\Id,
22+
ORM\Column(type: 'integer'),
23+
ORM\GeneratedValue,
24+
Serializer\Groups(['id']),
25+
Serializer\Type('integer'),
26+
SymfonySerializer\Groups(['id'])
27+
]
28+
protected int|string|null $id = null;
29+
30+
public function getId(): int|string|null
31+
{
32+
return $this->id;
33+
}
34+
35+
public function setId(int|string|null $id): self
36+
{
37+
$this->id = $id;
38+
39+
return $this;
40+
}
2141
}

src/Core/AbstractEntities/AbstractHuman.php

Lines changed: 16 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,9 @@
44

55
namespace RZ\Roadiz\Core\AbstractEntities;
66

7-
use ApiPlatform\Doctrine\Orm\Filter\OrderFilter;
8-
use ApiPlatform\Doctrine\Orm\Filter\SearchFilter;
9-
use ApiPlatform\Metadata\ApiFilter;
107
use Doctrine\ORM\Mapping as ORM;
11-
use Symfony\Component\Serializer\Attribute as Serializer;
8+
use JMS\Serializer\Annotation as Serializer;
9+
use Symfony\Component\Serializer\Annotation as SymfonySerializer;
1210
use Symfony\Component\Validator\Constraints as Assert;
1311

1412
/**
@@ -21,20 +19,17 @@
2119
ORM\Table,
2220
ORM\HasLifecycleCallbacks
2321
]
24-
abstract class AbstractHuman implements DateTimedInterface, PersistableInterface
22+
abstract class AbstractHuman extends AbstractDateTimed
2523
{
26-
use SequentialIdTrait;
27-
use DateTimedTrait;
28-
29-
#[ORM\Column(type: 'string', length: 200, unique: true, nullable: false)]
30-
#[Serializer\Groups(['user_personal', 'human'])]
31-
#[Assert\NotNull]
32-
#[Assert\NotBlank]
33-
#[Assert\Length(max: 200)]
34-
#[Assert\Email]
35-
#[ApiFilter(OrderFilter::class)]
36-
#[ApiFilter(SearchFilter::class)]
37-
// @phpstan-ignore-next-line
24+
#[
25+
ORM\Column(type: 'string', length: 200, unique: true),
26+
Serializer\Groups(['user_personal', 'human']),
27+
SymfonySerializer\Groups(['user_personal', 'human']),
28+
Assert\NotNull(),
29+
Assert\NotBlank(),
30+
Assert\Length(max: 200),
31+
Assert\Email()
32+
]
3833
protected ?string $email = null;
3934

4035
/**
@@ -43,27 +38,31 @@ abstract class AbstractHuman implements DateTimedInterface, PersistableInterface
4338
#[
4439
ORM\Column(name: 'publicName', type: 'string', length: 250, nullable: true),
4540
Serializer\Groups(['user_public', 'human']),
41+
SymfonySerializer\Groups(['user_public', 'human']),
4642
Assert\Length(max: 250)
4743
]
4844
protected ?string $publicName = null;
4945

5046
#[
5147
ORM\Column(name: 'firstName', type: 'string', length: 250, nullable: true),
5248
Serializer\Groups(['user_personal', 'human']),
49+
SymfonySerializer\Groups(['user_personal', 'human']),
5350
Assert\Length(max: 250)
5451
]
5552
protected ?string $firstName = null;
5653

5754
#[
5855
ORM\Column(name: 'lastName', type: 'string', length: 250, nullable: true),
5956
Serializer\Groups(['user_personal', 'human']),
57+
SymfonySerializer\Groups(['user_personal', 'human']),
6058
Assert\Length(max: 250)
6159
]
6260
protected ?string $lastName = null;
6361

6462
#[
6563
ORM\Column(type: 'string', length: 250, nullable: true),
6664
Serializer\Groups(['user_personal', 'human']),
65+
SymfonySerializer\Groups(['user_personal', 'human']),
6766
Assert\Length(max: 250)
6867
]
6968
protected ?string $company = null;

src/Core/AbstractEntities/AbstractPositioned.php

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,27 +4,29 @@
44

55
namespace RZ\Roadiz\Core\AbstractEntities;
66

7+
use Doctrine\Common\Comparable;
78
use Doctrine\ORM\Mapping as ORM;
8-
use Symfony\Component\Serializer\Attribute as Serializer;
9+
use JMS\Serializer\Annotation as Serializer;
10+
use Symfony\Component\Serializer\Annotation as SymfonySerializer;
911

1012
/**
1113
* Combined AbstractEntity and PositionedTrait.
12-
*
13-
* @deprecated since 2.6, use composition with PositionedTrait and PositionedInterface instead.
1414
*/
1515
#[
1616
ORM\MappedSuperclass,
1717
ORM\HasLifecycleCallbacks,
1818
ORM\Table,
1919
ORM\Index(columns: ['position'])
2020
]
21-
abstract class AbstractPositioned extends AbstractEntity implements PositionedInterface
21+
abstract class AbstractPositioned extends AbstractEntity implements PositionedInterface, Comparable
2222
{
2323
use PositionedTrait;
2424

2525
#[
2626
ORM\Column(type: 'float'),
2727
Serializer\Groups(['position']),
28+
SymfonySerializer\Groups(['position']),
29+
Serializer\Type('float')
2830
]
2931
protected float $position = 0.0;
3032
}

src/Core/AbstractEntities/DateTimedInterface.php

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

0 commit comments

Comments
 (0)