class FindCommandsCompilerPass implements CompilerPassInterface (View source)

This compiler pass is added to Drupal's ContainerBuilder by our own subclass of DrupalKernel. Our DrupalKernel subclass knows which compiler passes to add because they are registered to it via its 'alter()' method. This happens in DrupalBoot8 immediately after the DrupalKernel object is created.

Having been thus added, this compiler pass will then be called during $kernel->boot(), when Drupal's dependency injection container is being compiled. Since we cannot use the container at this point (since its initialization is not yet complete), we instead alter the definition of a storage class in the container to add more setter injection method calls to 'addCommandReference'.

Later, after the container has been completely initialized, we can fetch the storage class from the DI container (perhaps also via injection from a reference in the container). At that point, we can request the list of Console commands that were added via the (delayed) call(s) to addCommandReference.

Documentation:

http://symfony.com/doc/2.7/components/dependency_injection/tags.html#create-a-compilerpass

Properties

protected $storageClassId
protected $tagId

Methods

__construct($storageClassId, $tagId)

No description

process(ContainerBuilder $container)

No description

Details

__construct($storageClassId, $tagId)

Parameters

$storageClassId
$tagId

process(ContainerBuilder $container)

Parameters

ContainerBuilder $container