ServiceLocator
Service Locator class
Method | Description | Available from version |
---|---|---|
\Bitrix\Main\DI\ServiceLocator::getInstance(). | Service registration | |
\Bitrix\Main\DI\ServiceLocator::addInstance(string $code, $service): void | Registration of already created or initialized service. Parameters:
| |
\Bitrix\Main\DI\ServiceLocator::addInstanceLazy(string $code, $configuration): void | Service registration using configuration for initialization by requirement. Parameters:
| |
\Bitrix\Main\DI\ServiceLocator::has(string $code): bool | Returns true, when service with $code was registered. Otherwise, false. Parameters:
| |
\Bitrix\Main\DI\ServiceLocator::get(string $code) | Returns service. When this is a first query, executes service creation. When service with this code is unavailable, throws an exception that implements the interface \Psr\Container\NotFoundExceptionInterface. Parameters:
|
© «Bitrix24», 2001-2024