fix : case-insensitive search filters for all entities

This commit is contained in:
Matthieu
2026-01-25 15:54:07 +01:00
parent 17ab4cdd16
commit 1643dcf8c2
5 changed files with 9 additions and 9 deletions

View File

@@ -19,7 +19,7 @@ use Symfony\Component\Serializer\Attribute\Groups;
#[ORM\Entity(repositoryClass: PieceRepository::class)]
#[ORM\Table(name: 'pieces')]
#[ORM\HasLifecycleCallbacks]
#[ApiFilter(SearchFilter::class, properties: ['name' => 'partial', 'reference' => 'partial', 'typePiece' => 'exact'])]
#[ApiFilter(SearchFilter::class, properties: ['name' => 'ipartial', 'reference' => 'ipartial', 'typePiece' => 'exact'])]
#[ApiFilter(OrderFilter::class, properties: ['name', 'createdAt'])]
#[ApiResource(
normalizationContext: ['groups' => ['piece:read']],
@@ -195,7 +195,7 @@ class Piece
$this->product = $product;
if ($product && empty($this->productIds)) {
$productId = $product->getId();
$productId = $product->getId();
$this->productIds = $productId ? [$productId] : null;
}
@@ -221,7 +221,7 @@ class Piece
static fn ($value) => is_string($value) ? trim($value) : '',
$this->productIds,
),
static fn (string $value) => $value !== '',
static fn (string $value) => '' !== $value,
),
);
}
@@ -241,12 +241,12 @@ class Piece
static fn ($value) => is_string($value) ? trim($value) : '',
$productIds,
),
static fn (string $value) => $value !== '',
static fn (string $value) => '' !== $value,
),
),
);
$this->productIds = $normalized === [] ? null : $normalized;
$this->productIds = [] === $normalized ? null : $normalized;
return $this;
}