设置了在那里查看信息呢?
我自己找感觉问题出现在这里
Query.php的find方法
$resp = Client::get("/classes/{$this->getClassName()}", $params);
$objects = array();
forEach($resp["results"] as $props) {
$obj = Object::create(
*$this->getClassName()*
=====================
);
$obj->mergeAfterFetch($props);
$objects[] = $obj;
}
return $objects;
下边是find方法里的$this
object(LeanCloud\Query)#13 (8) {
["className":"LeanCloud\Query":private]=>
string(5) "goods"
["select":"LeanCloud\Query":private]=>
array(0) {
}
["include":"LeanCloud\Query":private]=>
array(0) {
}
["limit":"LeanCloud\Query":private]=>
int(-1)
["skip":"LeanCloud\Query":private]=>
int(0)
["order":"LeanCloud\Query":private]=>
array(0) {
}
["extraOption":"LeanCloud\Query":private]=>
array(1) {
["redirectClassNameForKey"]=>
string(9) "goodsAttr"
}
["where"]=>
array(1) {
["$relatedTo"]=>
array(2) {
["key"]=>
string(9) "goodsAttr"
["object"]=>
array(3) {
["__type"]=>
string(7) "Pointer"
["className"]=>
string(5) "goods"
["objectId"]=>
string(24) "590197de61ff4b00668a29a5"
}
}
}
}
返回的响应是这样的
array(2) {
["results"]=>
array(1) {
[0]=>
array(13) {
["updatedAt"]=>
string(24) "2017-05-05T03:58:26.678Z"
["isDefault"]=>
int(0)
["content"]=>
string(6) "收到"
["objectId"]=>
string(24) "5909363c61ff4b0066ebcea4"
["createdAt"]=>
string(24) "2017-05-03T01:45:32.633Z"
["isValid"]=>
int(1)
["currency"]=>
array(3) {
["__type"]=>
string(7) "Pointer"
["className"]=>
string(12) "lan_currency"
["objectId"]=>
string(24) "58bb7a201b69e6006b1daee2"
}
["originalPrice"]=>
int(0)
["language"]=>
array(3) {
["__type"]=>
string(7) "Pointer"
["className"]=>
string(12) "lan_language"
["objectId"]=>
string(24) "58bd24eb570c35006c6905f9"
}
["price"]=>
int(10)
["sort"]=>
int(1)
["goodsValid"]=>
int(0)
["stock"]=>
int(10000)
}
}
["className"]=>
string(15) "goods_attribute"
}
可以看出Relation返回时sdk创建的对象classname为goods 而不是goods_attribute