Code
Explorer
You are a developer and looking for Shopware projects?
Apply Now!
SubmittedForm example
$car
=
new
\
stdClass
(
)
;
$car
->engine =
new
\
stdClass
(
)
;
$engine
=
new
\
stdClass
(
)
;
$engine
->brand = 'Rolls-Royce';
$propertyPath
=
new
PropertyPath
(
'engine'
)
;
$config
=
new
FormConfigBuilder
(
'name', \stdClass::
class
,
$this
->dispatcher
)
;
$config
->
setByReference
(
false
)
;
$config
->
setPropertyPath
(
$propertyPath
)
;
$config
->
setData
(
$engine
)
;
$form
=
new
SubmittedForm
(
$config
)
;
$this
->mapper->
mapFormsToData
(
new
\
ArrayIterator
(
[
$form
]
)
,
$car
)
;
self::
assertEquals
(
$engine
,
$car
->engine
)
;
self::
assertNotSame
(
$engine
,
$car
->engine
)
;
}
public
function
testMapFormsToDataWritesBackIfByReferenceButNoReference
(
)
{
$car
=
new
\
stdClass
(
)
;
$car
->engine =
new
\
stdClass
(
)
;