Skip to content
This repository has been archived by the owner on Apr 7, 2018. It is now read-only.

Added documentation for preMove and postMove events #20

Merged
merged 3 commits into from Feb 23, 2013
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
18 changes: 18 additions & 0 deletions en/reference/events.rst
Expand Up @@ -29,6 +29,8 @@ the life-time of their registered documents.
- preFlush - occurs at the very beginning of a flush operation. This event is not a lifecycle callback.
- onFlush - occurs after the change-sets of all managed documents have been computed. This event is not a lifecycle
callback.
- preMove - occurs before a document is moved to the target path
Copy link
Member

Choose a reason for hiding this comment

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

please tell that this happens during persisting the move (it does, right? so when caling $dm->flush, not when calling $dm->move?) and please explain in which order the events occur (preFlush preMove postMove onFlush ? )

- postMove - occurs after a document has been moved to the target path

.. note::

Expand All @@ -37,6 +39,10 @@ the life-time of their registered documents.
See the `Documentation of DoctrinePHPCRBundle <http://github.com/doctrine/DoctrinePHPCRBundle>`_
for more information.

.. note::

When I move a document, the document is not be modified, except the ID.
Copy link
Member

Choose a reason for hiding this comment

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

can we reformulate that to The document is moved during the flush, after field changes have been written. If the move event handlers change properties of the document, those changes are not considered in this flush anymore.

The preFlush and onFlush events may modify the document before moving the document.

.. warning::

Expand Down Expand Up @@ -144,3 +150,15 @@ Listening to Lifecycle Events
-----------------------------

This works exactly the same as with the `ORM events <http://docs.doctrine-project.org/projects/doctrine-orm/en/latest/reference/events.html>`_.

Persistance event order
-----------------------

When $dm->flush is calling after $dm->move(), the order of events is:
Copy link
Contributor

Choose a reason for hiding this comment

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

This is the generic event order no? i.e. events will happen in this order and it doesn't matter which method you call, so I think something like "Events are fired in the following order when you call $dm->flush' would be all that is needed. (you can put two "backquotes around inline code blocks like that, see : http://sphinx-doc.org/rest.html#inline-markup)


1. preFlush
2. onFlush
3. preMove
4. postMove
5. postFlush

Copy link
Contributor

Choose a reason for hiding this comment

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

I would use a .. note:: markup for the first paragraph, and add it after the other .. note:: above, and I think then rename this section to "Persistance event order". What do you think?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Ok I updated this document