On 11/22/10 4:58 PM, Benjamin Eberlei wrote:

Atcually this code is in Doctrine. I am not sure why its still in Symfony
(where it was first invented). Probably just something Jonathan hasnt
kicked out yet.

Ok, that makes sense. I have created a ticket for the cleanup task: http://trac.symfony-project.org/ticket/9287

Fabien

On Mon, 22 Nov 2010 16:44:14 +0100, Fabien Potencier
<[email protected]>  wrote:
On 11/22/10 4:28 PM, Benjamin Eberlei wrote:

Two problems:

1. Using XML and YAML Mapping you cannot perform Reflection on the not
existing classes (in case of the EntityGenerator). Most of the Class
Metadata code however relies on Reflection. This is why the
disconnected
stuff is necessary (maybe we should call it Unreflected).

It's probably a good idea to rename the class. But why is this code
within the Symfony bundle and not in Doctrine directly? What is specific

to Symfony2?

Fabien

2. The problem is inheritance hierachies cannot be generated from the
YAML
and XML metadata information (EntityGenerator). Its just not supported
conceptually, because the mapping information is missing the
information
which class is parent to which other. That is why the
DisconnectedClassMetadata is necessary to return an empty array()
instead
of trying to call get_parent_classes for a non existant class.

greetings,
Benjamin

On Mon, 22 Nov 2010 15:52:52 +0100, Thomas Rabaix
<[email protected]>
wrote:
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