Nextras\Orm\Mapper\Dbal\StorageReflection\StorageReflection::getDefaultMappings PHP Метод

getDefaultMappings() защищенный Метод

protected getDefaultMappings ( )
    protected function getDefaultMappings()
    {
        $mappings = [self::TO_STORAGE => [], self::TO_ENTITY => []];
        $columns = array_keys($this->platform->getForeignKeys($this->storageName));
        foreach ($columns as $storageKey) {
            $entityKey = $this->formatEntityForeignKey($storageKey);
            $mappings[self::TO_ENTITY][$storageKey] = [$entityKey, null];
            $mappings[self::TO_STORAGE][$entityKey] = [$storageKey, null];
        }
        $storagePrimaryKey = $this->getStoragePrimaryKey();
        if (count($this->entityPrimaryKey) !== count($storagePrimaryKey)) {
            throw new InvalidStateException('Mismatch count of entity primary key (' . implode(', ', $this->entityPrimaryKey) . ') with storage primary key (' . implode(', ', $storagePrimaryKey) . ').');
        }
        if (count($storagePrimaryKey) === 1) {
            $entityKey = $this->entityPrimaryKey[0];
            $storageKey = $storagePrimaryKey[0];
            $mappings[self::TO_ENTITY][$storageKey] = [$entityKey, null];
            $mappings[self::TO_STORAGE][$entityKey] = [$storageKey, null];
        }
        return $mappings;
    }