You are here

public function Kernel::getBundle in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 vendor/symfony/http-kernel/Kernel.php \Symfony\Component\HttpKernel\Kernel::getBundle()

Returns a bundle and optionally its descendants by its name.

Parameters

string $name Bundle name:

bool $first Whether to return the first bundle only or together with its descendants:

Return value

BundleInterface|BundleInterface[] A BundleInterface instance or an array of BundleInterface instances if $first is false

Throws

\InvalidArgumentException when the bundle is not enabled

Overrides KernelInterface::getBundle

1 call to Kernel::getBundle()
Kernel::locateResource in vendor/symfony/http-kernel/Kernel.php

File

vendor/symfony/http-kernel/Kernel.php, line 226

Class

Kernel
The Kernel is the heart of the Symfony system.

Namespace

Symfony\Component\HttpKernel

Code

public function getBundle($name, $first = true) {
  if (!isset($this->bundleMap[$name])) {
    throw new \InvalidArgumentException(sprintf('Bundle "%s" does not exist or it is not enabled. Maybe you forgot to add it in the registerBundles() method of your %s.php file?', $name, get_class($this)));
  }
  if (true === $first) {
    return $this->bundleMap[$name][0];
  }
  return $this->bundleMap[$name];
}