Bundle

class Bundle implements BundleInterface

An implementation of BundleInterface that adds a few conventions for DependencyInjection extensions and Console commands.

Traits

ContainerAwareTrait ContainerAware trait.

Methods

setContainer(ContainerInterface $container = null)

Sets the container.

from ContainerAwareTrait
boot()

Boots the Bundle.

shutdown()

Shutdowns the Bundle.

build(ContainerBuilder $container)

Builds the bundle.

ExtensionInterface|null getContainerExtension()

Returns the bundle's container extension.

string getNamespace()

Gets the Bundle namespace.

string getPath()

Gets the Bundle directory path.

string getParent()

Returns the bundle parent name.

string getName()

Returns the bundle name (the class short name).

registerCommands(Application $application)

Finds and registers Commands.

Details

setContainer(ContainerInterface $container = null)

Sets the container.

Parameters

ContainerInterface $container A ContainerInterface instance or null

boot()

Boots the Bundle.

shutdown()

Shutdowns the Bundle.

build(ContainerBuilder $container)

Builds the bundle.

It is only ever called once when the cache is empty.

This method can be overridden to register compilation passes, other extensions, ...

Parameters

ContainerBuilder $container A ContainerBuilder instance

ExtensionInterface|null getContainerExtension()

Returns the bundle's container extension.

Return Value

ExtensionInterface|null The default extension or null if there is none

Exceptions

LogicException

string getNamespace()

Gets the Bundle namespace.

Return Value

string The Bundle namespace

string getPath()

Gets the Bundle directory path.

Return Value

string The Bundle absolute path

string getParent()

Returns the bundle parent name.

Return Value

string The Bundle name it overrides or null if no parent

final string getName()

Returns the bundle name (the class short name).

Return Value

string The Bundle name

registerCommands(Application $application)

Finds and registers Commands.

Override this method if your bundle commands do not follow the conventions:

  • Commands are in the 'Command' sub-directory
  • Commands extend Symfony\Component\Console\Command\Command

Parameters

Application $application An Application instance

© 2004–2017 Fabien Potencier
Licensed under the MIT License.
http://api.symfony.com/3.2/Symfony/Component/HttpKernel/Bundle/Bundle.html