php - Symfony2 get root directory path from command class -


what way root directory path command class in symfony 2 ? note : not controller class creating cli command.

or there a way define path in config file , access in anywhere ?

by extending containerawarecommand can access root directory path using:

$this->getcontainer()->get('kernel')->getrootdir() 

see http://symfony.com/doc/current/cookbook/console/console_command.html#getting-services-from-the-service-container


Comments

Popular posts from this blog

PySide and Qt Properties: Connecting signals from Python to QML -

c# - DevExpress.Wpf.Grid.InfiniteGridSizeException was unhandled -

scala - 'wrong top statement declaration' when using slick in IntelliJ -