mirror of
https://github.com/doctrine/orm.git
synced 2026-03-23 22:42:18 +01:00
DDC-868: ORM:Schema-tool:create failure -- the result depends on xml files enumeration order of RecursiveDirectoryIterator in context of SINGLE_TABLE inherantence #1077
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @doctrinebot on GitHub (Nov 8, 2010).
Originally assigned to: @beberlei on GitHub.
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 =
attached
= 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 }
127
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 =
ClassMetaFactory.php
128 return $this->loadedMetadata;
@doctrinebot commented on GitHub (Nov 9, 2010):
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?
@doctrinebot commented on GitHub (Nov 9, 2010):
Comment created by @beberlei:
Fixed
@doctrinebot commented on GitHub (Nov 9, 2010):
Issue was closed with resolution "Fixed"
@doctrinebot commented on GitHub (Dec 13, 2015):
Imported 3 attachments from Jira into https://gist.github.com/268603dcd05c7873ae21