繁体   English   中英

Restler不接受布尔值false

[英]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.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM