You are a developer and looking for Shopware projects?
Apply Now!
formatFields example
if
(
!
empty
(
$prefix
)
&&
strpos
(
$table
,
$prefix
)
=== 0
)
{
$table
=
substr
(
$table
,
strlen
(
$prefix
)
)
;
}
if
(
!
$this
->db->
tableExists
(
$this
->prefixedTableName
)
)
{
throw
DataException::
forTableNotFound
(
$this
->prefixedTableName
)
;
}
$this
->tableName =
$table
;
$this
->fields =
$this
->
formatFields
(
$this
->db->
getFieldData
(
$table
)
)
;
$this
->keys =
array_merge
(
$this
->keys,
$this
->
formatKeys
(
$this
->db->
getIndexData
(
$table
)
)
)
;
// if primary key index exists twice then remove psuedo index name 'primary'.
$primaryIndexes
=
array_filter
(
$this
->keys,
static
fn
(
$index
)
=>
$index
[
'type'
]
=== 'primary'
)
;
if
(
!
empty
(
$primaryIndexes
)
&&
count
(
$primaryIndexes
)
> 1 &&
array_key_exists
(
'primary',
$this
->keys
)
)
{
unset
(
$this
->keys
[
'primary'
]
)
;
}
$this
->foreignKeys =
$this
->db->
getForeignKeyData
(
$table
)
;