minor #12042 Update the Controller to be consistent (grifx)

This PR was merged into the 2.6-dev branch.

Discussion
----------

Update the Controller to be consistent

We are always using $this->container->get() and now we're using the short-cut sometimes to access to a service.
It could be nice to stay with $this->container->get() to stay consistent and for those who copy and paste the Controller to create a ControllerUtils, they wont have to change it (in fact neither ControllerUtils::get() nor ControllerUtils::has() exists).
See: http://www.whitewashing.de/2013/06/27/extending_symfony2__controller_utilities.html

Commits
-------

707623c Update the Controller to be consistent
This commit is contained in:
Fabien Potencier 2014-09-26 06:57:05 +02:00
commit ff17493029

View File

@ -109,7 +109,7 @@ class Controller extends ContainerAware
throw new \LogicException('You can not use the addFlash method if sessions are disabled.');
}
$this->get('session')->getFlashBag()->add($type, $message);
$this->container->get('session')->getFlashBag()->add($type, $message);
}
/**
@ -127,7 +127,7 @@ class Controller extends ContainerAware
throw new \LogicException('The SecurityBundle is not registered in your application.');
}
return $this->get('security.context')->isGranted($attributes, $object);
return $this->container->get('security.context')->isGranted($attributes, $object);
}
/**