DDC-868: ORM:Schema-tool:create failure -- the result depends on xml files enumeration order of RecursiveDirectoryIterator in context of SINGLE_TABLE inherantence #5390

doctrinebot opened this Issue Nov 8, 2010 · 4 comments

2 participants


Jira issue originally created by user xhorse:

= Relevant configuration: =
resources.doctrine.driver.class = Doctrine\ORM\Mapping\Driver\XmlDriver
resources.doctrine.driver.dir = APPLICATION_PATH "/../library/Droop/Model/Xml"
resources.doctrine.cache.class = Doctrine\Common\Cache\ArrayCache
resources.doctrine.conn.driver = pdo_mysql

= Models hierarchy =
class Sysbase {}
class Drooplet extends Sysbase {}
class Menu extends Sysbase {}

= Xml driver =

= Error =
While using command line to generate schema [php doctrine.php orm:schema-tool:create --dump-sql], it reports error "The table with name 'system' already exists." on windows however not on linux.

It is because the ClassMetaFactory.php depends on the sequence of result returned by getAllClassNames(). In this scenario, it's in descending order on linux and ascending on windows.
124 foreach ($this->driver->getAllClassNames() as $className) {
125 $metadata[] = $this->getMetadataFor($className);
126 }
128 return $metadata;
This order populates to SchemaTool::getSchemaFromMetadata(); If the base model is processed before it's descendants, everything is OK. Otherwise, it will complain about the table already exists.

= Fix =
128 return $this->loadedMetadata;


Comment created by @beberlei:

By what means is that a valid fix? Doesnt that just give another random order that happens to work for your cases now?


Comment created by @beberlei:



Issue was closed with resolution "Fixed"

@beberlei beberlei was assigned by doctrinebot Dec 6, 2015
@doctrinebot doctrinebot added this to the 2.0-RC1 milestone Dec 6, 2015
@doctrinebot doctrinebot closed this Dec 6, 2015
@doctrinebot doctrinebot added the Bug label Dec 7, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment