-
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
[Documentation] Events Overview Table: Adding "Passed Argument" column #9184
Conversation
As announced in doctrine#9160 (comment) I'm adding the passed "EventArgs" class to the overview table. Once this is complete, my further plan is to remove the entire paragraph https://www.doctrine-project.org/projects/doctrine-orm/en/2.10/reference/events.html#lifecycle-callbacks-event-argument, and probably also the second code block at https://www.doctrine-project.org/projects/doctrine-orm/en/2.10/reference/events.html#entity-listeners-class Is there a better way to link to the source code of `LifecycleEventArgs` than https://github.com/doctrine/persistence/blob/2.2.x/lib/Doctrine/Persistence/Event/LifecycleEventArgs.php ? Also, I changed `postLoad` to `preUpdate` in the code block, to have an example that does not receive `LifecycleEventArgs` ;-)
My plan for next steps:
|
I haven't checked the text details, but before we can think of removing them as a list, it should be checked if those infos don't contain something important that isn't in the other paragraphs of the events. |
URGENT: Right now, the PHP code tab seems to be broken: https://www.doctrine-project.org/projects/doctrine-orm/en/2.10/reference/events.html#lifecycle-callbacks
To keep the code block as short as possible. This is just to show how listeners work in general: One is being shown twice (to showcase that this is possible), plus one another (to showcase that you don't have to always do it twice).
Sure, that's exactly what I meant by:
|
This PR isn't related to a fix. It also doesn't look like that this has to do with a wrong syntax of events.rst. |
Is there any real-life proof that |
Seems like docs and website are separated. This is going to be fixed in a separate PR. |
Well, since you've fixed the code-block issue, let's continue here :-) Remaining question: Is there a better way to link to the source code of Here's an example from Symfony Docs, is this syntax working here too?
|
I'm not fully aware of what the rst-parser is capable of or not. I usually do tests in a local instance of the website. AFAIK this isn't used in the docs yet. There's |
Well, so what do you suggest? Should we ask somebody from Symfony? |
The Doctrine website is currently using its own rst-parser, which doesn't support the whole restructured text syntax. For now a link will do because |
Questions: 1. Is https://github.com/doctrine/persistence/blob/master/lib/Doctrine/Persistence/Event/LifecycleEventArgs.php correct at all? Shouldn't this be https://github.com/doctrine/orm/blob/2.10.x/lib/Doctrine/ORM/Event/LifecycleEventArgs.php, like all the others? 2. Which one is correct for `preUpdate`? https://www.doctrine-project.org/projects/doctrine-orm/en/2.10/reference/events.html#entity-listeners-class says `PreUpdateEventArgs`, but https://www.doctrine-project.org/projects/doctrine-orm/en/2.10/reference/events.html#listening-and-subscribing-to-lifecycle-events says `LifecycleEventArgs` For the two links to `doctrine/persistence`, I'm linking to `/master/` now, which is being forwarded to `/2.2.x/`.
OK, done :-) Questions:
For the two links to |
|
|
Looks nice 👍
I wouldn't mix them all together for now. |
Well, OK, then please merge this :-) |
I'll review the PR soon. Sorry for the delay. |
docs/en/reference/events.rst
Outdated
.. _LifecycleEventArgs: https://github.com/doctrine/orm/blob/2.10.x/lib/Doctrine/ORM/Event/LifecycleEventArgs.php | ||
.. _PreUpdateEventArgs: https://github.com/doctrine/orm/blob/2.10.x/lib/Doctrine/ORM/Event/PreUpdateEventArgs.php | ||
.. _PreFlushEventArgs: https://github.com/doctrine/orm/blob/2.10.x/lib/Doctrine/ORM/Event/PreFlushEventArgs.php | ||
.. _PostFlushEventArgs: https://github.com/doctrine/orm/blob/2.10.x/lib/Doctrine/ORM/Event/PostFlushEventArgs.php | ||
.. _OnFlushEventArgs: https://github.com/doctrine/orm/blob/2.10.x/lib/Doctrine/ORM/Event/OnFlushEventArgs.php | ||
.. _OnClearEventArgs: https://github.com/doctrine/orm/blob/2.10.x/lib/Doctrine/ORM/Event/OnClearEventArgs.php | ||
.. _LoadClassMetadataEventArgs: https://github.com/doctrine/orm/blob/2.10.x/lib/Doctrine/ORM/Event/LoadClassMetadataEventArgs.php | ||
.. _OnClassMetadataNotFoundEventArgs: https://github.com/doctrine/orm/blob/2.10.x/lib/Doctrine/ORM/Event/OnClassMetadataNotFoundEventArgs.php |
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.
Let's use version-independant URLs?
.. _LifecycleEventArgs: https://github.com/doctrine/orm/blob/2.10.x/lib/Doctrine/ORM/Event/LifecycleEventArgs.php | |
.. _PreUpdateEventArgs: https://github.com/doctrine/orm/blob/2.10.x/lib/Doctrine/ORM/Event/PreUpdateEventArgs.php | |
.. _PreFlushEventArgs: https://github.com/doctrine/orm/blob/2.10.x/lib/Doctrine/ORM/Event/PreFlushEventArgs.php | |
.. _PostFlushEventArgs: https://github.com/doctrine/orm/blob/2.10.x/lib/Doctrine/ORM/Event/PostFlushEventArgs.php | |
.. _OnFlushEventArgs: https://github.com/doctrine/orm/blob/2.10.x/lib/Doctrine/ORM/Event/OnFlushEventArgs.php | |
.. _OnClearEventArgs: https://github.com/doctrine/orm/blob/2.10.x/lib/Doctrine/ORM/Event/OnClearEventArgs.php | |
.. _LoadClassMetadataEventArgs: https://github.com/doctrine/orm/blob/2.10.x/lib/Doctrine/ORM/Event/LoadClassMetadataEventArgs.php | |
.. _OnClassMetadataNotFoundEventArgs: https://github.com/doctrine/orm/blob/2.10.x/lib/Doctrine/ORM/Event/OnClassMetadataNotFoundEventArgs.php | |
.. _LifecycleEventArgs: https://github.com/doctrine/orm/blob/HEAD/lib/Doctrine/ORM/Event/LifecycleEventArgs.php | |
.. _PreUpdateEventArgs: https://github.com/doctrine/orm/blob/HEAD/lib/Doctrine/ORM/Event/PreUpdateEventArgs.php | |
.. _PreFlushEventArgs: https://github.com/doctrine/orm/blob/HEAD/lib/Doctrine/ORM/Event/PreFlushEventArgs.php | |
.. _PostFlushEventArgs: https://github.com/doctrine/orm/blob/HEAD/lib/Doctrine/ORM/Event/PostFlushEventArgs.php | |
.. _OnFlushEventArgs: https://github.com/doctrine/orm/blob/HEAD/lib/Doctrine/ORM/Event/OnFlushEventArgs.php | |
.. _OnClearEventArgs: https://github.com/doctrine/orm/blob/HEAD/lib/Doctrine/ORM/Event/OnClearEventArgs.php | |
.. _LoadClassMetadataEventArgs: https://github.com/doctrine/orm/blob/HEAD/lib/Doctrine/ORM/Event/LoadClassMetadataEventArgs.php | |
.. _OnClassMetadataNotFoundEventArgs: https://github.com/doctrine/orm/blob/HEAD/lib/Doctrine/ORM/Event/OnClassMetadataNotFoundEventArgs.php |
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.
Sure, we just didn't know how to do it ;-)
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.
Easier to maintain, but will at one time link to a different version than the documentation page you're on.
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.
Yes.
But: Let's face it - nobody is going to update those links for every new version. So sooner or later they will lead to a different version anyway!
So basically the choice is: to a previous version or to a future version? And since users are upgrading more frequently than downgrading, I'd say: future.
The question isn't too important cause in this case the code isn't changing a lot over the versions (or is it?); and whenever the events are drastically changed, this page needs to be updated anyway.
But I don't have a strong opinion about this, so basically I'm doing what you're telling me :-)
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.
HEAD
is on the default branch, so that means it would only be an issue if browsing the documentation for the next major, or outdated docs I think.
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.
Either way, the probability that we'll forget to update the links in both situations are there. 😳
Upmerges will point to the same default branch, but those branches are still in a pre-released state.
Okay, let's keep HEAD.
Co-authored-by: Grégoire Paris <[email protected]>
Thanks @ThomasLandauer ! |
As announced in doctrine#9184 (comment)
As announced in #9184 (comment)
@ThomasLandauer hi! The syntax you used for the links in that new column does not appear to work: https://www.doctrine-project.org/projects/doctrine-orm/en/2.11/reference/events.html#events-overview The leading underscore is not supposed to appear: https://sublime-and-sphinx-guide.readthedocs.io/en/latest/references.html#links-to-external-web-pages Clicking the "Display the rich diff" button on the "Files changed" tab of Github shows the issue. Also, the trailing underscore is missing on some entries, which is shows by the syntactic coloration of my editor. |
@greg0ire Thanks for fixing it! |
All we have AFAIK is the "display the rich diff" button, which did show the issue. I think the website is generated daily: https://github.com/doctrine/doctrine-website/actions
What are you referring to? |
Rich diff:
So you can never know if the syntax is wrong or just not supported by the rich diff parser... More obvious: |
Your ideas do seem possible actually. Maybe webhooks could help? https://docs.github.com/en/developers/webhooks-and-events/webhooks/about-webhooks |
As announced in #9160 (comment) I'm adding the passed "EventArgs" class to the overview table. Once this is complete, my further plan is to remove the entire paragraph https://www.doctrine-project.org/projects/doctrine-orm/en/2.10/reference/events.html#lifecycle-callbacks-event-argument, and probably also the second code block at https://www.doctrine-project.org/projects/doctrine-orm/en/2.10/reference/events.html#entity-listeners-class
@SenseException Is there a better way to link to the source code of
LifecycleEventArgs
than https://github.com/doctrine/persistence/blob/2.2.x/lib/Doctrine/Persistence/Event/LifecycleEventArgs.php ?=> Waiting for feedback before I do the others :-)
EDIT: This is an example from Symfony, is this syntax working here too?
Also, I changed
postLoad
topreUpdate
in the code block, to have an example that does not receiveLifecycleEventArgs
;-)