Code
Explorer
You are a developer and looking for Shopware projects?
Apply Now!
MappingRule example
$scope
=
$scope
->
get
(
$it
->
current
(
)
)
;
$it
->
next
(
)
;
}
}
// Follow dot rules until we have the final target
$mapping
=
$scope
->
getConfig
(
)
->
getOption
(
'error_mapping'
)
;
while
(
$this
->
acceptsErrors
(
$scope
)
&&
isset
(
$mapping
[
'.'
]
)
)
{
$dotRule
=
new
MappingRule
(
$scope
, '.',
$mapping
[
'.'
]
)
;
$scope
=
$dotRule
->
getTarget
(
)
;
$mapping
=
$scope
->
getConfig
(
)
->
getOption
(
'error_mapping'
)
;
}
// Only add the error if the form is synchronized
if
(
$this
->
acceptsErrors
(
$scope
)
)
{
if
(
$violation
->
getConstraint
(
)
instanceof File &&
(string)
\UPLOAD_ERR_INI_SIZE ===
$violation
->
getCode
(
)
)
{
$errorsTarget
=
$scope
;
while
(
null !==
$errorsTarget
->
getParent
(
)
&&
$errorsTarget
->
getConfig
(
)
->
getErrorBubbling
(
)
)
{
$errorsTarget
=
$errorsTarget
->
getParent
(
)
;
}