Beispiel #1
0
 /**
  * @param string      $key
  * @param B2bCustomer $entity
  */
 public function fillEntityData($key, $entity)
 {
     $addressRepo = $this->templateManager->getEntityRepository('Oro\\Bundle\\AddressBundle\\Entity\\Address');
     $userRepo = $this->templateManager->getEntityRepository('Oro\\Bundle\\UserBundle\\Entity\\User');
     $contactRepo = $this->templateManager->getEntityRepository('OroCRM\\Bundle\\ContactBundle\\Entity\\Contact');
     $leadRepo = $this->templateManager->getEntityRepository('OroCRM\\Bundle\\SalesBundle\\Entity\\Lead');
     $accountRepo = $this->templateManager->getEntityRepository('OroCRM\\Bundle\\AccountBundle\\Entity\\Account');
     $channelRepo = $this->templateManager->getEntityRepository('OroCRM\\Bundle\\ChannelBundle\\Entity\\Channel');
     $opportunityRepo = $this->templateManager->getEntityRepository('OroCRM\\Bundle\\SalesBundle\\Entity\\Opportunity');
     switch ($key) {
         case 'Jerry Coleman':
             $entity->setName('Jerry Coleman');
             $entity->addLead($leadRepo->getEntity('Jerry Coleman'));
             $entity->setContact($contactRepo->getEntity('Jerry Coleman'));
             $entity->setAccount($accountRepo->getEntity('Coleman'));
             $entity->setOwner($userRepo->getEntity('John Doo'));
             $entity->setBillingAddress($addressRepo->getEntity('Jerry Coleman'));
             $entity->setShippingAddress($addressRepo->getEntity('Jerry Coleman'));
             $entity->setDataChannel($channelRepo->getEntity('B2B channel|b2b'));
             $entity->setCreatedAt(new \DateTime());
             $entity->setUpdatedAt(new \DateTime());
             $entity->addOpportunity($opportunityRepo->getEntity('Jerry Coleman'));
             return;
     }
     parent::fillEntityData($key, $entity);
 }
Beispiel #2
0
 /**
  * @param string $key
  * @param Country $entity
  */
 public function fillEntityData($key, $entity)
 {
     if ($key === 'US') {
         return;
     }
     parent::fillEntityData($key, $entity);
 }
Beispiel #3
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);
 }
Beispiel #4
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);
 }
 /**
  * @param string       $key
  * @param BusinessUnit $entity
  */
 public function fillEntityData($key, $entity)
 {
     switch ($key) {
         case 'Main':
             $entity->setName($key);
             return;
     }
     parent::fillEntityData($key, $entity);
 }
Beispiel #6
0
 /**
  * @param string $key
  * @param User   $entity
  */
 public function fillEntityData($key, $entity)
 {
     $businessUnitRepo = $this->templateManager->getEntityRepository('Oro\\Bundle\\OrganizationBundle\\Entity\\BusinessUnit');
     switch ($key) {
         case 'John Doo':
             $entity->setUsername('admin')->setLoginCount(101)->setId(1)->setPlainPassword('admin_password')->setFirstname('John')->setMiddleName('Awesome')->setLastname('Doe')->setEmail('*****@*****.**')->setNamePrefix('Mr.')->setNameSuffix('Jr.')->setBirthday(new \DateTime('2013-02-01'))->setCreatedAt(new \DateTime())->setUpdatedAt(new \DateTime())->setEnabled(true)->setOwner($businessUnitRepo->getEntity('Main'))->addGroup(new Group('Administrators'))->addBusinessUnit($businessUnitRepo->getEntity('Main'));
             return;
     }
     parent::fillEntityData($key, $entity);
 }
Beispiel #7
0
 /**
  * @param string $key
  * @param Region $entity
  */
 public function fillEntityData($key, $entity)
 {
     $countryRepo = $this->templateManager->getEntityRepository('Oro\\Bundle\\AddressBundle\\Entity\\Country');
     switch ($key) {
         case 'NY':
             $entity->setCode($key);
             $country = $countryRepo->getEntity('US');
             $country->addRegion($entity);
             return;
     }
     parent::fillEntityData($key, $entity);
 }
 /**
  * @param string       $key
  * @param Organization $entity
  */
 public function fillEntityData($key, $entity)
 {
     switch ($key) {
         case 'default':
             $organization = $this->securityFacade->getOrganization();
             if ($organization) {
                 $entity->setName($organization->getName());
             }
             return;
     }
     parent::fillEntityData($key, $entity);
 }
 /**
  * @param string  $key
  * @param Partner $entity
  */
 public function fillEntityData($key, $entity)
 {
     $userRepo = $this->templateManager->getEntityRepository('Oro\\Bundle\\UserBundle\\Entity\\User');
     $accountRepo = $this->templateManager->getEntityRepository('OroCRM\\Bundle\\AccountBundle\\Entity\\Account');
     $organizationRepo = $this->templateManager->getEntityRepository('Oro\\Bundle\\OrganizationBundle\\Entity\\Organization');
     switch ($key) {
         case 'Smith':
             $entity->setId(1)->setPartnerCondition('Aenean commodo ligula eget dolor')->setStartDate(new \DateTime())->setStatus(new PartnerStatus('active'))->setAccount($accountRepo->getEntity($key))->setOwner($userRepo->getEntity('John Doo'))->setOrganization($organizationRepo->getEntity('default'));
             return;
     }
     parent::fillEntityData($key, $entity);
 }
Beispiel #10
0
 /**
  * @param string  $key
  * @param Account $entity
  */
 public function fillEntityData($key, $entity)
 {
     $userRepo = $this->templateManager->getEntityRepository('Oro\\Bundle\\UserBundle\\Entity\\User');
     $contactRepo = $this->templateManager->getEntityRepository('OroCRM\\Bundle\\ContactBundle\\Entity\\Contact');
     switch ($key) {
         case 'Coleman':
             $entity->setId(1)->setName($key)->setOwner($userRepo->getEntity('John Doo'))->addContact($contactRepo->getEntity('Jerry Coleman'))->setDefaultContact($contactRepo->getEntity('Jerry Coleman'));
             return;
         case 'Smith':
             $entity->setId(2)->setName($key)->setOwner($userRepo->getEntity('John Doo'))->addContact($contactRepo->getEntity('John Smith'))->setDefaultContact($contactRepo->getEntity('John Smith'));
             return;
     }
     parent::fillEntityData($key, $entity);
 }
Beispiel #11
0
 /**
  * @param string  $key
  * @param Contact $entity
  */
 public function fillEntityData($key, $entity)
 {
     $userRepo = $this->templateManager->getEntityRepository('Oro\\Bundle\\UserBundle\\Entity\\User');
     $accountRepo = $this->templateManager->getEntityRepository('OroCRM\\Bundle\\AccountBundle\\Entity\\Account');
     $contactAddressRepo = $this->templateManager->getEntityRepository('OroCRM\\Bundle\\ContactBundle\\Entity\\ContactAddress');
     switch ($key) {
         case 'Jerry Coleman':
             $primaryAddress = $contactAddressRepo->getEntity('Jerry Coleman');
             $entity->setId(1)->setNamePrefix('Mr.')->setFirstName('Jerry')->setLastName('Coleman')->setNameSuffix('Jr.')->setBirthday(new \DateTime('1973-03-07'))->setGender('male')->setDescription('Sample Contact')->setJobTitle('Manager')->setFax('713-450-0721')->setSkype('crm-jerrycoleman')->setTwitter('crm-jerrycoleman')->setFacebook('crm-jerrycoleman')->setGooglePlus('https://plus.google.com/454646545646546')->setLinkedIn('http://www.linkedin.com/in/crm-jerrycoleman')->setSource($this->createContactSource('website'))->setMethod($this->createContactMethod('phone'))->setOwner($userRepo->getEntity('John Doo'))->setAssignedTo($userRepo->getEntity('John Doo'))->addEmail($this->createContactEmail('*****@*****.**', true))->addEmail($this->createContactEmail('*****@*****.**'))->addEmail($this->createContactEmail('*****@*****.**'))->addPhone($this->createContactPhone('585-255-1127', true))->addPhone($this->createContactPhone('914-412-0298'))->addPhone($this->createContactPhone('310-430-7876'))->addGroup($this->createContactGroup('Sales Group'))->addGroup($this->createContactGroup('Marketing Group'))->addAccount($accountRepo->getEntity('Coleman'))->addAccount($accountRepo->getEntity('Smith'))->addAddress($primaryAddress)->addAddress($this->createContactAddress('Jerry Coleman', 2))->addAddress($this->createContactAddress('Jerry Coleman', 3))->setPrimaryAddress($primaryAddress);
             return;
         case 'John Smith':
             $primaryAddress = $this->createContactAddress('John Smith', 1);
             $entity->setId(2)->setNamePrefix('Mr.')->setFirstName('John')->setLastName('Smith')->setNameSuffix('Jr.')->setBirthday(new \DateTime('1973-03-07'))->setGender('male')->setDescription('Sample Contact')->setJobTitle('Manager')->setFax('713-450-0721')->setSkype('crm-johnsmith')->setTwitter('crm-johnsmith')->setFacebook('crm-johnsmith')->setGooglePlus('https://plus.google.com/343535434535435')->setLinkedIn('http://www.linkedin.com/in/crm-johnsmith')->setSource($this->createContactSource('website'))->setMethod($this->createContactMethod('phone'))->setOwner($userRepo->getEntity('John Doo'))->setAssignedTo($userRepo->getEntity('John Doo'))->addEmail($this->createContactEmail('*****@*****.**', true))->addEmail($this->createContactEmail('*****@*****.**'))->addEmail($this->createContactEmail('*****@*****.**'))->addPhone($this->createContactPhone('585-255-1127', true))->addPhone($this->createContactPhone('914-412-0298'))->addPhone($this->createContactPhone('310-430-7876'))->addGroup($this->createContactGroup('Sales Group'))->addGroup($this->createContactGroup('Marketing Group'))->addAccount($accountRepo->getEntity('Smith'))->addAccount($accountRepo->getEntity('Coleman'))->addAddress($primaryAddress)->addAddress($this->createContactAddress('John Smith', 2))->addAddress($this->createContactAddress('John Smith', 3))->setPrimaryAddress($primaryAddress);
             return;
     }
     parent::fillEntityData($key, $entity);
 }
Beispiel #12
0
 /**
  * @param string  $key
  * @param Address $entity
  */
 public function fillEntityData($key, $entity)
 {
     $countryRepo = $this->templateManager->getEntityRepository('Oro\\Bundle\\AddressBundle\\Entity\\Country');
     $regionRepo = $this->templateManager->getEntityRepository('Oro\\Bundle\\AddressBundle\\Entity\\Region');
     switch ($key) {
         case 'Jerry Coleman':
             $entity->setCity('Rochester')->setStreet('1215 Caldwell Road')->setPostalCode('14608')->setFirstName('Jerry')->setLastName('Coleman')->setRegion($regionRepo->getEntity('NY'))->setCountry($countryRepo->getEntity('US'));
             return;
         case 'John Smith':
             $entity->setCity('New York')->setStreet('4677 Pallet Street')->setPostalCode('10011')->setFirstName('John')->setLastName('Smith')->setRegion($regionRepo->getEntity('NY'))->setCountry($countryRepo->getEntity('US'));
             return;
         case 'John Doo':
             $entity->setCity('New York')->setStreet('52 Jarvisville Road')->setPostalCode('11590')->setFirstName('John')->setLastName('Doo')->setRegion($regionRepo->getEntity('NY'))->setCountry($countryRepo->getEntity('US'));
             return;
     }
     parent::fillEntityData($key, $entity);
 }
 /**
  * @expectedException \Oro\Bundle\ImportExportBundle\Exception\LogicException
  * @expectedExceptionMessage Unknown entity: "stdClass"; key: "test1".
  */
 public function testFillEntityData()
 {
     $entityKey = 'test1';
     $entity = new \stdClass();
     $this->templateRepository->fillEntityData($entityKey, $entity);
 }