Skip to content

Commit 4362545

Browse files
committed
Merge pull request #118 from AlexeyDsov/primitiveHstoreExport
PrimitiveHstore::exportValue now return array instead of Hstore object
2 parents e58a5f7 + c153c34 commit 4362545

File tree

3 files changed

+20
-7
lines changed

3 files changed

+20
-7
lines changed

core/Form/Primitives/PrimitiveHstore.class.php

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,10 @@ public function getInnerForm()
4949

5050
public function getValue()
5151
{
52-
return $this->exportValue();
52+
if (!$this->value instanceof Form)
53+
return null;
54+
55+
return Hstore::make($this->value->export());
5356
}
5457

5558
/**
@@ -103,7 +106,9 @@ public function exportValue()
103106
if (!$this->value instanceof Form)
104107
return null;
105108

106-
return Hstore::make($this->value->export());
109+
return !$this->value->getErrors()
110+
? $this->value->export()
111+
: null;
107112
}
108113

109114
/**

doc/ChangeLog

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,12 @@
1-
2012-08-08 Artem A. Naumenko
1+
2012-08-10 Alexey S. Denisov
2+
3+
* core/Form/Primitives/PrimitiveHstore.class.php:
4+
PrimitiveHstore exportValue now return array|null instead Hstore object
25

3-
* core/DB/NoSQL/RedisNoSQL.class.php
6+
2012-08-08 Artem A. Naumenko
47

5-
added campability with old version of redis servers
8+
* core/DB/NoSQL/RedisNoSQL.class.php:
9+
added campability with old version of redis servers
610

711
2012-07-20 Alexey S. Denisov
812

test/core/PrimitiveHstoreTest.class.php

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,4 @@
11
<?php
2-
/* $Id$ */
3-
42
final class PrimitiveHstoreTest extends TestCase
53
{
64
protected static $scope =
@@ -47,6 +45,10 @@ public function testImport()
4745
$hstore->getList(),
4846
self::$scope['properties']
4947
);
48+
$this->assertEquals(
49+
$prm->exportValue(),
50+
self::$scope['properties']
51+
);
5052

5153
try {
5254
$hstore->get('NotFound');
@@ -81,6 +83,8 @@ public function testInvalidImport()
8183
)
8284
);
8385

86+
$this->assertNull($prm->exportValue());
87+
8488
$prm->clean();
8589
}
8690

0 commit comments

Comments
 (0)