Symfony\Component\DependencyInjection\Container::get
Gets a service.
If a service is defined both through a set() method and with a get{$id}Service() method, the former has always precedence.
Signature
public function get(string
$id,
[integer
$invalidBehavior = self::EXCEPTION_ON_INVALID_REFERENCE] )
Parameters
$id
— string- The service identifier
$invalidBehavior
— integer- The behavior when the service does not exist
Returns
- The associated service
Errors/Exceptions
-
InvalidArgumentException
- if the service is not defined
-
ServiceCircularReferenceException
- When a circular reference is detected
-
ServiceNotFoundException
- When the service is not defined