[FrameworkBundle] added a protected shortcut getParameter() method in the base Controller class.

This commit is contained in:
Hugo Hamon 2015-03-25 11:05:20 +01:00
parent 6ef12044f7
commit 5d96f4dbd7

View File

@ -334,7 +334,7 @@ class Controller extends ContainerAware
} }
/** /**
* Gets a service by id. * Gets a container service by its id.
* *
* @param string $id The service id * @param string $id The service id
* *
@ -345,10 +345,22 @@ class Controller extends ContainerAware
if ('request' === $id) { if ('request' === $id) {
trigger_error('The "request" service is deprecated and will be removed in 3.0. Add a typehint for Symfony\\Component\\HttpFoundation\\Request to your controller parameters to retrieve the request instead.', E_USER_DEPRECATED); trigger_error('The "request" service is deprecated and will be removed in 3.0. Add a typehint for Symfony\\Component\\HttpFoundation\\Request to your controller parameters to retrieve the request instead.', E_USER_DEPRECATED);
} }
return $this->container->get($id); return $this->container->get($id);
} }
/**
* Gets a container configuration parameter by its name.
*
* @param string $name The parameter name
*
* @return mixed
*/
protected function getParameter($name)
{
return $this->container->getParameter($name);
}
/** /**
* Checks the validity of a CSRF token * Checks the validity of a CSRF token
* *