This documentation is for a version that has reached its End Of Life. Such versions are no longer supported and don't receive security updates. Consider updating to a newer version.
Injecting SiteAccess¶
The service container exposes the SiteAccess through the Ibexa\Core\MVC\Symfony\SiteAccess\SiteAccessService
service, which fulfills the Ibexa\Core\MVC\Symfony\SiteAccess\SiteAccessServiceInterface
contract.
This means you can inject it into any custom service constructor, type hinting that contract.
You can get the current SiteAccess from that service by calling the SiteAccessServiceInterface::getCurrent
method.
For example, define a service which depends on the Repository's ContentService and the SiteAccessService.
1 2 3 |
|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 |
|