Return a list of all tuples attached to this dataobject
Note: Variants are excluded

@param DataObject $record to search
@return array
484371
protected function findAssets(DataObject $record)
    {
        // Search for dbfile instances
        $files = array();
        $fields = DataObject::getSchema()->fieldSpecs($record);
        foreach ($fields as $field => $db) {
            $fieldObj = $record->$field;
            if (!($fieldObj instanceof DBFile)) {
                continue;
            }

            // Omit variant and merge with set
            $next = $record->dbObject($field)->getValue();
            unset($next['Variant']);
            if ($next) {
                $files[] = $next;
            }
        }

        // De-dupe
        return array_map("unserialize", array_unique(array_map("serialize", $files)));
    }
340707
public function getUnmappedArray(DataObject $object)
    {
        $output = [];

        foreach ($this->mapping as $unmappedField => $mappedField) {
            if (strpos($mappedField, ':') !== false) {
                list($mappedField, $modifier) = explode(':', $mappedField);
            }

            $output[$unmappedField] = $object->{$mappedField};
        }

        return $output;
    }
1342808
public static function create_from_record($record) {
        $event = static::create([
            'objectid' => $record->id,
            'relateduserid' => $record->userid,
            'context' => \context_user::instance($record->userid),
            'other' => [
                'policyversionid' => $record->policyversionid,
                'note' => $record->note,
                'status' => $record->status,
            ],
        ]);
        $event->add_record_snapshot($event->objecttable, $record);
        return $event;
    }
683020
private function surnames(GedcomRecord $record): array
    {
        $gedcom = $record->gedcom();

        if (preg_match_all('/^(?:1 NAME|2 _MARNM) .*\/(.+)\//m', $gedcom, $match)) {
            return $match[1];
        }

        return [];
    }
1188759
public function findExistingObject($record)
    {
        // checking for existing records (only if not already found)
        foreach ($this->duplicateChecks as $fieldName => $duplicateCheck) {
            //plain duplicate checks on fields and relations
            if (is_string($duplicateCheck)) {
                $fieldName = $duplicateCheck;
                //If the dupilcate check is a dot notation, then convert to ID relation
                if (strpos($duplicateCheck, '.') !== false) {
                    list($relationName, $columnName) = explode('.', $duplicateCheck);
                    $fieldName = $relationName."ID";
                }
                //TODO: also convert plain relation names to include ID

                //skip current duplicate check if field value is empty
                if (!isset($record[$fieldName]) || empty($record[$fieldName])) {
                    continue;
                }
                $existingRecord = $this->getDataList()
                                    ->filter($fieldName, $record[$fieldName])
                                    ->first();
                if ($existingRecord) {
                    return $existingRecord;
                }
            }
            //callback duplicate checks
            elseif (
                is_array($duplicateCheck) &&
                isset($duplicateCheck['callback']) &&
                is_callable($duplicateCheck['callback'])
            ) {
                $callback = $duplicateCheck['callback'];
                if ($existingRecord = $callback($fieldName, $record)) {
                    return $existingRecord;
                }
            } else {
                user_error('BulkLoader::processRecord(): Wrong format for $duplicateChecks',
                    E_USER_WARNING
                );
            }
        }

        return false;
    }
187427
protected function formatSyncList(array $records)
    {
        $results = array();

        foreach ($records as $id => $attributes)
        {
            if ( ! is_array($attributes))
            {
                list($id, $attributes) = array($attributes, array());
            }

            $results[$id] = $attributes;
        }

        return $results;
    }
743168
protected function processRecord(array $record): array
    {
        if ($this->processors) {
            foreach ($this->processors as $processor) {
                $record = PhpHelper::call($processor, $record);
            }
        }

        return $record;
    }
1164646
public static function transform($record, $includes = [])
    {
        $model_name = class_basename(get_class($record));
        $transformer = sprintf('\App\Transformers\%sTransformer', $model_name);

        $fractal = new self();

        if ($includes) {
            $fractal->manager->parseIncludes($includes);
        }

        try {
            return $fractal->item($record, new $transformer, $model_name);
        } catch (\Exception $e) {
            //Transformer class doesn't exist
            return [];
        }
    }
1373973
protected function getNamedRelation(DataObjectInterface $record)
    {
        return $record->hasMethod($this->Name) ? $record->{$this->Name}() : null;
    }
317578
public function getAllRecords()
    {
        /* @var DataObject $recordType */
        $recordType = $this->getRecordType();
        $all = $recordType::get()->filterByCallBack(function (DataObject $obj) {
            return $obj->canView();
        });

        return new PaginatedList($all, $this->request);
    }
344664
public static function pairs($object)
    {
        $result = [];
        static::each($object, function ($item, $key) use (& $result) {
            $result[] = [$key, $item];
        });

        return $result;
    }
54928
protected function getLogRecord($record)
    {
        $prefix = $suffix = array();

        // first infos
        $date = $record['datetime']->format( $this->datetime_format );
        $prefix[] = '['.$date.']';
        if (!empty($record['ip']))
            $prefix[] = '[ip '.$record['ip'].']';
        if (!empty($record['pid']))
            $prefix[] = '[pid '.$record['pid'].']';
        $prefix[] = $record['level_name'].' :';

        // last infos
        if (!empty($record['context'])) {
            $suffix[] = '['.$this->writeArray($record['context']).']';
        }
        if (!empty($record['extra'])) {
            $suffix[] = '['.$this->writeArray($record['extra']).']';
        }

        return join(' ', $prefix).' '.preg_replace("/\n*$/", ' ', $record['message']).' '.join(' ', $suffix);
    }
981839
protected function getDocument($record)
    {
        $document = new Document();
        $document->setData($record);
        $document->setType($this->type);
        $document->setIndex($this->index);

        return $document;
    }
511406
public function format(array $record)
    {
        $formattedRecord = $this->formatter->format($record);

        if (is_array($formattedRecord)) {
            list($channel, $message, $backtrace, $loglevel) = $formattedRecord;

            return [
                $channel,
                $this->formatterPrefix . $message,
                $backtrace,
                $loglevel,
            ];
        }

        return $this->formatterPrefix . $formattedRecord;
    }
1371592
protected static function inLineArray(array $records)
    {

        $values = [];

        foreach ($records as $record)
            $values = array_merge($values, array_values($record));

        return $values;
    }
1044711
protected static function toMongoObjects($record)
    {
        if (!empty($record)) {
            foreach ($record as $key => $data) {
                if (!is_object($data)) {
                    if (is_string($data) && (static::DEFAULT_ID_FIELD == $key)) {
                        $record[$key] = static::idToMongoId($data);
                    } elseif (is_array($data)) {
                        if (1 === count($data)) {
                            // using typed definition, i.e. {"$date" : "2014-08-02T08:40:12.569Z" }
                            if (array_key_exists('$date', $data)) {
                                $temp = $data['$date'];
                                if (empty($temp)) {
                                    // empty means create with current time
                                    $record[$key] = new UTCDateTime(time() * 1000);
                                } elseif (is_string($temp)) {
                                    $record[$key] = new UTCDateTime(strtotime($temp) * 1000);
                                } elseif (is_int($temp)) {
                                    $record[$key] = new UTCDateTime($temp * 1000);
                                }
                            } elseif (isset($data['$id'])) {
                                $record[$key] = static::idToMongoId($data['$id']);
                            } elseif (isset($data['$oid'])) {
                                $record[$key] = static::idToMongoId($data['$oid']);
                            } else {
                                $record[$key] = static::toMongoObjects($data);
                            }
                        }
                    }
                }
            }
        }

        return $record;
    }
596368
public function format(array $record)
    {
        $record = parent::format($record);

        $record['tags'] = [];
        $record['custom_data'] = [];
        $record['timestamp'] = null;

        foreach (['extra', 'context'] as $source) {
            if (array_key_exists('tags', $record[$source]) && is_array($record[$source]['tags'])) {
                $record['tags'] = array_merge($record['tags'], $record[$source]['tags']);
            }
            if (array_key_exists('timestamp', $record[$source]) && is_numeric($record[$source]['timestamp'])) {
                $record['timestamp'] = $record[$source]['timestamp'];
            }
            unset($record[$source]['tags'], $record[$source]['timestamp']);
        }

        $record['custom_data'] = $record['extra'];
        $record['extra'] = [];
        foreach ($record['context'] as $key => $item) {
            if (!in_array($key, ['file', 'line', 'exception'])) {
                $record['custom_data'][$key] = $item;
                unset($record['context'][$key]);
            }
        }

        return $record;
    }