Merge pull request #175 from cedriclombardot/fix-data-dump-with-object
Fix data dump with object
This commit is contained in:
commit
abf90dd1fc
1
.gitignore
vendored
1
.gitignore
vendored
|
@ -2,3 +2,4 @@ Model/*/map
|
|||
Model/*/om
|
||||
vendor
|
||||
composer.lock
|
||||
composer.phar
|
||||
|
|
|
@ -156,6 +156,10 @@ abstract class AbstractDataDumper extends AbstractDataHandler implements DataDum
|
|||
// We did not want auto incremented primary keys
|
||||
$values[$col] = $row[$col];
|
||||
}
|
||||
|
||||
if ($column->getType() == \PropelColumnTypes::OBJECT) {
|
||||
$values[$col] = unserialize($row[$col]);
|
||||
}
|
||||
}
|
||||
|
||||
if (count($primaryKeys) > 1 || (count($primaryKeys) > 0 && count($foreignKeys) > 0)) {
|
||||
|
|
|
@ -24,10 +24,14 @@ class YamlDataDumperTest extends TestCase
|
|||
$author = new \Propel\PropelBundle\Tests\Fixtures\DataFixtures\Loader\BookAuthor();
|
||||
$author->setName('A famous one')->save($this->con);
|
||||
|
||||
$complementary = new \stdClass();
|
||||
$complementary->first_word_date = '2012-01-01';
|
||||
|
||||
$book = new \Propel\PropelBundle\Tests\Fixtures\DataFixtures\Loader\Book();
|
||||
$book
|
||||
->setName('An important one')
|
||||
->setAuthorId(1)
|
||||
->setComplementaryInfos($complementary)
|
||||
->save($this->con)
|
||||
;
|
||||
|
||||
|
@ -46,6 +50,7 @@ Propel\PropelBundle\Tests\Fixtures\DataFixtures\Loader\Book:
|
|||
id: '1'
|
||||
name: 'An important one'
|
||||
author_id: BookAuthor_1
|
||||
complementary_infos: !!php/object:O:8:"stdClass":1:{s:15:"first_word_date";s:10:"2012-01-01";}
|
||||
|
||||
YAML;
|
||||
|
||||
|
|
|
@ -42,6 +42,7 @@ class TestCase extends BaseTestCase
|
|||
<column name="name" type="varchar" size="255" />
|
||||
<column name="description" type="varchar" />
|
||||
<column name="author_id" type="integer" required="false" defaultValue="null" />
|
||||
<column name="complementary_infos" required="false" type="object" description="An object column" />
|
||||
|
||||
<foreign-key foreignTable="book_author" onDelete="RESTRICT" onUpdate="CASCADE">
|
||||
<reference local="author_id" foreign="id" />
|
||||
|
|
Loading…
Reference in a new issue