Documentation

Container
in package

Class Container

Table of Contents

Constants

SELF  = 'civi_container_factory'

Methods

boot()  : mixed
Get a list of boot services.
createAngularManager()  : Manager
createApiKernel()  : Kernel
createCacheConfig()  : ArrayObject
createContainer()  : ContainerBuilder
Construct a new container.
createEsmLoader()  : object
Determine which component will load ECMAScript Modules.
createEventDispatcher()  : CiviEventDispatcherInterface
createLockManager()  : LockManager
createPrevNextCache()  : CRM_Core_PrevNextCache_Interface
createResources()  : CRM_Core_Resources
getBootService()  : mixed
isContainerBooted()  : bool
Determine whether the container services are available.
loadContainer()  : ContainerInterface
Find a cached container definition or construct a new one.
singleton()  : TaggedContainerInterface

Constants

SELF

public mixed SELF = 'civi_container_factory'

Methods

boot()

Get a list of boot services.

public static boot(bool $loadFromDB) : mixed

These are services which must be setup before the container can operate.

Parameters
$loadFromDB : bool
Tags
throws
CRM_Core_Exception

createCacheConfig()

public static createCacheConfig() : ArrayObject
Return values
ArrayObject

createContainer()

Construct a new container.

public createContainer() : ContainerBuilder
Return values
ContainerBuilder

createEsmLoader()

Determine which component will load ECMAScript Modules.

public static createEsmLoader(ContainerInterface $container) : object
Parameters
$container : ContainerInterface
Return values
object

getBootService()

public static getBootService(string $name) : mixed
Parameters
$name : string

isContainerBooted()

Determine whether the container services are available.

public static isContainerBooted() : bool
Return values
bool

loadContainer()

Find a cached container definition or construct a new one.

public loadContainer() : ContainerInterface

There are many weird contexts in which Civi initializes (eg different variations of multitenancy and different permutations of CMS/CRM bootstrap), and hook_container may fire a bit differently in each context. To mitigate risk of leaks between environments, we compute a unique envID (md5(DB_NAME, HTTP_HOST, SCRIPT_FILENAME, etc)) and use separate caches for each (eg "templates_c/CachedCiviContainer.$ENVID.php").

Constants:

  • CIVICRM_CONTAINER_CACHE -- 'always' [default], 'never', 'auto'
  • CIVICRM_DSN
  • CIVICRM_DOMAIN_ID
Return values
ContainerInterface

singleton()

public static singleton([bool $reset = FALSE ]) : TaggedContainerInterface
Parameters
$reset : bool = FALSE

Whether to forcibly rebuild the entire container.

Return values
TaggedContainerInterface

        
On this page

Search results