Returns a bundle and optionally its descendants by its name.
public getBundle ( string $name, boolean $first = true ) : Symfony\Component\HttpKernel\Bundle\BundleInterface | Array | ||
$name | string | Bundle name |
$first | boolean | Whether to return the first bundle only or together with its descendants |
리턴 | Symfony\Component\HttpKernel\Bundle\BundleInterface | Array | A BundleInterface instance or an array of BundleInterface instances if $first is false |
/** * {@inheritdoc} */ public function getBundle($name, $first = true) { // if need to get this precise bundle if (strpos($name, '!') === 0) { $name = substr($name, 1); if (isset($this->bundleMap[$name])) { // current bundle is always the last $bundle = end($this->bundleMap[$name]); return $first ? $bundle : array($bundle); } } return parent::getBundle($name, $first); }