[英]Restler not accepting boolean false
在我的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;
}
然后我嘗試在我的PATCH方法中使用它:
/**
* 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]
指定的值無效
好的,發現Restler的Validator.php無法按照它的編寫方式解析@var屬性。 如果刪除|null
部分,則它按預期工作。 我已經向github網站提交了一個問題。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.