簡體   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