Example #1
0
 protected function prepareInsertData($data)
 {
     $data = $this->prepareData($data);
     //check primary email to be unique
     if ($data['id_pr_comm_email']) {
         if (!isset($data['pr_comm_email'])) {
             $communication_email = $this->getCommunicationService()->getRow($data['id_pr_comm_email']);
             $data['pr_comm_email'] = $communication_email['access_detail'];
         }
         $rs = $this->fetchByPrimaryEmail($data['pr_comm_email']);
         if ($rs->count() > 0) {
             throw new \Tee\Exception\ValidateException('Primary email was already registered.');
         }
     }
     if (empty($data['name_party'])) {
         if (isset($data['name_first']) || isset($data['name_last'])) {
             // For Person
             $data['name_party'] = trim((isset($data['name_first']) ? $data['name_first'] . ' ' : '') . (isset($data['name_middle']) ? $data['name_middle'] . ' ' : '') . (isset($data['name_last']) ? $data['name_last'] . ' ' : ''));
         } else {
             if (isset($data['name_organization'])) {
                 // For Organization
                 $data['name_party'] = $data['name_organization'];
             }
         }
     }
     if (empty($data['party_alias']) && isset($data['name_party'])) {
         $data['party_alias'] = $data['name_party'];
     }
     return parent::prepareInsertData($data);
 }
 protected function prepareUpdateData($data)
 {
     if ($data['latitude'] && $data['longitude']) {
         $data['location'] = new Predicate\Expression("GeomFromText( 'POINT(" . $data['latitude'] . " " . $data['longitude'] . " )' )");
     } else {
         $data['location'] = null;
     }
     return parent::prepareUpdateData($data);
 }
 public function __construct(Adapter $adapter, $target_type_object = '', $target_columns = array(), $id_changedby = '', $genPath = '')
 {
     parent::__construct($adapter, $id_changedby, $genPath);
     if ($target_type_object) {
         $this->setTargetTypeObject($target_type_object);
     }
     if ($target_columns) {
         $this->setTargetColumns($target_columns);
     }
 }
 public function deleteRowByNid($nid, $callback = '')
 {
     $this->getCache()->removeItem($this->cacheItemPrefix . $this->getTable() . ($this->cacheItemPostfix ? '_' . $this->cacheItemPostfix : ''));
     return parent::deleteRowByNid($nid, $callback);
 }
Example #5
0
 protected function prepareUpdateData($data)
 {
     $data = $this->prepareData($data);
     return parent::prepareUpdateData($data);
 }