Esempio n. 1
0
 public function afterCreate($entity, array $data)
 {
     parent::afterCreate($entity, $data);
     if (!empty($data['emailId'])) {
         $email = $this->getEntityManager()->getEntity('Email', $data['emailId']);
         if ($email && !$email->get('parentId')) {
             $email->set(array('parentType' => 'Case', 'parentId' => $entity->id));
             $this->getEntityManager()->saveEntity($email);
         }
     }
 }
Esempio n. 2
0
 public function afterCreate($entity, array $data)
 {
     parent::afterCreate($entity, $data);
     if (!empty($data['emailId'])) {
         $email = $this->getEntityManager()->getEntity('Email', $data['emailId']);
         if ($email && !$email->get('parentId')) {
             if ($this->getConfig()->get('b2cMode')) {
                 $email->set(array('parentType' => 'Contact', 'parentId' => $entity->id));
             } else {
                 if ($entity->get('accountId')) {
                     $email->set(array('parentType' => 'Account', 'parentId' => $entity->get('accountId')));
                 }
             }
             $this->getEntityManager()->saveEntity($email);
         }
     }
 }
Esempio n. 3
0
 public function afterCreate($entity, array $data)
 {
     parent::afterCreate($entity, $data);
     if (!empty($data['emailId'])) {
         $email = $this->getEntityManager()->getEntity('Email', $data['emailId']);
         if ($email && !$email->get('parentId')) {
             $email->set(array('parentType' => 'Lead', 'parentId' => $entity->id));
             $this->getEntityManager()->saveEntity($email);
         }
     }
     if ($entity->get('campaignId')) {
         $campaign = $this->getEntityManager()->getEntity('Campaign', $entity->get('campaignId'));
         if ($campaign) {
             $log = $this->getEntityManager()->getEntity('CampaignLogRecord');
             $log->set(array('action' => 'Lead Created', 'actionDate' => date('Y-m-d H:i:s'), 'parentType' => 'Lead', 'parentId' => $entity->id, 'campaignId' => $campaign->id));
             $this->getEntityManager()->saveEntity($log);
         }
     }
 }
Esempio n. 4
0
 public function afterCreate(Entity $entity, array $data)
 {
     parent::afterCreate($entity, $data);
     $this->clearRolesCache();
 }
Esempio n. 5
0
 public function afterCreate(Entity $entity, array $data = array())
 {
     parent::afterCreate($entity, $data);
     // TODO: Change the autogenerated stub
     if (array_key_exists('agentId', $data)) {
         $agentId = $entity->get('agentId');
         $agentEntity = $this->getEntityManager()->getEntity('Agent', $agentId);
         $agentEntity->set(array('userId' => $entity->id));
         $this->getEntityManager()->saveEntity($agentEntity);
     }
 }