Hello,

The DoctrineCommand::getBundleMetadatas function uses a 
SymfonyDisconnectedClassMetadataFactory which failed to load information from 
parent class as the DisconnectedClassMetadataFactory::getParentClass always 
return an empty array. I have made a quick patch here, I don't want to create a 
pull request as I don't know any side effect.

I don't see the point of SymfonyDisconnectedClassMetadataFactory ... as the 
class will never load all entities information.

diff --git a/src/Symfony/Bundle/DoctrineBundle/Command/DoctrineCommand.php 
b/src/Symfony/Bundle/DoctrineBundle/Command/DoctrineCommand.php
index da04e18..96e2e76 100644
--- a/src/Symfony/Bundle/DoctrineBundle/Command/DoctrineCommand.php
+++ b/src/Symfony/Bundle/DoctrineBundle/Command/DoctrineCommand.php
@@ -139,7 +139,8 @@ abstract class DoctrineCommand extends Command
         $bundleMetadatas = array();
         $entityManagers = $this->getDoctrineEntityManagers();
         foreach ($entityManagers as $key => $em) {
-            $cmf = new SymfonyDisconnectedClassMetadataFactory($em);
+//            $cmf = new SymfonyDisconnectedClassMetadataFactory($em);
+            $cmf = $em->getMetadataFactory();
             $metadatas = $cmf->getAllMetadata();
             foreach ($metadatas as $metadata) {
 
@@ -151,19 +152,4 @@ abstract class DoctrineCommand extends Command
 
         return $bundleMetadatas;
     }
-}
-
-class SymfonyDisconnectedClassMetadataFactory extends 
DisconnectedClassMetadataFactory
-{
-    /**
-     * @override
-     */
-    protected function _newClassMetadataInstance($className)
-    {
-        if (class_exists($className)) {
-            return new ClassMetadata($className);
-        } else {
-            return new ClassMetadataInfo($className);
-        }
-    }
 }

-- 
If you want to report a vulnerability issue on symfony, please send it to 
security at symfony-project.com

You received this message because you are subscribed to the Google
Groups "symfony developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/symfony-devs?hl=en

Reply via email to