-
Notifications
You must be signed in to change notification settings - Fork 2.5k
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
Overview table for events #9039
Conversation
Better late than never - finally delivering what I announced at doctrine#8435 (comment) :-)
I have to lookup the missing pieces myself. I'll come back to it. |
Sure. Can I ask you something in the meantime :-) At #8435 (comment) you said:
And the list at https://www.doctrine-project.org/projects/doctrine-orm/en/2.9/reference/events.html#lifecycle-events says for several events: "This event is not a lifecycle callback." |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"This event is not a lifecycle callback." What does this mean?
I suppose this is referring to https://www.doctrine-project.org/projects/doctrine-orm/en/2.9/reference/events.html#lifecycle-callbacks where lifecycle callbacks are used in the entity class. Maybe a third "is lifecycle callback" column can mark those who can be used as a lifecycle callback.
If those two ClassMetadata events (and maybe the other non-lifecycle-callbacks) are some special case or rarely used, it's maybe better to exclude them from this table and explain them separately (extra table, list or whatever...)?
I never had a use case where I had to use these ClassMetadata events, but I wouldn't call them special. The table is an overview and doesn't get too much into detail, so I think it's fine to keep those events in there. If there's a need to tell more detailed information about them, then those can be additionally appended as text.
docs/en/reference/events.rst
Outdated
+-----------------------------+-----------------------+ | ||
| ``postLoad`` | Loading from database | | ||
+-----------------------------+-----------------------+ | ||
| ``loadClassMetadata`` | ? | |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is hard to point out. It is triggered when metadata is loaded, which happens in reading methods of the entity manager like find()
, getReference()
and getPartialReference()
when it is loaded for the first time. Of course it is also triggered when $metadataFactory->getMetadataFor()
is called directly.
If this table is focused on the entity manager, maybe those three $em methods can be added with the hint of an initial load.
It is also triggered on $em->clear('Foo')
, but the argument for clear()
is deprecated and will be removed.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
maybe those three $em methods can be added with the hint of an initial load.
Does "initial" mean (a) for the first time in the current request, or (b) for the first time ever (i.e. until the database structure is changed)? If (a), then there's almost no (?) difference to what I wrote for postLoad
(="Loading from database"), since you probably don't load the same entity 20 times in the same request...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Unassigning from milestone 2.9.6 since I'm trying to release it. |
Yeah sure! But what I meant is: If some are "lifecycle callbacks", what are the others then? Can you not use them in an entity?? |
You can't use them as annotation in an entity, if you mean that. That's right. ORM is using an EventManager where eventlisteners can be registered. |
OK, I'm starting to understand ;-) So the rule is:
Right? |
Right, this should summing it up. |
Just some by-product of doctrine#9039 :-) - see doctrine#9039 (comment)
@SenseException Please merge this as-is - I'd like to see how it looks, and what can already be deleted from the list at https://www.doctrine-project.org/projects/doctrine-orm/en/2.9/reference/events.html#lifecycle-events About |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I guess this should work. :-)
I'd like to have 2 more eyes to look over the table content.
Thank you @ThomasLandauer |
Well, the answer to what I said at doctrine#9039 (comment) > I'd like to see if this does come out nicely on the web page... ... is clearly NO ;-) Anyway, let's continue and care about the layout later... Questions: 1: Is it OK to link them like so? => Then I'll do the others. 2: The order of the events differs between the table (=same as list) and the chapters further down. I think the chapters make more sense (starting with `prePersist`), so I'm going to change the table. 3: Suggestion for the next table column: **Can change current entity**
Better late than never - finally delivering what I announced at #8435 (comment) :-)
@SenseException Could you please fill in the two question marks? Or just delete those two rows if the events are not important ;-)
Then please merge this as-is. The plan for this table is to replace the list at https://www.doctrine-project.org/projects/doctrine-orm/en/2.9/reference/events.html#lifecycle-events completely. But I'd like to proceed column by column. And before doing more stupid
-
character counting ;-) I'd like to see if this does come out nicely on the web page...Next step would be to link the events (first column) to their respective headers/anchors further down the page, e.g.: