Skip to content

Commit b6acc13

Browse files
committed
fixed nested arrays, associations, test
1 parent 2e72ca8 commit b6acc13

File tree

3 files changed

+13
-2
lines changed

3 files changed

+13
-2
lines changed

src/CloudCMS.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ public function request($method, $uri, $params = array(), $data = array())
8181
else
8282
{
8383
$request = $this->provider->getAuthenticatedRequest($method, $url, $this->token, [
84-
"body" => json_encode($data, JSON_FORCE_OBJECT)
84+
"body" => json_encode((object)$data)
8585
]);
8686
}
8787

src/Node.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ public function associate($other_node, $association, $association_directionality
3737

3838
// if $association is a string assume it is the type of the association to create
3939
// if an object assume it is the complete set of properties for the assocation node to create
40-
if (is_a($association, 'String')) {
40+
if (is_string($association)) {
4141
$association = array("_type" => $association);
4242
}
4343

tests/NodeTest.php

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,17 @@ public function testNodeCrud()
3838
$this->assertNull($nodeRead);
3939
}
4040

41+
public function testNodeNestedArray()
42+
{
43+
$nodeObj = array(
44+
"title" => "MyNode",
45+
"nested" => array('1',' 2', '3')
46+
);
47+
$node = $this->branch->createNode($nodeObj);
48+
49+
$this->assertEquals(3, count($node->data["nested"]));
50+
}
51+
4152
public function testNodeQueryAndFind()
4253
{
4354
$nodeObj1 = array(

0 commit comments

Comments
 (0)