From 4b98927572e0ee8b6213afe013eb3f25e55afba7 Mon Sep 17 00:00:00 2001 From: Anh Tuan Kieu Date: Mon, 20 Aug 2012 17:04:18 +0200 Subject: [PATCH 1/2] Ignore composer.phar --- .gitignore | 1 + 1 file changed, 1 insertion(+) diff --git a/.gitignore b/.gitignore index c52f460..d31890c 100644 --- a/.gitignore +++ b/.gitignore @@ -2,3 +2,4 @@ Model/*/map Model/*/om vendor composer.lock +composer.phar From 51d91fc5b806cada15e5f73cf2312424ee01926f Mon Sep 17 00:00:00 2001 From: Anh Tuan Kieu Date: Mon, 20 Aug 2012 17:06:38 +0200 Subject: [PATCH 2/2] Fix yaml dumper for object columns --- DataFixtures/Dumper/AbstractDataDumper.php | 4 ++++ Tests/DataFixtures/Dumper/YamlDataDumperTest.php | 5 +++++ Tests/DataFixtures/TestCase.php | 1 + 3 files changed, 10 insertions(+) diff --git a/DataFixtures/Dumper/AbstractDataDumper.php b/DataFixtures/Dumper/AbstractDataDumper.php index 2eb2ab8..192cc80 100644 --- a/DataFixtures/Dumper/AbstractDataDumper.php +++ b/DataFixtures/Dumper/AbstractDataDumper.php @@ -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)) { diff --git a/Tests/DataFixtures/Dumper/YamlDataDumperTest.php b/Tests/DataFixtures/Dumper/YamlDataDumperTest.php index 4803c84..506051c 100644 --- a/Tests/DataFixtures/Dumper/YamlDataDumperTest.php +++ b/Tests/DataFixtures/Dumper/YamlDataDumperTest.php @@ -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; diff --git a/Tests/DataFixtures/TestCase.php b/Tests/DataFixtures/TestCase.php index 3637cf9..06017d8 100644 --- a/Tests/DataFixtures/TestCase.php +++ b/Tests/DataFixtures/TestCase.php @@ -42,6 +42,7 @@ class TestCase extends BaseTestCase +