Skip to content

Commit baa4b92

Browse files
author
roadiz-ci
committed
chore: bumped
1 parent dc2f238 commit baa4b92

23 files changed

Lines changed: 147 additions & 319 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: 11 additions & 13 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.1.1",
26-
"symfony/string": "7.4.*",
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.4.*",
29-
"symfony/serializer": "7.4.*",
30-
"symfony/uid": "7.4.*",
31-
"symfony/validator": "7.4.*"
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",
36-
"phpstan/phpstan": "^2.1.36",
34+
"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.7.x-dev",
59-
"dev-develop": "2.8.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: 74 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,18 +5,88 @@
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
#[ORM\MappedSuperclass,
1515
ORM\HasLifecycleCallbacks,
1616
ORM\Table,
1717
ORM\Index(columns: ['created_at']),
1818
ORM\Index(columns: ['updated_at']),]
19-
abstract class AbstractDateTimed extends AbstractEntity implements DateTimedInterface
19+
abstract class AbstractDateTimed extends AbstractEntity
2020
{
21-
use DateTimedTrait;
21+
#[ORM\Column(name: 'created_at', type: 'datetime', nullable: true),
22+
Serializer\Groups(['timestamps']),
23+
SymfonySerializer\Groups(['timestamps']),]
24+
protected ?\DateTime $createdAt = null;
25+
26+
#[ORM\Column(name: 'updated_at', type: 'datetime', nullable: true),
27+
Serializer\Groups(['timestamps']),
28+
SymfonySerializer\Groups(['timestamps']),]
29+
protected ?\DateTime $updatedAt = null;
30+
31+
public function getCreatedAt(): ?\DateTime
32+
{
33+
return $this->createdAt;
34+
}
35+
36+
/**
37+
* @return $this
38+
*/
39+
public function setCreatedAt(?\DateTime $createdAt): self
40+
{
41+
$this->createdAt = $createdAt;
42+
43+
return $this;
44+
}
45+
46+
public function getUpdatedAt(): ?\DateTime
47+
{
48+
return $this->updatedAt;
49+
}
50+
51+
/**
52+
* @return $this
53+
*/
54+
public function setUpdatedAt(?\DateTime $updatedAt): self
55+
{
56+
$this->updatedAt = $updatedAt;
57+
58+
return $this;
59+
}
60+
61+
protected function initAbstractDateTimed(): void
62+
{
63+
$this->setUpdatedAt(new \DateTime('now'));
64+
$this->setCreatedAt(new \DateTime('now'));
65+
}
66+
67+
#[ORM\PreUpdate]
68+
public function preUpdate(): void
69+
{
70+
$this->setUpdatedAt(new \DateTime('now'));
71+
}
72+
73+
#[ORM\PrePersist]
74+
public function prePersist(): void
75+
{
76+
$this->setUpdatedAt(new \DateTime('now'));
77+
$this->setCreatedAt(new \DateTime('now'));
78+
}
79+
80+
/**
81+
* Set creation and update date to *now*.
82+
*
83+
* @return $this
84+
*/
85+
public function resetDates(): self
86+
{
87+
$this->setCreatedAt(new \DateTime('now'));
88+
$this->setUpdatedAt(new \DateTime('now'));
89+
90+
return $this;
91+
}
2292
}

src/Core/AbstractEntities/AbstractEntity.php

Lines changed: 21 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,15 +5,33 @@
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
#[ORM\MappedSuperclass,
1515
ORM\Table]
1616
abstract class AbstractEntity implements PersistableInterface
1717
{
18-
use SequentialIdTrait;
18+
#[ORM\Id,
19+
ORM\Column(type: 'integer'),
20+
ORM\GeneratedValue,
21+
Serializer\Groups(['id']),
22+
Serializer\Type('integer'),
23+
SymfonySerializer\Groups(['id'])]
24+
protected int|string|null $id = null;
25+
26+
public function getId(): int|string|null
27+
{
28+
return $this->id;
29+
}
30+
31+
public function setId(int|string|null $id): self
32+
{
33+
$this->id = $id;
34+
35+
return $this;
36+
}
1937
}

src/Core/AbstractEntities/AbstractHuman.php

Lines changed: 14 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
/**
@@ -19,42 +17,41 @@
1917
#[ORM\MappedSuperclass,
2018
ORM\Table,
2119
ORM\HasLifecycleCallbacks]
22-
abstract class AbstractHuman implements DateTimedInterface, PersistableInterface
20+
abstract class AbstractHuman extends AbstractDateTimed
2321
{
24-
use SequentialIdTrait;
25-
use DateTimedTrait;
26-
27-
#[ORM\Column(type: 'string', length: 200, unique: true, nullable: false)]
28-
#[Serializer\Groups(['user_personal', 'human'])]
29-
#[Assert\NotNull]
30-
#[Assert\NotBlank]
31-
#[Assert\Length(max: 200)]
32-
#[Assert\Email]
33-
#[ApiFilter(OrderFilter::class)]
34-
#[ApiFilter(SearchFilter::class)]
35-
// @phpstan-ignore-next-line
22+
#[ORM\Column(type: 'string', length: 200, unique: true),
23+
Serializer\Groups(['user_personal', 'human']),
24+
SymfonySerializer\Groups(['user_personal', 'human']),
25+
Assert\NotNull(),
26+
Assert\NotBlank(),
27+
Assert\Length(max: 200),
28+
Assert\Email()]
3629
protected ?string $email = null;
3730

3831
/**
3932
* Public name (pseudonyme) that can be displayed to a public audience.
4033
*/
4134
#[ORM\Column(name: 'publicName', type: 'string', length: 250, nullable: true),
4235
Serializer\Groups(['user_public', 'human']),
36+
SymfonySerializer\Groups(['user_public', 'human']),
4337
Assert\Length(max: 250)]
4438
protected ?string $publicName = null;
4539

4640
#[ORM\Column(name: 'firstName', type: 'string', length: 250, nullable: true),
4741
Serializer\Groups(['user_personal', 'human']),
42+
SymfonySerializer\Groups(['user_personal', 'human']),
4843
Assert\Length(max: 250)]
4944
protected ?string $firstName = null;
5045

5146
#[ORM\Column(name: 'lastName', type: 'string', length: 250, nullable: true),
5247
Serializer\Groups(['user_personal', 'human']),
48+
SymfonySerializer\Groups(['user_personal', 'human']),
5349
Assert\Length(max: 250)]
5450
protected ?string $lastName = null;
5551

5652
#[ORM\Column(type: 'string', length: 250, nullable: true),
5753
Serializer\Groups(['user_personal', 'human']),
54+
SymfonySerializer\Groups(['user_personal', 'human']),
5855
Assert\Length(max: 250)]
5956
protected ?string $company = null;
6057

src/Core/AbstractEntities/AbstractPositioned.php

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,23 +4,25 @@
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
#[ORM\MappedSuperclass,
1616
ORM\HasLifecycleCallbacks,
1717
ORM\Table,
1818
ORM\Index(columns: ['position'])]
19-
abstract class AbstractPositioned extends AbstractEntity implements PositionedInterface
19+
abstract class AbstractPositioned extends AbstractEntity implements PositionedInterface, Comparable
2020
{
2121
use PositionedTrait;
2222

2323
#[ORM\Column(type: 'float'),
24-
Serializer\Groups(['position']),]
24+
Serializer\Groups(['position']),
25+
SymfonySerializer\Groups(['position']),
26+
Serializer\Type('float')]
2527
protected float $position = 0.0;
2628
}

src/Core/AbstractEntities/DateTimedInterface.php

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

0 commit comments

Comments
 (0)