diff --git a/profiler/data_collector.rst b/profiler/data_collector.rst index 6c37816a81c..5204957795f 100644 --- a/profiler/data_collector.rst +++ b/profiler/data_collector.rst @@ -30,6 +30,11 @@ The :method:`Symfony\\Component\\HttpKernel\\DataCollector\\DataCollectorInterface::collect` method is responsible for storing the collected data in local properties. +.. caution:: + + The :method:`Symfony\\Component\\HttpKernel\\DataCollector\\DataCollectorInterface::collect` method is only called once. + It is not used to "gather" data but is there to "pick up" the data that has been stored by your service. + Most of the time, it is convenient to extend :class:`Symfony\\Component\\HttpKernel\\DataCollector\\DataCollector` and populate the ``$this->data`` property (it takes care of serializing the @@ -71,6 +76,11 @@ collects the method and accepted content types from the request:: The getters are added to give the template access to the collected information. +.. caution:: + + If the data that is not directly related to the request or response, you need to make the data accessible to your DataCollector. + This can be achieved by injecting the service that holds the information you intend to profile into your DataCollector. + .. caution:: As the profiler serializes data collector instances, you should not