public function getBundleDocumentClasses($bundle, $documentsDirectory = null)
    {
        if (!$documentsDirectory) {
            $documentsDirectory = $this->documentDir;
        }

        $bundleReflection = new \ReflectionClass($this->getBundleClass($bundle));

        $documentsDirectory = DIRECTORY_SEPARATOR . str_replace('\\', '/', $documentsDirectory) . DIRECTORY_SEPARATOR;
        $directory = dirname($bundleReflection->getFileName()) . $documentsDirectory;

        if (!is_dir($directory)) {
            return [];
        }

        $iterator = new \RecursiveIteratorIterator(new \RecursiveDirectoryIterator($directory));
        $files = new \RegexIterator($iterator, '/^.+\.php$/i', \RecursiveRegexIterator::GET_MATCH);

        $documents = [];

        foreach ($files as $file => $v) {
            $documents[] = str_replace(
                DIRECTORY_SEPARATOR,
                '\\',
                substr(strstr($file, $documentsDirectory), strlen($documentsDirectory), -4)
            );
        }

        return $documents;
    }
public function getBundleDocumentClasses($bundle, $documentsDirectory = null)
    {
        if (!$documentsDirectory) {
            $documentsDirectory = $this->documentDir;
        }

        $bundleReflection = new \ReflectionClass($this->getBundleClass($bundle));

        $documentsDirectory = DIRECTORY_SEPARATOR . str_replace('\\', '/', $documentsDirectory) . DIRECTORY_SEPARATOR;
        $directory = dirname($bundleReflection->getFileName()) . $documentsDirectory;

        if (!is_dir($directory)) {
            return [];
        }

        $iterator = new \RecursiveIteratorIterator(new \RecursiveDirectoryIterator($directory));
        $files = new \RegexIterator($iterator, '/^.+\.php$/i', \RecursiveRegexIterator::GET_MATCH);

        $documents = [];

        foreach ($files as $file => $v) {
            $documents[] = str_replace(
                DIRECTORY_SEPARATOR,
                '\\',
                substr(strstr($file, $documentsDirectory), strlen($documentsDirectory), -4)
            );
        }

        return $documents;
    }
public function getBundleDocumentClasses ( $ bundle , $ documentsDirectory = null ) { if ( ! $ documentsDirectory ) { $ documentsDirectory = $ this -> documentDir ; } $ bundleReflection = new \ ReflectionClass ( $ this -> getBundleClass ( $ bundle ) ) ; $ documentsDirectory = DIRECTORY_SEPARATOR . str_replace ( '\\' , '/' , $ documentsDirectory ) . DIRECTORY_SEPARATOR ; $ directory = dirname ( $ bundleReflection -> getFileName ( ) ) . $ documentsDirectory ; if ( ! is_dir ( $ directory ) ) { return [ ] ; } $ iterator = new \ RecursiveIteratorIterator ( new \ RecursiveDirectoryIterator ( $ directory ) ) ; $ files = new \ RegexIterator ( $ iterator , '/^.+\.php$/i' , \ RecursiveRegexIterator :: GET_MATCH ) ; $ documents = [ ] ; foreach ( $ files as $ file => $ v ) { $ documents [ ] = str_replace ( DIRECTORY_SEPARATOR , '\\' , substr ( strstr ( $ file , $ documentsDirectory ) , strlen ( $ documentsDirectory ) , - 4 ) ) ; } return $ documents ; }
Returns a list of bundle document classes.

Example output:

[
'Category',
'Product',
'SubDir\SomeObject'
]

@param string $bundle Bundle name. E.g. AppBundle
@param string $documentsDirectory Directory name where documents are stored in the bundle.

@return array
Returns a list of bundle document classes .