繁体   English   中英

Restler不需要必需的属性

[英]Restler not requiring required properties

我的对象类和API类都有这个。 我可以在不发送task_list_iddisplay_order情况task_list_id打电话。 只要我只是传递title它就会调用该方法。

class BaseTaskObj
{   
  /// @var int    $task_list_id   The SQL ident of the Task List to use for the Task. {@min 1}{@required true}
  public $task_list_id;
}

class PostTaskObj extends BaseTaskObj
{
  /// @var int    $assigned_id    The SQL ident of the Person who this task is assigned to {@min 1}{@required false}
  public $assigned_id;
}

class MyTaskAPI {
  /**
   * Creates a new Task associated with an existing task list.
   *
   * @param PostTaskObj $info The details of the Task object to create. {@required title, display_order}
   *
   * @status 201
   *
   * @return int The SQL ident of the newly created Task
   */
   function post(PostTaskObj $info) {
   }  
}

task_list_idassigned_id目前还没有有效的PHPDoc的意见。 它们也没有任何赋值。 这使它们成为api调用所需的参数。

但是然后您有了{@required title, display_order} ,它会用无效的参数覆盖所需的列表,从而使它们不是必需的

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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