src/Mapper/Entry.php
private function mergePreviousFields(array $fields, ResourceClass $entry): array
    {
        // Entry fields have private access, so we use this trick to fetch them.
        // https://ocramius.github.io/blog/accessing-private-php-class-members-without-reflection/
        $extractor = \Closure::bind(function (ResourceClass $entry) {
            return $entry->fields;
        }, null, $entry);
        $currentFields = $extractor($entry);

        foreach ($fields as $name => $values) {
            if (!isset($currentFields[$name])) {
                $currentFields[$name] = [];
            }

            foreach ($values as $locale => $value) {
                $currentFields[$name][$locale] = $value;
            }
        }

        return $currentFields;
    }
private function mergePreviousFields(array $fields, ResourceClass $entry): array
    {
        // Entry fields have private access, so we use this trick to fetch them.
        // https://ocramius.github.io/blog/accessing-private-php-class-members-without-reflection/
        $extractor = \Closure::bind(function (ResourceClass $entry) {
            return $entry->fields;
        }, null, $entry);
        $currentFields = $extractor($entry);

        foreach ($fields as $name => $values) {
            if (!isset($currentFields[$name])) {
                $currentFields[$name] = [];
            }

            foreach ($values as $locale => $value) {
                $currentFields[$name][$locale] = $value;
            }
        }

        return $currentFields;
    }
If a previous entry is given, this methods will combine all values from the $fields
array an those in the already built entry.
This is done so in the event of partial resource building (i.e. after having queried
the API using the "select" operator), the resulting object is increasingly updated,
therefore the new object will contain the biggest set of old plus new fields.

@param array         $fields The field values that have been returned by the API
@param ResourceClass $entry  The previous entry object that was already built, if present

@return array