Example #1
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;
 }