Example #1
0
 public function __construct(Customer $customer)
 {
     $this->id = $customer->getId();
     $this->email = $customer->getEmail();
     $this->username = $customer->getUsername();
     $this->firstname = $customer->getFirstname();
     $this->lastname = $customer->getLastname();
     $this->company = $customer->getCompany();
     $this->phone = new PhoneStruct($customer->getPhone());
 }
Example #2
0
 /**
  * 
  * @param string $email
  * @param string $username
  * @param string $firstname
  * @param string $lastname
  * @return Bxav\Bundle\UserBundle\Service\CustomerStruct
  */
 public function createCustomer($email, $username, $firstname, $lastname)
 {
     $customer = new Customer();
     $customer->setEmail($email);
     $customer->setUsername($username);
     $customer->setFirstname($firstname);
     $customer->setLastname($lastname);
     $customer->setUser($this->getCurrentUser());
     $this->getCurrentUser()->addCustomer($customer);
     $this->em->persist($customer);
     $this->em->persist($this->getCurrentUser());
     $this->em->flush();
     $return = new CustomerStruct($customer);
     return $return;
 }