mirror of
https://github.com/doctrine/orm.git
synced 2026-04-26 16:08:03 +02:00
DDC-534: UnitOfWork propertyChanged does nto check if the notified model property is one being persisted #663
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 @doctrinebot on GitHub (Apr 21, 2010).
Jira issue originally created by user disago:
When a Model implements NotifyPropertyChanged interface it may use the registered listeners for other purposes beyond the ORM and when the property being notified is not managed by Doctrine it will rise an undefined index propertyName PHP warning when trying to execute the updates.
Proposed solution:
Change UnitOfWork::propertyChanged to check whether the notified property is part of entitiy's metadata (right now it only checks if the property has association mappings and if not it just adds the entity to $this->_entityUpdates) :
to
NOTE: If the propertyChanged is modified this way the entity will not fire lifecycle events if only that property is modified. Maybe a better solution is to fire the lifecycle events (if any) but if the property is not being persisted then do not try to update it.
@doctrinebot commented on GitHub (May 1, 2010):
Comment created by romanb:
That lifecycle events would not fire would be correct. Doctrine should not care about non-persistent state. It does not do that with the other change-tracking policies, too.
Thanks for the report! I will fix that soon.
@doctrinebot commented on GitHub (May 1, 2010):
Issue was closed with resolution "Fixed"