Symfony2 forms – structured data to flat entity

Is it possible to map by SF2 form for ex. this data

[
   'name' => 'XL',
   'dimensions' => [
       'width' => 50,
       'height' => 20,
       'length' => 20,
    ]
] 

to the entity

Box[name, width, height, length]

Something like:

$builde->add('dimensions.width', 'text', [
    'property_path' => 'width'
])

Thanks!


Source: forms

Leave a Reply