From 906d39793f5d2d73500264a37338378d1f477762 Mon Sep 17 00:00:00 2001 From: Matthieu Date: Wed, 11 Feb 2026 15:33:20 +0100 Subject: [PATCH 1/2] fix(filters) : repair broken filters on catalog and document pages Co-Authored-By: Claude Opus 4.6 --- Inventory_frontend | 2 +- src/Entity/Document.php | 30 +++++++++++++++++------------- src/Entity/ModelType.php | 2 ++ 3 files changed, 20 insertions(+), 14 deletions(-) diff --git a/Inventory_frontend b/Inventory_frontend index 8fecf67..185af65 160000 --- a/Inventory_frontend +++ b/Inventory_frontend @@ -1 +1 @@ -Subproject commit 8fecf67a7fcbd5087d30943ce1d22099256875c1 +Subproject commit 185af655191ed04362b5ab4341da1e5a3a61f151 diff --git a/src/Entity/Document.php b/src/Entity/Document.php index 8773fa5..fb0ad3a 100644 --- a/src/Entity/Document.php +++ b/src/Entity/Document.php @@ -6,6 +6,7 @@ namespace App\Entity; use ApiPlatform\Metadata\ApiResource; use App\Repository\DocumentRepository; +use DateTimeImmutable; use Doctrine\DBAL\Types\Types; use Doctrine\ORM\Mapping as ORM; use Symfony\Component\Serializer\Attribute\Groups; @@ -13,7 +14,10 @@ use Symfony\Component\Serializer\Attribute\Groups; #[ORM\Entity(repositoryClass: DocumentRepository::class)] #[ORM\Table(name: 'documents')] #[ORM\HasLifecycleCallbacks] -#[ApiResource] +#[ApiResource( + paginationClientItemsPerPage: true, + paginationMaximumItemsPerPage: 200 +)] class Document { #[ORM\Id] @@ -62,19 +66,19 @@ class Document private ?Site $site = null; #[ORM\Column(type: Types::DATETIME_IMMUTABLE, name: 'createdAt')] - private \DateTimeImmutable $createdAt; + private DateTimeImmutable $createdAt; #[ORM\Column(type: Types::DATETIME_IMMUTABLE, name: 'updatedAt')] - private \DateTimeImmutable $updatedAt; + private DateTimeImmutable $updatedAt; #[ORM\PrePersist] public function setCreatedAtValue(): void { - $now = new \DateTimeImmutable(); + $now = new DateTimeImmutable(); $this->createdAt = $now; $this->updatedAt = $now; - if ($this->id === null) { + if (null === $this->id) { $this->id = $this->generateCuid(); } } @@ -82,12 +86,7 @@ class Document #[ORM\PreUpdate] public function setUpdatedAtValue(): void { - $this->updatedAt = new \DateTimeImmutable(); - } - - private function generateCuid(): string - { - return 'cl' . bin2hex(random_bytes(12)); + $this->updatedAt = new DateTimeImmutable(); } public function getId(): ?string @@ -222,13 +221,18 @@ class Document return $this; } - public function getCreatedAt(): \DateTimeImmutable + public function getCreatedAt(): DateTimeImmutable { return $this->createdAt; } - public function getUpdatedAt(): \DateTimeImmutable + public function getUpdatedAt(): DateTimeImmutable { return $this->updatedAt; } + + private function generateCuid(): string + { + return 'cl'.bin2hex(random_bytes(12)); + } } diff --git a/src/Entity/ModelType.php b/src/Entity/ModelType.php index b84b4c7..c0d8f6e 100644 --- a/src/Entity/ModelType.php +++ b/src/Entity/ModelType.php @@ -4,6 +4,7 @@ declare(strict_types=1); namespace App\Entity; +use ApiPlatform\Doctrine\Orm\Filter\OrderFilter; use ApiPlatform\Doctrine\Orm\Filter\SearchFilter; use ApiPlatform\Metadata\ApiFilter; use ApiPlatform\Metadata\ApiResource; @@ -21,6 +22,7 @@ use Symfony\Component\Serializer\Annotation\Groups; #[ORM\UniqueConstraint(name: 'unique_category_name', columns: ['category', 'name'])] #[ORM\HasLifecycleCallbacks] #[ApiFilter(SearchFilter::class, properties: ['category' => 'exact', 'name' => 'ipartial'])] +#[ApiFilter(OrderFilter::class, properties: ['name', 'createdAt'])] #[ApiResource( paginationClientItemsPerPage: true, paginationMaximumItemsPerPage: 200 From ba98ae37f42ae60045e336b60ca90456b466853e Mon Sep 17 00:00:00 2001 From: Matthieu Date: Wed, 11 Feb 2026 16:48:46 +0100 Subject: [PATCH 2/2] feat(entity) : auto-capitalize first letter of names on Composant and ModelType Update setName() to use mb_strtoupper on the first character so that category and component names always start with an uppercase letter. Also update frontend submodule with URL state preservation and back button improvements. Co-Authored-By: Claude Opus 4.6 --- Inventory_frontend | 2 +- src/Entity/Composant.php | 2 +- src/Entity/ModelType.php | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/Inventory_frontend b/Inventory_frontend index 185af65..480aaa2 160000 --- a/Inventory_frontend +++ b/Inventory_frontend @@ -1 +1 @@ -Subproject commit 185af655191ed04362b5ab4341da1e5a3a61f151 +Subproject commit 480aaa24b26ea5ba2ca8db5741ff478c6884fcb9 diff --git a/src/Entity/Composant.php b/src/Entity/Composant.php index a069255..2573e15 100644 --- a/src/Entity/Composant.php +++ b/src/Entity/Composant.php @@ -144,7 +144,7 @@ class Composant public function setName(string $name): static { - $this->name = $name; + $this->name = mb_strtoupper(mb_substr($name, 0, 1)).mb_substr($name, 1); return $this; } diff --git a/src/Entity/ModelType.php b/src/Entity/ModelType.php index c0d8f6e..adce939 100644 --- a/src/Entity/ModelType.php +++ b/src/Entity/ModelType.php @@ -180,7 +180,7 @@ class ModelType public function setName(string $name): static { - $this->name = $name; + $this->name = mb_strtoupper(mb_substr($name, 0, 1)).mb_substr($name, 1); return $this; }