public function persist() { if ($this->_ormPersist) { return parent::persist(); } if ($this->shouldAudit()) { $sql = $this->toSQL(); AuditLog::appendSql($sql); } }
public function persist() { if (!strlen($this->ip_address) > 0 && isset($_SERVER['REMOTE_ADDR'])) { $this->ip_address = $_SERVER['REMOTE_ADDR']; } if (!$this->userId) { $audit->userId = Registry::get('user_id'); } if (self::$_synchronousAudits || $this->_ormPersist) { return parent::persist(); } if ($this->shouldAudit()) { $sql = $this->toSQL(); AuditLog::appendSql($sql); } }
public function persist() { if (!strlen($this->ipAddress) > 0 && isset($_SERVER['REMOTE_ADDR'])) { $this->ipAddress = $_SERVER['REMOTE_ADDR']; } if (self::$_processedAudits) { $this->startProcessing = date('Y-m-d H:i:s'); $this->endProcessing = date('Y-m-d H:i:s'); } if (!$this->userId) { $identity = Zend_Auth::getInstance()->getIdentity(); if ($identity) { $this->userId = $identity->personId; } } if (self::$_synchronousAudits || $this->_ormPersist) { return parent::persist(); } if ($this->shouldAudit()) { $sql = $this->toSQL(); AuditLog::appendSql($sql); } }
public function persist($preQueries = null, $postQueries = null) { $ret = true; Orm::$_adapter->beginTransaction(); try { if ($preQueries !== null) { if (!is_array($preQueries)) { $preQueries = array($preQueries); } foreach ($preQueries as $sql) { Orm::$_adapter->query($sql); } } foreach ($this->queries as $sql) { //Orm::$_adapter->query($sql); $stmt = Orm::$_adapter->getConnection()->exec($sql); } if ($postQueries !== null) { if (!is_array($postQueries)) { $postQueries = array($postQueries); } foreach ($postQueries as $sql) { Orm::$_adapter->query($sql); } } if (isset($this->auditLogQueries[0])) { AuditLog::appendSql($this->auditLogQueries); } Orm::$_adapter->commit(); } catch (Exception $e) { $ret = false; Orm::$_adapter->rollBack(); trigger_error($e->getMessage(), E_USER_NOTICE); } return $ret; }
public function persist($preQueries = null, $postQueries = null) { $ret = true; $db = Zend_Registry::get('dbAdapter'); $db->beginTransaction(); try { if ($preQueries !== null) { if (!is_array($preQueries)) { $preQueries = array($preQueries); } foreach ($preQueries as $sql) { $stmt = $db->query($sql); $stmt->closeCursor(); } } foreach ($this->queries as $sql) { $stmt = $db->query($sql); $stmt->closeCursor(); } if ($postQueries !== null) { if (!is_array($postQueries)) { $postQueries = array($postQueries); } foreach ($postQueries as $sql) { $stmt = $db->query($sql); $stmt->closeCursor(); } } if (isset($this->auditLogQueries[0])) { AuditLog::appendSql($this->auditLogQueries); } $db->commit(); } catch (Exception $e) { $ret = false; $db->rollBack(); trigger_error($e->getMessage(), E_USER_NOTICE); } return $ret; }