-
-
Notifications
You must be signed in to change notification settings - Fork 5.2k
[Clock] Fix ClockAwareTrait
usage
#17772
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
[Clock] Fix ClockAwareTrait
usage
#17772
Conversation
a9aa7d9
to
783de4f
Compare
What is the reason for this change? (the title says "fix", but I don't think it changed the meaning of the existing text?) To me, this is too much implementation detail for the documentation. It combines many topics that might be unknown to the reader in a single paragraph, which distracts from the actual usage part of this trait. |
It fixes the documentation because to use
Do you see it somewhere else, like in a dedicated page for example? 🙂 It's true now that the component has all these different features, it may be a good idea to split this in separate pages like it is for the Console component? |
Ah, sorry. I was too quick, makes sense 👍 but let's make the paragraph a bit simpler (I'll propose something after this comment).
No, I meant that we now mention quite some unrelated concepts like "
We are actually doing the opposite the past years: move all separate articles into single guides. We've discovered that it's much easier for readers if all information about a single topic is on a single page (especially now that the docs have a sticky table of contents) |
components/clock.rst
Outdated
:class:`Symfony\\Component\\Clock\\ClockAwareTrait`. This trait defines the | ||
``ClockAwareTrait::setClock()`` method. Thanks to the ``#[Required]`` attribute | ||
declared on this method and if your application uses :ref:`service autoconfiguration <services-autoconfigure>`, | ||
``ClockAwareTrait::setClock()`` will automatically be called by the service container, | ||
injecting a clock implementation into the ``$clock`` property (also provided | ||
by the trait). Your services can now call the ``$this->now()`` method to get the | ||
current time:: |
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.
:class:`Symfony\\Component\\Clock\\ClockAwareTrait`. This trait defines the | |
``ClockAwareTrait::setClock()`` method. Thanks to the ``#[Required]`` attribute | |
declared on this method and if your application uses :ref:`service autoconfiguration <services-autoconfigure>`, | |
``ClockAwareTrait::setClock()`` will automatically be called by the service container, | |
injecting a clock implementation into the ``$clock`` property (also provided | |
by the trait). Your services can now call the ``$this->now()`` method to get the | |
current time:: | |
:class:`Symfony\\Component\\Clock\\ClockAwareTrait`. Thanks to | |
:ref:`service autoconfiguration <services-autoconfigure>`, the ``setClock()`` method | |
of the trait will automatically be called by the service container. | |
You can now call the ``$this->now()`` method to get the current time:: |
783de4f
to
d9cb18a
Compare
d9cb18a
to
d4f305d
Compare
Thank you for your explanations @wouterj! It's definitely clearer now and I totally prefer your version without superfluous technical details. I'll keep this in mind in future contributions. The "single page documentation" way to do is also very good to know. I agree that everything in one page makes the info research easier. I'll actually apply this in the followup PR regarding Nicolas' comment #17771 (review). Thanks for the time you spent on that feedback 👍 |
Now it's more precise while still being easy to understand. Thanks all for your work here! |
No description provided.