Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update events.rst to reflect behaviour of preUpdate #1429

Merged
merged 1 commit into from Jun 17, 2015
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions docs/en/reference/events.rst
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,8 @@ the life-time of their registered entities.
database insert operations. Generated primary key values are
available in the postPersist event.
- preUpdate - The preUpdate event occurs before the database
update operations to entity data. It is not called for a DQL UPDATE statement.
update operations to entity data. It is not called for a DQL UPDATE statement
nor when the computed changeset is empty.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

empty changeset === no update

Maybe some other precondition was unclear to you?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

empty changeset === no update

Maybe I misunderstand you but that is what I mean. This behaviour is not documented as far as I can tell.

This is the only precondition I can think of right now that seem to be undocumented but maybe there are others.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Agree. I'll merge anyway, but consider hunting these down if you can :-)

I think we're missing a chapter on "ORM assuptions" or such...

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

To clarify: when reading the documentation as it is now it is not obvious that one of the preconditions is that one more or fields need to be modified in order for this to trigger.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I agree. I will open up new pull requests if I find more of these. Thanks for the feedback.

- postUpdate - The postUpdate event occurs after the database
update operations to entity data. It is not called for a DQL UPDATE statement.
- postLoad - The postLoad event occurs for an entity after the
Expand Down Expand Up @@ -652,7 +653,8 @@ preUpdate

PreUpdate is the most restrictive to use event, since it is called
right before an update statement is called for an entity inside the
``EntityManager#flush()`` method.
``EntityManager#flush()`` method. Note that this event is not
triggered when the computed changeset is empty.

Changes to associations of the updated entity are never allowed in
this event, since Doctrine cannot guarantee to correctly handle
Expand Down