Code
Explorer
You are a developer and looking for Shopware projects?
Apply Now!
getAssociationName example
SQL;
if
(
$definition
->
isVersionAware
(
)
)
{
$resetTemplate
.= ' AND #table#.version_id = :version';
}
$bytes
=
array_map
(
fn
(
$id
)
=> Uuid::
fromHexToBytes
(
$id
)
,
$ids
)
;
/** @var ManyToManyIdField $field */
foreach
(
$fields
as
$field
)
{
/** @var ManyToManyAssociationField $association */
$association
=
$definition
->
getFields
(
)
->
get
(
$field
->
getAssociationName
(
)
)
;
if
(
!
$association
instanceof ManyToManyAssociationField
)
{
throw
new
\
RuntimeException
(
sprintf
(
'Can not find association by property name %s',
$field
->
getAssociationName
(
)
)
)
;
}
$parameters
=
[
'ids' =>
$bytes
]
;
$replacement
=
[
'#table#' => EntityDefinitionQueryHelper::
escape
(
$definition
->
getEntityName
(
)
)
,
'#storage_name#' => EntityDefinitionQueryHelper::
escape
(
$field
->
getStorageName
(
)
)
,
'#mapping_table#' => EntityDefinitionQueryHelper::
escape
(
$association
->
getMappingDefinition
(
)
->
getEntityName
(
)
)
,
'#reference_column#' => EntityDefinitionQueryHelper::
escape
(
$association
->
getMappingReferenceColumn
(
)
)
,