Reputation: 2551
What is the way to get root directory path from command class in symfony 2 ? Note : Not from controller class as I am creating a CLI command.
Or is there a a way to define a path in config file and access in anywhere ?
Upvotes: 3
Views: 8165
Reputation: 4119
By extending ContainerAwareCommand you can access the root directory path using:
$this->getContainer()->get('kernel')->getRootDir()
Upvotes: 9