/**
  * @param ObjectManager $manager
  * @param string $name
  * @param Customer $parent
  * @return Customer
  */
 protected function createCustomer(ObjectManager $manager, $name, Customer $parent = null)
 {
     $customer = new Customer();
     $customer->setName($name);
     $organization = $manager->getRepository('OroOrganizationBundle:Organization')->getFirst();
     $customer->setOrganization($organization);
     if ($parent) {
         $customer->setParent($parent);
     }
     $manager->persist($customer);
     $this->addReference($name, $customer);
     return $customer;
 }
Beispiel #2
0
 /**
  * @ORM\PrePersist
  */
 public function createCustomer()
 {
     if (!$this->customer) {
         $this->customer = new Customer();
         $this->customer->setOrganization($this->organization);
         $this->customer->setName(sprintf('%s %s', $this->firstName, $this->lastName));
     }
 }