コード例 #1
0
 /**
  * @Route("/profile", name="profile_index")
  */
 public function indexAction(Request $request)
 {
     $user = $this->getUser();
     $upgradeBusiness = $this->findBusiness('dashboard.upgrade.business');
     $profile = $user->getProfile();
     $isNew = false;
     if (!$profile) {
         $profile = new UserProfile($user);
         $isNew = true;
     } else {
         if (!$profile->getIsCompleted()) {
             $isNew = true;
         }
     }
     $profile_form = $this->createForm(ProfileType::class, $profile);
     $picture_form = $this->createForm(PictureType::class, $profile);
     if ($isNew) {
         return $this->render("UserBundle:Profile:required_form.html.twig", array('profile' => $profile, 'profile_form' => $profile_form->createView(), 'picture_form' => $picture_form->createView()));
     } else {
         $cardInfo = $upgradeBusiness->getCardInformation($user);
         $invoices = $upgradeBusiness->getInvoices($user);
         $account_form = $this->createForm(AccountType::class, $user);
         return $this->render("UserBundle:Profile:index.html.twig", array('profile' => $profile, 'profile_form' => $profile_form->createView(), 'account_form' => $account_form->createView(), 'picture_form' => $picture_form->createView(), 'card_info' => $cardInfo, 'invoices' => $invoices));
     }
 }
コード例 #2
0
 public function saveProfile(UserProfile $profile)
 {
     $profile->setIsCompleted(true);
     $this->saveData($profile);
 }