protected function createAccountForm(User $user, Broker $broker, BrokerAccountType $brokerAccountType = null) { $account = new Account(); $account->setUser($user); $account->setBroker($broker); if (!$brokerAccountType) { $brokerAccountType = $broker->getAccountTypes()->first(); } $account->setBrokerAccountType($brokerAccountType); return $this->createForm(new AccountFormType(), $account, array('broker' => $broker)); }