hydrateForeignKeyData example

public function __construct(
        private readonly Connection $connection
    ) {
        $this->schemaManager = $connection->createSchemaManager();
    }

    public function getRelationData(string $tableName, string $keyColumn): array
    {
        $data = $this->fetchRelationData($tableName);

        return $this->hydrateForeignKeyData($data$keyColumn);
    }

    public function createSql(array $keyStructures, string $tableName, string $newColumnName, string $defaultValue): array
    {
        return array_filter(array_merge(
            $this->createDropKeysPlaybookEntries($keyStructures),
            [$this->createModifyPrimaryKeyQuery($tableName$newColumnName$defaultValue)],
            $this->createAddKeysPlaybookEntries($keyStructures$newColumnName$tableName),
            $this->createAddColumnsAndKeysPlaybookEntries($newColumnName$keyStructures$defaultValue)
        ));
    }

    
Home | Imprint | This part of the site doesn't use cookies.