Пример #1
0
 /**
  * @param string $key
  * @param Lead   $entity
  */
 public function fillEntityData($key, $entity)
 {
     $addressRepo = $this->templateManager->getEntityRepository('Oro\\Bundle\\AddressBundle\\Entity\\Address');
     $userRepo = $this->templateManager->getEntityRepository('Oro\\Bundle\\UserBundle\\Entity\\User');
     $customerRepo = $this->templateManager->getEntityRepository('OroCRM\\Bundle\\SalesBundle\\Entity\\B2bCustomer');
     $contactRepo = $this->templateManager->getEntityRepository('OroCRM\\Bundle\\ContactBundle\\Entity\\Contact');
     $channelRepo = $this->templateManager->getEntityRepository('OroCRM\\Bundle\\ChannelBundle\\Entity\\Channel');
     switch ($key) {
         case 'Jerry Coleman':
             $entity->setName('Oro Inc. Lead Name');
             $entity->setCompanyName('Oro Inc.');
             $entity->setOwner($userRepo->getEntity('John Doo'));
             $entity->setDataChannel($channelRepo->getEntity('B2b channel|b2b'));
             $entity->setCreatedAt(new \DateTime());
             $entity->setUpdatedAt(new \DateTime());
             $entity->setCustomer($customerRepo->getEntity('Jerry Coleman'));
             $entity->setContact($contactRepo->getEntity('Jerry Coleman'));
             $entity->setAddress($addressRepo->getEntity('Jerry Coleman'));
             $entity->setEmail('*****@*****.**');
             $entity->setNamePrefix('Mr.');
             $entity->setFirstName('Jerry');
             $entity->setLastName('Coleman');
             $entity->setNameSuffix('Jr.');
             $entity->setStatus(new LeadStatus('New'));
             $entity->setJobTitle('Manager');
             $entity->setPhoneNumber('585-255-1127');
             $entity->setWebsite('http://orocrm.com');
             $entity->setNumberOfEmployees(100);
             $entity->setIndustry('Internet');
             return;
     }
     parent::fillEntityData($key, $entity);
 }
Пример #2
0
 protected function createLead()
 {
     $lead = new Lead();
     $lead->setDataChannel($this->getReference('default_channel'));
     $lead->setName('Lead name');
     $lead->setFirstName('fname');
     $lead->setLastName('lname');
     $lead->setCustomer($this->getReference('default_b2bcustomer'));
     $lead->setEmail('*****@*****.**');
     $lead->setOrganization($this->organization);
     $this->em->persist($lead);
     $this->em->flush();
     $this->setReference('default_lead', $lead);
     return $this;
 }