public function persist()
 {
     if ($this->_persistMode === WebVista_Model_ORM::DELETE) {
         $db = Zend_Registry::get('dbAdapter');
         $sql = $this->toSQL();
         $code = preg_replace('/[^a-z_0-9- \\.]/i', '', $this->code);
         $sql .= " AND `code` = '{$code}'";
         $db->query($sql);
         $this->postPersist();
         if ($this->shouldAudit()) {
             WebVista_Model_ORM::audit($this);
         }
     } else {
         parent::persist();
     }
     return $this;
 }
Exemplo n.º 2
0
 public function persist()
 {
     if ($this->_persistMode == WebVista_Model_ORM::DELETE) {
         return parent::persist();
     }
     $db = Zend_Registry::get('dbAdapter');
     $genericDataId = (int) $this->genericDataId;
     $data = $this->toArray();
     if ($genericDataId > 0) {
         $ret = $db->update($this->_table, $data, 'genericDataId = ' . $genericDataId);
     } else {
         $this->genericDataId = WebVista_Model_ORM::nextSequenceId();
         $data['genericDataId'] = $this->genericDataId;
         $ret = $db->insert($this->_table, $data);
     }
     if ($this->shouldAudit()) {
         WebVista_Model_ORM::audit($this);
     }
     return $this;
 }
Exemplo n.º 3
0
 /**
  * Persist an ordo to the database
  *
  * @param ORDataObject	$ordo
  */
 function persist()
 {
     $db = Zend_Registry::get('dbAdapter');
     $this->_inPersist = true;
     $sql = $this->toSQL();
     $this->_inPersist = false;
     //echo $sql . "<br />";ob_flush();
     $stmt = $db->query($sql);
     $stmt->closeCursor();
     $this->postPersist();
     if ($this instanceof Document && $this->signatureNeeded()) {
         ESignature::createSignatureEntry($this);
     }
     if ($this->shouldAudit() && get_class($this) != "Audit" && get_class($this) != "AuditValue") {
         WebVista_Model_ORM::audit($this);
     }
     return $this;
 }