mirror of
https://github.com/doctrine/orm.git
synced 2026-03-23 22:42:18 +01:00
Metadata field type validation against Entity property type #7141
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @DavideBicego on GitHub (Apr 27, 2023).
Feature Request
Summary
We found out that if the metadata field type differs from the entity property type Doctrine marks it as "to be updated" right after it being loaded from the database and hydrated, even if no real change happened to the entity. If there's a flush an update is performed for every entity marked as "to be updated", as it should happen.
For example if this is the metadata (Xml in this case)
MyEntity.xml:
MyEntity.php:
This code updates to the database
Please note that $a is
intin MyEntity.php andbooleanin MyEntity.xmlIt would be great to have some strictness when setting the Entity value during Hydration or some field type validation in
Doctrine\ORM\Tools\SchemaValidator.