LeanMapper\Repository::getIdValue PHP Метод

getIdValue() приватный Метод

private getIdValue ( Entity $entity ) : mixed
$entity Entity
Результат mixed
    private function getIdValue(Entity $entity)
    {
        $table = $this->getTable();
        do {
            $primaryKey = $this->mapper->getPrimaryKey($table);
            $idField = $this->mapper->getEntityField($table, $primaryKey);
            $value = $entity->{$idField};
            if (!$value instanceof Entity) {
                return $value;
            }
            $entity = $value;
            $table = $this->mapper->getTable(get_class($entity));
        } while (true);
    }