Code
Explorer
You are a developer and looking for Shopware projects?
Apply Now!
getKeyByManyToMany example
?Criteria
{
$field
=
$this
->
resolveDefinitionField
(
$resolverContext
->
getDefinition
(
)
,
$config
->
getStringValue
(
)
)
;
if
(
$field
=== null
)
{
return
null;
}
$key
= null;
$refDef
= null;
// resolve reverse side to fetch data afterwards
if
(
$field
instanceof ManyToManyAssociationField
)
{
$key
=
$this
->
getKeyByManyToMany
(
$field
)
;
$refDef
=
$field
->
getToManyReferenceDefinition
(
)
;
}
elseif
(
$field
instanceof OneToManyAssociationField
)
{
$key
=
$this
->
getKeyByOneToMany
(
$field
)
;
$refDef
=
$field
->
getReferenceDefinition
(
)
;
}
if
(
!
$key
|| !
$refDef
)
{
return
null;
}
$key
=
$refDef
->
getEntityName
(
)
. '.' .
$key
;