Returns a simple reference.

@param mixed      $key
@param Model|null $record
@return string
549683
protected function getSimpleRecordReference($key, Model $record = null)
    {
        return ucfirst($this->modelInformation->label())
             . ' #' . $key;
    }
259646
public function get($key) {
        if ($key != 'course') {
            return parent::get($key);
        }
        global $DB;
        if (empty($this->course)) {
            $this->course = $DB->get_record('course', array('id' => $this->cm->course));
        }
        return $this->course;
    }
211439
public function key($key = null)
    {
        if (!func_num_args()) {
            return $this->_key;
        }
        $this->_key = $key;
        return $this;
    }
291757
protected function extractPrimaryKeyValue($record, $returnAs)
    {
        $record = (object) $record;
        $values = [];
        foreach((array) $this->ORMParameters['primaryKey'] as $field) {
            $values[$field] = $record->$field;
        }
        switch($returnAs) {
            case 's':
                return implode('|', $values);
            break;
            case 'a':
                return $values;
            break;
        }   
    }
1334483
protected function lookupKey(
        int $key,
        RecordInterface $record,
        ContextualCommandInterface $command = null
    ) {
        $key = $this->key($key);

        if (!empty($command)) {
            $context = $command->getContext();
            if (!empty($context[$key])) {
                //Key value found in a context
                return $context[$key];
            }

            if ($key == $this->primaryColumnOf($record)) {
                return $command->primaryKey();
            }
        }

        //Fallback lookup in a record
        return $record->getField($key, null);
    }
508840
protected function detail($key)
    {
        $show = new Show($this->model->findOrFail($key));

        $show->key('Key');
        $show->value('Value');

        return $show;
    }
932520
public static function get($key = null)
    {
        if (null === self::$instance) {
            self::$instance = new self();
        }

        return $key ? self::$instance[$key] : self::$instance;
    }
1011127
private function findOrCreateRecord($key = null)
    {
        if ($key)
        {
            $record = ($this->usesSoftDeletes()) ? $this->withTrashed()->find($key) : $this->find($key);

            // Only return a record if we found one, otherwise we will end up sending a new record back below
            if ($record) return $record;
        }

        return new $this;
    }
132366
protected function transformRecord($record)
    {
        $columnNames = $this->columnManager->getRequestedColumnNames();
        $columnNames->transform(function ($item) use ($record) {
            return $this->getColumnValue($item, $record);
        });

        $datatableParameters = $this->getDatatableParameters($record);

        return array_merge($datatableParameters, $columnNames->toArray());
    }
1068652
protected function map(array $record)
    {
        $mapping = $this->getMapping();

        if (count($mapping) > 0) {
            $result = [];

            foreach ($mapping as $columnId => $data) {
                if (!empty($data[0])) {
                    if (!isset($result[$data[0]])) {
                        $result[$data[0]] = [];
                    }
                    $result[$data[0]][$data[1]] = $record[$columnId];
                } else {
                    $result[$data[1]] = $record[$columnId];
                }
            }

            return $result;
        } else {
            return $record;
        }
    }
314076
protected function loadModel($typeKey, array $record)
    {
        $this->mf->validateResourceTypes($typeKey, $record['type']);
        // Must use the type from the record to cover polymorphic models.
        $metadata = $this->getMetadataForType($record['type']);

        $model = new Model($metadata, $record['identifier'], $this, $record['properties']);
        $model->getState()->setLoaded();

        $this->dispatchLifecycleEvent(Events::postLoad, $model);

        $this->cache->push($model);
        return $model;
    }
1160197
private function processDoctrineLogRecord(array $record)
    {
        if (!isset($record['context']) || empty($record['context'])) {
            return $record;
        }

        $isDatabaseQueryContext = $this->arrayContainsOnlyNumericKeys($record['context']);
        if ($isDatabaseQueryContext) {
            $record['context'] = array('query params' => $record['context']);
        }

        return $record;
    }
1071257
public function getValueFromRecord(\Mmi\Orm\RecordRo $record)
    {
        if (!$this->isFieldInRecord()) {
            return '?';
        }
        if (strpos($this->getName(), '.')) {
            $table = explode('.', $this->getName());
            return $record->getJoined($table[0])->{$table[1]};
        }
        return $record->{$this->getName()};
    }
1106564
public function getRecordUrl($record)
    {
        if (isset($this->recordOnClick)) {
            return 'javascript:;';
        }

        if (!isset($this->recordUrl)) {
            return null;
        }

        $url = RouterHelper::replaceParameters($record, $this->recordUrl);
        return Backend::url($url);
    }
1332085
private function getKey ( $key = NULL ) {
        if ($key === NULL) {
            $key = $this->__keyName;
            return $this->getClassKey() . '_' . $this->$key;
        }
        return $this->getClassKey() . '_' . $key;
    }
857547
protected function getRecordState($record)
    {
        if ($this->isVersioned()) {
            // Check stage this record belongs to
            $stage = $record->getSourceQueryParam('Versioned.stage') ?: Versioned::get_stage();

            // Non-live stages are automatically non-public
            if ($stage !== Versioned::LIVE) {
                return AssetManipulationList::STATE_PROTECTED;
            }
        }

        // Check if canView permits anonymous viewers
        return Member::actAs(null, function () use ($record) {
            return $record->canView()
                ? AssetManipulationList::STATE_PUBLIC
                : AssetManipulationList::STATE_PROTECTED;
        });
    }
864150
public function getMeta(string $key, $default = null)
    {
        if ($this->hasMeta($key)) {
            return $this->getMetaRecord($key)->getAttribute('value');
        }

        return $default;
    }