-
Notifications
You must be signed in to change notification settings - Fork 2.5k
Open
Description
Bug Report
| Q | A |
|---|---|
| Version | 2.20.7 (still happening in 2.20.9) |
| Previous Version if the bug is a regression | 2.20.6 |
Summary
Hello !
Since the 2.20.7 update, it looks like we cannot do a "findBy" on a Doctrine\DBAL\Types\Types\Types::TIME_IMMUTABLE (or DATE_MUTABLE) field with strings anymore
Replacing the strings with \DateTimeImmutable does the trick
Current behavior
Create an entity with
#[ORM\Column(type: Types::DATE_IMMUTABLE)]
private ?\DateTimeImmutable $date = null;
Use it like this
$this->em->getRepository(MyEntity::class)->findBy(['date' => '2025-02-04']);
Could not convert PHP value '2025-02-04' to type date_immutable. Expected one of the following types: null, DateTimeImmutable
trace: {
/vendor/doctrine/dbal/src/Types/ConversionException.php:78 { …}
/vendor/doctrine/dbal/src/Types/DateImmutableType.php:41 { …}
/vendor/doctrine/dbal/src/Connection.php:1887 { …}
/vendor/doctrine/dbal/src/Connection.php:1828 { …}
/vendor/doctrine/dbal/src/Connection.php:1102 { …}
/vendor/doctrine/orm/src/Persisters/Entity/BasicEntityPersister.php:995 { …}
/vendor/doctrine/orm/src/EntityRepository.php:224 { …}
Expected behavior
I should get an array with every MyEntity with the date of 2025-02-04
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels