在Restler API类中,我有一个像这样定义的对象(有很多其他参数)
class PatchTaskObj extends TaskObj {
/**
* @var bool|null Whether or not this Task should be pinned to the top of the list {@required false}
*/
public $pinned = null;
}然后我尝试在我的修补程序方法中使用它:
/**
* Updates an existing Task record.
*
* @param int $id The SQL ident of the task you wish to update. {@min 1} {@from path}
* @param PatchTaskObj $info The properties of the Task to update.
*
* @throws RestException 412 Thrown if at least one update isn't passed in.
*
* @status 204
*/
function patch($id, PatchTaskObj $info)如果我将true传递给pinned属性,它可以正常工作,但如果我传递false,则会收到来自Restler的400个消息:
错误请求:为
info[pinned]指定的无效值
发布于 2017-02-12 20:29:00
好的,发现Restler的Validator.php没有按照编写的方式解析@var属性。如果您删除了|null部件,那么它将按预期的方式工作。我已经向github网站提交了一个问题。
https://stackoverflow.com/questions/42128355
复制相似问题