Пример #1
0
 private function createClientUser(array $data, User $riaUser)
 {
     $clientUser = new User();
     $clientUser->setUsername($data['username']);
     $clientUser->setEmail($data['username']);
     $clientUser->setPlainPassword($data['password']);
     $clientUser->setEnabled(true);
     $clientUser->setRoles(array('ROLE_CLIENT'));
     $clientUserProfile = new Profile();
     $clientUserProfile->setUser($clientUser);
     $clientUserProfile->setRia($riaUser);
     $clientUserProfile->setFirstName($data['first_name']);
     $clientUserProfile->setLastName($data['last_name']);
     $clientUserProfile->setState($this->getReference('state-' . $data['state']));
     $clientUserProfile->setStreet($data['street']);
     $clientUserProfile->setCity($data['city']);
     $clientUserProfile->setZip($data['zip']);
     $clientUserProfile->setBirthDate(new \DateTime($data['birth_date']));
     $clientUserProfile->setPhoneNumber($data['phone_number']);
     $clientUserProfile->setMaritalStatus($data['marital_status']);
     $clientUserProfile->setAnnualIncome($data['annual_income']);
     $clientUserProfile->setEstimatedIncomeTax($data['estimated_income_tax']);
     $clientUserProfile->setLiquidNetWorth($data['liquid_net_worth']);
     $clientUserProfile->setEmploymentType($data['employment_type']);
     $clientUserProfile->setClientAccountManaged($data['client_account_managed']);
     $clientUserProfile->setRegistrationStep($data['registration_step']);
     $clientSettings = new ClientSettings();
     $clientSettings->setStopTlhValue($data['stop_tlh_value']);
     $clientUser->setClientSettings($clientSettings);
     $clientSettings->setClient($clientUser);
     //$clientUserProfile->setSuggestedPortfolio($this->getReference('cec-ria-model-' . $data['suggested_portfolio_index']));
     if (isset($data['client_status'])) {
         $clientUserProfile->setClientStatus($data['client_status']);
     }
     $clientUser->setProfile($clientUserProfile);
     if (isset($data['created'])) {
         $createdAt = new \DateTime($data['created']);
         $clientUser->setCreated($createdAt);
     }
     if (isset($data['paymentMethod'])) {
         $clientUser->getProfile()->setPaymentMethod($data['paymentMethod']);
     }
     return $clientUser;
 }