I have a form that is not directly related to a doctrine entity but some of his subforms are
public function buildForm(FormBuilderInterface $builder, array $options)
{
$builder
->add('Email','email')
->add('ShippingAddress',new AddressType($this->Order->getStore()))
->add('SameAddress','checkbox',array('required' => false))
->add('BillingAddress',new AddressType($this->Order->getStore()))
->setData(array('Email' => $this->Order->getEmail(),
'ShippingAddress' => $this->Order->getShippingAddress(),
'BillingAddress' => $this->Order->getBillingAddress()))
;
}
the first time I post the form
$billingAddress = $formstep1->get('BillingAddress')->getData();
returns the correct data from the fields and can be saved when I try to edit the form the Shipping and Billing forms return preseted data
but if i access to the field inside this forms I get the corrrect data
$formstep1->get('ShippingAddress')->get('LastNames')->getData());
Why is this happening?
Can't I set data in builForm and expect the form to bind data to this objects ?
Thanks