src/Resources/BaseDbTableResource.php
protected static function cleanRecord($record = [], $include = '*', $id_field = null)
    {
        if (ApiOptions::FIELDS_ALL !== $include) {
            if (!empty($id_field) && !is_array($id_field)) {
                $id_field = array_map('trim', explode(',', trim($id_field, ',')));
            }
            $id_field = (array)$id_field;

            if (!empty($include) && !is_array($include)) {
                $include = array_map('trim', explode(',', trim($include, ',')));
            }
            $include = (array)$include;

            // make sure we always include identifier fields
            foreach ($id_field as $id) {
                if (false === array_search($id, $include)) {
                    $include[] = $id;
                }
            }

            // glean desired fields from record
            $out = [];
            foreach ($include as $key) {
                $out[$key] = array_get($record, $key);
            }

            return $out;
        }

        return $record;
    }
protected static function cleanRecord($record = [], $include = '*', $id_field = null)
    {
        if (ApiOptions::FIELDS_ALL !== $include) {
            if (!empty($id_field) && !is_array($id_field)) {
                $id_field = array_map('trim', explode(',', trim($id_field, ',')));
            }
            $id_field = (array)$id_field;

            if (!empty($include) && !is_array($include)) {
                $include = array_map('trim', explode(',', trim($include, ',')));
            }
            $include = (array)$include;

            // make sure we always include identifier fields
            foreach ($id_field as $id) {
                if (false === array_search($id, $include)) {
                    $include[] = $id;
                }
            }

            // glean desired fields from record
            $out = [];
            foreach ($include as $key) {
                $out[$key] = array_get($record, $key);
            }

            return $out;
        }

        return $record;
    }
@param array        $record
@param string|array $include  List of keys to include in the output record
@param string|array $id_field Single or list of identifier fields

@return array