Permalink
Browse files

Fix yaml dumper for object columns

  • Loading branch information...
1 parent 4b98927 commit 51d91fc5b806cada15e5f73cf2312424ee01926f Anh Tuan Kieu committed Aug 20, 2012
@@ -156,6 +156,10 @@ protected function getDataAsArray()
// 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 @@ public function testYamlDump()
$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 @@ public function testYamlDump()
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 @@ protected function setUp()
<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" />

0 comments on commit 51d91fc

Please sign in to comment.