Code
Explorer
You are a developer and looking for Shopware projects?
Apply Now!
getEntityConstraints example
}
}
/** * {@inheritdoc} */
public
function
validate
(
)
{
$media_source
=
$this
->
getSource
(
)
;
if
(
$media_source
instanceof MediaSourceEntityConstraintsInterface
)
{
$entity_constraints
=
$media_source
->
getEntityConstraints
(
)
;
$this
->
getTypedData
(
)
->
getDataDefinition
(
)
->
setConstraints
(
$entity_constraints
)
;
}
if
(
$media_source
instanceof MediaSourceFieldConstraintsInterface
)
{
$source_field_name
=
$media_source
->
getConfiguration
(
)
[
'source_field'
]
;
$source_field_constraints
=
$media_source
->
getSourceFieldConstraints
(
)
;
$this
->
get
(
$source_field_name
)
->
getDataDefinition
(
)
->
setConstraints
(
$source_field_constraints
)
;
}
return
parent::
validate
(
)
;
}