From c153c34ea798ea810a60351f7ae0e652adb4a60a Mon Sep 17 00:00:00 2001 From: AlexeyDsov Date: Wed, 18 Jul 2012 18:42:26 +0400 Subject: [PATCH] PrimitiveHstore return in exportValue array, not Hstore object --- core/Form/Primitives/PrimitiveHstore.class.php | 9 +++++++-- doc/ChangeLog | 10 +++++++--- test/core/PrimitiveHstoreTest.class.php | 8 ++++++-- 3 files changed, 20 insertions(+), 7 deletions(-) diff --git a/core/Form/Primitives/PrimitiveHstore.class.php b/core/Form/Primitives/PrimitiveHstore.class.php index 1b05b48583..47744a5f5d 100644 --- a/core/Form/Primitives/PrimitiveHstore.class.php +++ b/core/Form/Primitives/PrimitiveHstore.class.php @@ -49,7 +49,10 @@ public function getInnerForm() public function getValue() { - return $this->exportValue(); + if (!$this->value instanceof Form) + return null; + + return Hstore::make($this->value->export()); } /** @@ -103,7 +106,9 @@ public function exportValue() if (!$this->value instanceof Form) return null; - return Hstore::make($this->value->export()); + return !$this->value->getErrors() + ? $this->value->export() + : null; } /** diff --git a/doc/ChangeLog b/doc/ChangeLog index 53c19d9960..6b93e57a8f 100644 --- a/doc/ChangeLog +++ b/doc/ChangeLog @@ -1,8 +1,12 @@ -2012-08-08 Artem A. Naumenko +2012-08-10 Alexey S. Denisov + + * core/Form/Primitives/PrimitiveHstore.class.php: + PrimitiveHstore exportValue now return array|null instead Hstore object - * core/DB/NoSQL/RedisNoSQL.class.php +2012-08-08 Artem A. Naumenko - added campability with old version of redis servers + * core/DB/NoSQL/RedisNoSQL.class.php: + added campability with old version of redis servers 2012-07-20 Alexey S. Denisov diff --git a/test/core/PrimitiveHstoreTest.class.php b/test/core/PrimitiveHstoreTest.class.php index 032aa6138c..47da385dce 100644 --- a/test/core/PrimitiveHstoreTest.class.php +++ b/test/core/PrimitiveHstoreTest.class.php @@ -1,6 +1,4 @@ getList(), self::$scope['properties'] ); + $this->assertEquals( + $prm->exportValue(), + self::$scope['properties'] + ); try { $hstore->get('NotFound'); @@ -81,6 +83,8 @@ public function testInvalidImport() ) ); + $this->assertNull($prm->exportValue()); + $prm->clean(); }