You are here

public static function Data::merge in JSON:API 8.2

Returns a new Data object containing the entities of $this and $other.

Parameters

\Drupal\jsonapi\JsonApiResource\Data $a: A Data object object to be merged.

\Drupal\jsonapi\JsonApiResource\Data $b: A Data object to be merged.

Return value

\Drupal\jsonapi\JsonApiResource\Data A new merged Data object.

File

src/JsonApiResource/Data.php, line 154

Class

Data
Represents the `data` and `included` objects of a top-level object.

Namespace

Drupal\jsonapi\JsonApiResource

Code

public static function merge(Data $a, Data $b) {
  return new static(array_merge($a
    ->toArray(), $b
    ->toArray()));
}