diff --git a/Command/AbstractPropelCommand.php b/Command/AbstractPropelCommand.php index ba93c19..314844f 100644 --- a/Command/AbstractPropelCommand.php +++ b/Command/AbstractPropelCommand.php @@ -108,7 +108,7 @@ abstract class AbstractPropelCommand extends ContainerAwareCommand // build.properties $this->createBuildPropertiesFile($kernel, $this->cacheDir.'/build.properties'); - // buidtime-conf.xml + // buildtime-conf.xml $this->createBuildTimeFile($this->cacheDir.'/buildtime-conf.xml'); // Verbosity diff --git a/DataFixtures/Dumper/AbstractDataDumper.php b/DataFixtures/Dumper/AbstractDataDumper.php index 498c508..a892e7b 100644 --- a/DataFixtures/Dumper/AbstractDataDumper.php +++ b/DataFixtures/Dumper/AbstractDataDumper.php @@ -150,6 +150,11 @@ abstract class AbstractDataDumper extends AbstractDataHandler implements DataDum } } elseif (!$isPrimaryKey || ($isPrimaryKey && !$tableMap->isUseIdGenerator())) { + if (!empty($row[$col]) && 'ARRAY' === $column->getType()) { + $serialized = substr($row[$col], 2, -2); + $row[$col] = $serialized ? explode(' | ', $serialized) : array(); + } + // We did not want auto incremented primary keys $values[$col] = $row[$col]; } diff --git a/DataFixtures/Loader/AbstractDataLoader.php b/DataFixtures/Loader/AbstractDataLoader.php index 32435a4..bd24f5d 100644 --- a/DataFixtures/Loader/AbstractDataLoader.php +++ b/DataFixtures/Loader/AbstractDataLoader.php @@ -150,10 +150,19 @@ abstract class AbstractDataLoader extends AbstractDataHandler implements DataLoa } foreach ($data as $name => $value) { - if (is_array($value) && 's' == substr($name, -1)) { - // many to many relationship - $this->loadManyToMany($obj, substr($name, 0, -1), $value); - continue; + try { + if (is_array($value) && 's' === substr($name, -1)) { + // many to many relationship + $this->loadManyToMany($obj, substr($name, 0, -1), $value); + continue; + } + } catch (\PropelException $e) { + // Check whether this is actually an array stored in the object. + if ('Cannot fetch TableMap for undefined table: '.substr($name, 0, -1) === $e->getMessage()) { + if ('ARRAY' !== $tableMap->getColumn($name)->getType()) { + throw $e; + } + } } $isARealColumn = true; @@ -180,7 +189,7 @@ abstract class AbstractDataLoader extends AbstractDataHandler implements DataLoa $relatedTable = $this->dbMap->getTable($column->getRelatedTableName()); if (!isset($this->object_references[$relatedTable->getClassname().'_'.$value])) { throw new \InvalidArgumentException( - sprintf('The object "%s" from class "%s" is not defined in your data file.', $value, $relatedTable->getPhpName()) + sprintf('The object "%s" from class "%s" is not defined in your data file.', $value, $relatedTable->getClassname()) ); } $value = $this