You are a developer and looking for Shopware projects?
Apply Now!
fetchRelationData example
private
readonly AbstractSchemaManager
$schemaManager
;
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
)
)
)
;