/**
  * @param Customer $object
  * @return \Thelia\Form\BaseForm
  */
 protected function hydrateObjectForm($object)
 {
     // Get default adress of the customer
     $address = $object->getDefaultAddress();
     // Prepare the data that will hydrate the form
     $data = array('id' => $object->getId(), 'firstname' => $object->getFirstname(), 'lastname' => $object->getLastname(), 'email' => $object->getEmail(), 'title' => $object->getTitleId(), 'discount' => $object->getDiscount(), 'reseller' => $object->getReseller());
     if ($address !== null) {
         $data['company'] = $address->getCompany();
         $data['address1'] = $address->getAddress1();
         $data['address2'] = $address->getAddress2();
         $data['address3'] = $address->getAddress3();
         $data['phone'] = $address->getPhone();
         $data['cellphone'] = $address->getCellphone();
         $data['zipcode'] = $address->getZipcode();
         $data['city'] = $address->getCity();
         $data['country'] = $address->getCountryId();
         $data['state'] = $address->getStateId();
     }
     // A loop is used in the template
     return $this->createForm(AdminForm::CUSTOMER_UPDATE, 'form', $data);
 }
 /**
  * @param Customer $customer
  * @return CustomerUpdateForm
  */
 protected function hydrateCustomerForm(Customer $customer)
 {
     // Get default adress of the customer
     $address = $customer->getDefaultAddress();
     // Prepare the data that will hydrate the form
     $data = array('id' => $customer->getId(), 'firstname' => $customer->getFirstname(), 'lastname' => $customer->getLastname(), 'email' => $customer->getEmail(), 'title' => $customer->getTitleId(), 'discount' => $customer->getDiscount(), 'reseller' => $customer->getReseller());
     if ($address !== null) {
         $data['company'] = $address->getCompany();
         $data['address1'] = $address->getAddress1();
         $data['address2'] = $address->getAddress2();
         $data['address3'] = $address->getAddress3();
         $data['phone'] = $address->getPhone();
         $data['cellphone'] = $address->getCellphone();
         $data['zipcode'] = $address->getZipcode();
         $data['city'] = $address->getCity();
         $data['country'] = $address->getCountryId();
     }
     // A loop is used in the template
     return new CustomerUpdateForm($this->getRequest(), 'form', $data);
 }