Code
Explorer
You are a developer and looking for Shopware projects?
Apply Now!
convertPayload example
Feature::
deprecatedClassMessage
(
__CLASS__, 'v6.6.0.0'
)
)
;
$toOneFields
=
$definition
->
getFields
(
)
->
filter
(
fn
(
Field
$field
)
=>
$field
instanceof OneToOneAssociationField ||
$field
instanceof ManyToOneAssociationField
)
;
/** @var OneToOneAssociationField|OneToManyAssociationField $field */
foreach
(
$toOneFields
as
$field
)
{
if
(
!\
array_key_exists
(
$field
->
getPropertyName
(
)
,
$payload
)
|| !\
is_array
(
$payload
[
$field
->
getPropertyName
(
)
]
)
)
{
continue
;
}
$payload
[
$field
->
getPropertyName
(
)
]
=
$this
->
convertPayload
(
$field
->
getReferenceDefinition
(
)
,
$payload
[
$field
->
getPropertyName
(
)
]
,
$conversionException
,
$pointer
. '/' .
$field
->
getPropertyName
(
)
)
;
}
$toManyFields
=
$definition
->
getFields
(
)
->
filter
(
fn
(
Field
$field
)
=>
$field
instanceof OneToManyAssociationField ||
$field
instanceof ManyToManyAssociationField
)
;
/** @var OneToManyAssociationField|ManyToManyAssociationField $field */
foreach
(
$toManyFields
as
$field
)
{