Symfony 2 – how to pass data to formBuilder?

You can give the object you want to use in the __construct() method. Eg : $form = $this ->get(‘form.factory’) ->create(new ApplyStepOneFormType($this->company, $this->ad), $applicant); In your form type : function __construct(\Your\Bundle\Entity\Company $company, \DYB\ConnectBundle\Entity\Ad $ad) { $this->company = $company; $this->ad = $ad; } And then in your form type in buildForm method : $company = $this->company; $builder->add(‘ad’, … Read more