Example #1
0
 public function save($forceOperation = null)
 {
     parent::save($forceOperation);
     $user = $this->user->get();
     $user->load();
     if (!$user->defaultBillingAddress->get() || $user->defaultBillingAddress->get() === $this) {
         $user->defaultBillingAddress->set($this);
         $user->defaultBillingAddress->setAsModified();
         $user->save();
     }
 }
Example #2
0
 private function editAddress(UserAddressType $addressType)
 {
     $this->addAccountBreadcrumb();
     $this->addAddressBreadcrumb();
     $form = $this->buildAddressForm();
     $address = $addressType->userAddress->get();
     $form->setData($address->toArray());
     $form->set('country', $address->countryID->get());
     $form->set('state_text', $address->stateName->get());
     if ($address->state->get()) {
         $form->set('state_select', $address->state->get()->getID());
     }
     $response = new ActionResponse();
     $response->set('form', $form);
     $response->set('return', $this->request->get('return'));
     $response->set('countries', $this->getCountryList($form));
     $response->set('states', $this->getStateList($form->get('country')));
     $response->set('address', $address->toArray());
     $response->set('addressType', $addressType->toArray());
     $address->getSpecification()->setFormResponse($response, $form);
     return $response;
 }