Beispiel #1
0
 /**
  * Insert into DB else update on duplicate key
  * @return boolean
  */
 public function insertElseUpdate()
 {
     if (!$this->validate()) {
         return false;
     }
     $modelEntry = new Model_Entry();
     $result = $modelEntry->insertElseUpdate(array('email' => $this->getEmail(), 'first' => $this->getFirst(), 'last' => $this->getLast(), 'optin' => (int) $this->getOptin()));
     if ($result === false) {
         // error
         $this->getErrorObj()->setError('ENTRY_DB_ERROR');
         return false;
     } else {
         $this->setId($result);
         return true;
     }
 }