根据此提交,您可以为WebProfiler设置自己的应用程序名称和版本。现在我在问自己(和你),这样做的目的是什么?
/**
* Constructor.
*
* @param string $name The name of the application using the web profiler
* @param string $version The version of the application using the web profiler
*/
public function __construct($name = null, $version = null)
{
$this->name = $name;
$this->version = $version;
}
收集器在HttpKernel
组件的ConfigDataCollector中定义,其构造函数有两个默认为null
的参数。该服务是在FrameWorkBundle
的collectors.xml中配置的,但无法设置参数。
现在,我已经通过在app/config/config.yml
中设置data_collector.config.class
并以这种方式注入应用程序的版本来覆盖收集器类。。。但这感觉完全不对。
我错过什么了吗?
提交消息说(emphasis mine):
[WebProfiler]添加了覆盖WDT 中应用程序名称/版本的可能性
我假设执行此操作的方式与您执行此操作时的方式相同,即使用您自己的扩展Symfony'Component'HttpKernel'DataCollector'ConfigDataCollector
的类并重写构造函数来设置属性(name
和version
)。
如果有人知道更好的方法,我们将不胜感激!