Ejemplo n.º 1
0
 /**
  * @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);
 }
Ejemplo n.º 2
0
 /**
  * Filter the query by a related \Thelia\Model\Customer object
  *
  * @param \Thelia\Model\Customer|ObjectCollection $customer  the related object to use as filter
  * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
  *
  * @return ChildCustomerTitleQuery The current query, for fluid interface
  */
 public function filterByCustomer($customer, $comparison = null)
 {
     if ($customer instanceof \Thelia\Model\Customer) {
         return $this->addUsingAlias(CustomerTitleTableMap::ID, $customer->getTitleId(), $comparison);
     } elseif ($customer instanceof ObjectCollection) {
         return $this->useCustomerQuery()->filterByPrimaryKeys($customer->getPrimaryKeys())->endUse();
     } else {
         throw new PropelException('filterByCustomer() only accepts arguments of type \\Thelia\\Model\\Customer or Collection');
     }
 }
 /**
  * @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);
 }