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;
    }