Back to OnGetApiFields class

Method addFields

public void
addFields
(array $fields)
Allows the user to add names of properties that will be interpreted as relations Note that if there is an existing data property it will also be displayed as well as the relation due to the internal implementation (this behaviour is not part of this API however and should not be guaranteed)
Parameters
  • string[] $fields The array of additional fields to add to the data of the attribute
Returns
  • void

Method addFields - Source code

/**
 * Allows the user to add names of properties that will be interpreted as relations
 * Note that if there is an existing data property it will also be displayed as well
 * as the relation due to the internal implementation (this behaviour is not part of this API
 * however and should not be guaranteed)
 *
 * @param   string[]  $fields  The array of additional fields to add to the data of the attribute
 *
 * @return  void
 */
public function addFields(array $fields) : void
{
    $this->extraAttributes = array_merge($this->extraAttributes, $fields);
}