Skip to content

Commit d4f305d

Browse files
[Clock] Fix ClockAwareTrait usage
1 parent bbaf5b0 commit d4f305d

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

components/clock.rst

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -114,11 +114,11 @@ the default one during tests, you will have full control to set the "current tim
114114
to any arbitrary date/time.
115115

116116
In order to use this component in your services, make their classes use the
117-
:class:`Symfony\\Component\\Clock\\ClockAwareTrait` and add a ``ClockInterface``
118-
typed-property ``$clock`` to their constructors.
117+
:class:`Symfony\\Component\\Clock\\ClockAwareTrait`. Thanks to
118+
:ref:`service autoconfiguration <services-autoconfigure>`, the ``setClock()`` method
119+
of the trait will automatically be called by the service container.
119120

120-
If your application uses :ref:`service autoconfiguration <services-autoconfigure>`,
121-
your services can now call the ``$this->now()`` method to get the current time::
121+
You can now call the ``$this->now()`` method to get the current time::
122122

123123
namespace App\TimeUtils;
124124

0 commit comments

Comments
 (0)