Generate subdef generation and return number of subdef
@param \record_adapter $record
@return int
353200
protected function generateRecordMissingSubdefs(\record_adapter $record)
    {
        $wanted_subdefs = $record->get_missing_subdefs();

        if (!empty($wanted_subdefs)) {
            $this->getSubdefGenerator()->generateSubdefs($record, $wanted_subdefs);

            foreach ($wanted_subdefs as $subdef) {
                $this->container['monolog']->addInfo("generate " . $subdef . " for record " . $record->getRecordId());
            }
        }

        return count($wanted_subdefs);
    }
818395
public function pushRecord(Record $record)
    {
        switch (true) {
            case $record->getType()->isStdout():
                $this->stdout .= $record->getContent();
                break;
            case $record->getType()->isStderr():
                $this->stderr .= $record->getContent();
                break;
            case $record->getType()->isEndRequest():
                return new Response($this->requestId, new StringReader($this->stdout), new StringReader($this->stderr));
                break;
            default:
                throw new \RuntimeException(sprintf('Unknown package type \'%d\'', $record->getType()));
                break;
        }
    }
1186548
protected function extractID($record)
    {
        // Normalize to string:
        $id = (string)$record->header->identifier;

        // Strip prefix if found:
        if (substr($id, 0, strlen($this->idPrefix)) == $this->idPrefix) {
            $id = substr($id, strlen($this->idPrefix));
        }

        // Apply regular expression matching:
        if (!empty($this->idSearch)) {
            $id = preg_replace($this->idSearch, $this->idReplace, $id);
        }

        // Return final value:
        return $id;
    }
1193131
@Override
	public Record nextRecord(Record record) {
		try {
			resultSet.next();
			ResultSetMetaData rsmd = resultSet.getMetaData();
			int column_count = rsmd.getColumnCount();
			record.setNumFields(column_count);

			for (int pos = 0; pos < column_count; pos++) {
				int type = rsmd.getColumnType(pos + 1);
				retrieveTypeAndFillRecord(pos, type, record);
			}
			return record;
		} catch (SQLException e) {
			throw new IllegalArgumentException("Couldn't read data:\t" + e.getMessage());
		} catch (NotTransformableSQLFieldException e) {
			throw new IllegalArgumentException("Couldn't read data because of unknown column sql-type:\t"
				+ e.getMessage());
		} catch (NullPointerException e) {
			throw new IllegalArgumentException("Couldn't access resultSet:\t" + e.getMessage());
		}
	}
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()};
    }
909032
public function updateRecord(GedcomRecord $record): string
    {
        $old_gedcom = $record->gedcom();

        $new_gedcom = preg_replace([
            '/(\n1.*@.+@.*(?:(?:\n[2-9].*)*))((?:\n1.*(?:\n[2-9].*)*)*\1)/',
            '/(\n2.*@.+@.*(?:(?:\n[3-9].*)*))((?:\n2.*(?:\n[3-9].*)*)*\1)/',
            '/(\n3.*@.+@.*(?:(?:\n[4-9].*)*))((?:\n3.*(?:\n[4-9].*)*)*\1)/',
        ], '$2', $old_gedcom);

        return $new_gedcom;
    }
509185
protected function getSampleForObject(DataObject $record) {
		$response = Director::test($record->Link());

		if($response->getStatusCode() === 200) {
			return $response->getBody();
		}

		return false;
	}
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;
        });
    }
65141
public function createResultRecord($record, $admin)
    {
        $resultRecord = array(
            'label' => (string)$record,
            'value' => (string)$record,
            'url' => ($admin ? $admin->generateObjectUrl('edit', $record) : null),
            'id' => ($admin ? $admin->id($record) : null)
        );
        return $resultRecord;
    }
506136
public function getTotalRecordCount()
    {

        if (!isset($this->rs)) {
            $this->doRs();
        }

        if (empty($this->recordCount)) {
            $this->countCriteria = clone $this->criteria;
            $this->countCriteria->setLimit(0);
            $this->countCriteria->setOffset(0);

            $this->recordCount = call_user_func(array($this->getPeerClass(), $this->getPeerCountMethod()), $this->countCriteria);
        }

        return $this->recordCount;
    }
1356917
public function __getTranslatableExtension(Record $record, $key)
    {
        /**
         * Check that translatable field exists in database.
         */
        if (!$this->getRepository()->getCache()->tableHasField(
            $this->getTable() . $this->getTranslatableTableSuffix(),
            $key
        )
        ) {
            return null;
        }

        if (!$record->relationExists('_translations')) {
            /**
             * Fetch translations.
             */
            $record->withTranslations();
        }

        /**
         * Translations were fetched by join.
         */
        foreach ($record->getRelation('_translations') as $translation) {
            if ($translation->keyExists($key)) {
                return $translation->{$key};
            }
        }
    }
844388
private function preParse($record)
    {
        $container = $this->preParse->handle(new ParserContainer($this, $record));

        if ($container instanceof ParserContainer) {
            return $container->getValue();
        }

        throw new \RuntimeException();
    }
166884
public function populate_from_record($record) {
        foreach ($this->fieldsindb as $field) {
            $this->$field = $record->$field;
        }
        $this->timemodified = $record->timemodified;
    }
687286
public static function insert($record)
    {
        $instance = new static();
        if ($fields = array_diff(array_keys($record), $instance->_di->modelsMetadata->getAttributes($instance))) {
            $instance->logger->debug(['insert `:1` table skip fields: :2', $instance->getSource(), array_values($fields)]);

            foreach ($fields as $field) {
                unset($record[$field]);
            }
        }

        $instance->getConnection($record)->insert($instance->getSource($record), $record);

        return 1;
    }
1354725
public function doesRecordNeedUpdate(GedcomRecord $record): bool
    {
        return $record instanceof Individual && $record->facts(['DEAT'])->isEmpty() && $record->isDead();
    }
734180
public function calcPageCount($records)
    {
        if(0 === $records % $this->count)
        {
            return $records / $this->count;
        }
        else
        {
            return ((int)($records / $this->count)) + 1;
        }
    }
1334317
protected static function _getRecordClass($record)
    {
        $static = get_called_class();

        if (!static::fieldExists('Class')) {
            return $static;
        }

        $columnName = static::_cn('Class');

        if (!empty($record[$columnName]) && is_subclass_of($record[$columnName], $static)) {
            return $record[$columnName];
        } else {
            return $static;
        }
    }