private function getBundleForClass($class)
    {
        $reflectionClass = new \ReflectionClass($class);
        $bundles = $this->kernel->getBundles();

        do {
            $namespace = $reflectionClass->getNamespaceName();
            foreach ($bundles as $bundle) {
                if ('Symfony\Bundle\FrameworkBundle' === $bundle->getNamespace()) {
                    continue;
                }
                if (0 === strpos($namespace, $bundle->getNamespace())) {
                    return preg_replace('/Bundle$/', '', $bundle->getName());
                }
            }
            $reflectionClass = $reflectionClass->getParentClass();
        } while ($reflectionClass);
    }
private function getBundleForClass($class)
    {
        $reflectionClass = new \ReflectionClass($class);
        $bundles = $this->kernel->getBundles();

        do {
            $namespace = $reflectionClass->getNamespaceName();
            foreach ($bundles as $bundle) {
                if ('Symfony\Bundle\FrameworkBundle' === $bundle->getNamespace()) {
                    continue;
                }
                if (0 === strpos($namespace, $bundle->getNamespace())) {
                    return preg_replace('/Bundle$/', '', $bundle->getName());
                }
            }
            $reflectionClass = $reflectionClass->getParentClass();
        } while ($reflectionClass);
    }
private function getBundleForClass ( $ class ) { $ reflectionClass = new \ ReflectionClass ( $ class ) ; $ bundles = $ this -> kernel -> getBundles ( ) ; do { $ namespace = $ reflectionClass -> getNamespaceName ( ) ; foreach ( $ bundles as $ bundle ) { if ( 'Symfony\Bundle\FrameworkBundle' === $ bundle -> getNamespace ( ) ) { continue ; } if ( 0 === strpos ( $ namespace , $ bundle -> getNamespace ( ) ) ) { return preg_replace ( '/Bundle$/' , '' , $ bundle -> getName ( ) ) ; } } $ reflectionClass = $ reflectionClass -> getParentClass ( ) ; } while ( $ reflectionClass ) ; }
Returns the bundle name in which the given class name is located.

@param string $class A fully qualified controller class name

@return string|null $bundle A bundle name
Returns the bundle name in which the given class name is located .