propelorm/PropelBundle — Issue #94: YAML Dumper exports data in wrong order
Author: tacman
Created: 2012-01-07 16:21:18+00:00
State: open

Records with foreign keys need to be exported after their related data is loaded. The logic in the fixOrderingOfForeignKeyData method of AbstractDataDumper.php has a bug.

foreach ($tableMap->getColumns() as $column) {
if ($column->isForeignKey()) {
$relatedTable = $this->dbMap->getTable($column->getRelatedTableName());
$relatedTablePos = array_search($relatedTable->getPhpName(), $classes);

getPhpName returns a string like 'Event', but $classes contains an array of the full class name, e.g. Acme\StoreBundle\Model\Event, so it will never reorder.

I think the call should be to something like $relatedTable->getClassName() or getModelClassName() or something that returns the full namespace, but I'm not sure what that is.