I`m use Symfony 2.3 and propel. I have type form ClientType, and the type is declared in it сlient_profile
class ClientType extends BaseClientType
{
protected $options = array(
'label' => false,
'data_class' => 'Artsofte\ClientsBundle\Model\Client',
'name' => 'client_form'
);
public function buildForm(FormBuilderInterface $builder, array $options){
$builder
->add('сlient_profile', 'client_profile', array(
'label' => FALSE
))
->add(...)
;
}
}
Type form сlient_profile create on class СlientProfileType
class СlientProfileType extends BaseСlientProfileType{
protected $options = array(
'data_class' => 'Artsofte\DeveloperClientsBundle\Model\СlientProfile',
'name' => 'Сlient_profile'
);
public function buildForm(FormBuilderInterface $builder, array $options){
var_dump($builder->getData());
$builder
->add('name', 'text', array(
'label' => 'Name client',
'attr' => array(
'placeholder' => 'Name client'. $builder->getData()->getName()
))
->add(..............);
}
var_dump($builder->getData()); - return is null.
How do I fill in $builder->getData() in the form type client_profile, or how else can I transfer data from the client_profile model to the form type client_profile?
in class ClientType add option clientProfile. This option add - data model getData()
but not decided why in class СlientProfileType
$builder->getData()is null.