I've created a custom loader for my bundle with the purpose of loading different routes per environment. My loader class looks like this:
class ApiRouteLoader extends Loader
{
public function load($resource, $type = null)
{
$collection = new RouteCollection();
$resource = '@ApiBundle/Resources/config/routing.yml';
$type = 'yaml';
$importedRoutes = $this->import($resource, $type);
$collection->addCollection($importedRoutes);
return $collection;
}
public function supports($resource, $type = null)
{
return $type === 'extra';
}
}
What I need to know is how could I get the environment name to use in the 'load' function? I seem to unable to find a way to get the kernel (which would help).
Can anyone help? Thanks!