Ejemplo n.º 1
0
 /**
  * @param string      $key
  * @param Opportunity $entity
  */
 public function fillEntityData($key, $entity)
 {
     $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');
     $leadRepo = $this->templateManager->getEntityRepository('OroCRM\\Bundle\\SalesBundle\\Entity\\Lead');
     $channelRepo = $this->templateManager->getEntityRepository('OroCRM\\Bundle\\ChannelBundle\\Entity\\Channel');
     $organizationRepo = $this->templateManager->getEntityRepository('Oro\\Bundle\\OrganizationBundle\\Entity\\Organization');
     switch ($key) {
         case 'Jerry Coleman':
             $entity->setName('Oro Inc. Opportunity Name');
             $entity->setCustomer($customerRepo->getEntity('Jerry Coleman'));
             $entity->setDataChannel($channelRepo->getEntity('B2b channel|b2b'));
             $entity->setCreatedAt(new \DateTime());
             $entity->setUpdatedAt(new \DateTime());
             $entity->setOwner($userRepo->getEntity('John Doo'));
             $entity->setOrganization($organizationRepo->getEntity('default'));
             $entity->setBudgetAmount(1000000);
             $entity->setContact($contactRepo->getEntity('Jerry Coleman'));
             $entity->setLead($leadRepo->getEntity('Jerry Coleman'));
             $entity->setStatus(new OpportunityStatus('In Progress'));
             return;
     }
     parent::fillEntityData($key, $entity);
 }
Ejemplo n.º 2
0
 public function testGetEmail()
 {
     $opportunity = new Opportunity();
     $contact = $this->getMockBuilder('OroCRM\\Bundle\\ContactBundle\\Entity\\Contact')->disableOriginalConstructor()->getMock();
     $this->assertNull($opportunity->getEmail());
     $opportunity->setContact($contact);
     $contact->expects($this->once())->method('getEmail')->will($this->returnValue('*****@*****.**'));
     $this->assertEquals('*****@*****.**', $opportunity->getEmail());
 }
Ejemplo n.º 3
0
 /**
  * @param Contact     $contact
  * @param B2bCustomer $customer
  * @param User        $user
  *
  * @return Opportunity
  */
 protected function createOpportunity($contact, $customer, $user)
 {
     $opportunity = new Opportunity();
     $dataChannel = $this->getReference('default_channel');
     $opportunity->setName($contact->getFirstName() . ' ' . $contact->getLastName());
     $opportunity->setContact($contact);
     $opportunity->setOwner($user);
     $opportunity->setOrganization($this->organization);
     $opportunity->setCustomer($customer);
     $opportunity->setDataChannel($dataChannel);
     return $opportunity;
 }
Ejemplo n.º 4
0
 public function testGetOpportunityEmail()
 {
     $salesFunnel = new SalesFunnel();
     $email = new ContactEmail();
     $email->setEmail('*****@*****.**');
     $contact = new Contact();
     $contact->addEmail($email);
     $contact->setPrimaryEmail($email);
     $opportunity = new Opportunity();
     $opportunity->setContact($contact);
     $salesFunnel->setOpportunity($opportunity);
     $this->assertEquals('*****@*****.**', $salesFunnel->getEmail());
 }