Skip to content

Commit

Permalink
Merge pull request #149 from juvenn/master
Browse files Browse the repository at this point in the history
修复 beforeSave 没有正确返回对象的 bug
  • Loading branch information
juvenn authored Apr 13, 2017
2 parents 1047caa + 4eab60c commit f1c9219
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 4 deletions.
6 changes: 6 additions & 0 deletions Changelog.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,10 @@

0.5.6 发布日期:2017-04-13
----

* 修复: 用户定义的 class hook 不需要返回对象,
而是由中间件来返回被修改的对象

0.5.5 发布日期:2017-04-12
----

Expand Down
2 changes: 1 addition & 1 deletion src/LeanCloud/Client.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ class Client {
/**
* Client version
*/
const VERSION = '0.5.5';
const VERSION = '0.5.6';

/**
* API Endpoints for Regions
Expand Down
3 changes: 1 addition & 2 deletions src/LeanCloud/Engine/LeanEngine.php
Original file line number Diff line number Diff line change
Expand Up @@ -522,9 +522,8 @@ private function dispatchHook($className, $hookName, $body) {
} else if (strpos($hookName, "after") === 0) {
$this->renderJSON(array("result" => "ok"));
} else {
$outObj = $result;
// Encode result object to type-less literal JSON
$this->renderJSON($outObj->toJSON());
$this->renderJSON($obj->toJSON());
}
}

Expand Down
1 change: 0 additions & 1 deletion test/engine/index.php
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,6 @@

Cloud::beforeSave("TestObject", function($obj, $user) {
$obj->set("__testKey", 42);
return $obj;
});

Cloud::afterSave("TestObject", function($obj, $user) {
Expand Down

0 comments on commit f1c9219

Please sign in to comment.