Can I somehow detect inside the code which version of symfony is currently used?
I have a bundle which uses a symfony function that has changed in version 2.4 so I need to detect on which version I am running, so that the function which is adequate for the used symfony version will be called
-
this answer should helpScriptable– Scriptable2015-01-22 20:56:00 +00:00Commented Jan 22, 2015 at 20:56
Add a comment
|
1 Answer
The symfony version constant will help you.
You find it in Symfony/Component/HttpKernel/Kernel - constant VERSION.
https://github.com/symfony/symfony/blob/master/src/Symfony/Component/HttpKernel/Kernel.php#L62
3 Comments
Nickolaus
will $this->get('kernel')->getBundle(..) work to get the class or what do I have to use, because the Symfony Components are not an actual bundle... or can I use the class loader??
Jens A. Koch
Hmm.. the kernel class is often loaded by the classloader, because of
$kernel = new HttpKernel($dispatcher, $resolver);. I would first try echo $kernel::VERSION and then echo Symfony/Component/HttpKernel/Kernel::VERSION.Nickolaus
htx will check it out tomorrow