summaryrefslogtreecommitdiffstats
path: root/lib/model/om/BaseLogEntry.php
diff options
context:
space:
mode:
authorGravatar mszulecki2007-06-14 17:09:01 +0000
committerGravatar mszulecki2007-06-14 17:09:01 +0000
commit9f108dd1a969473375341d92a7b1252fa2cedc9a (patch)
treed5f2e35ec0bd2d52dab0ee3282fc6751e0fa8dba /lib/model/om/BaseLogEntry.php
parente35884d11b81e4e4bbd73e1882e2b8011e85d118 (diff)
downloadmailadmin-9f108dd1a969473375341d92a7b1252fa2cedc9a.tar.gz
mailadmin-9f108dd1a969473375341d92a7b1252fa2cedc9a.tar.bz2
Initial import.
git-svn-id: http://svn.sukimashita.com/repos/mailadmin/trunk@2 4281df72-ff29-0410-8fee-2d9ac0c5f5a7
Diffstat (limited to 'lib/model/om/BaseLogEntry.php')
-rw-r--r--lib/model/om/BaseLogEntry.php548
1 files changed, 548 insertions, 0 deletions
diff --git a/lib/model/om/BaseLogEntry.php b/lib/model/om/BaseLogEntry.php
new file mode 100644
index 0000000..5bf1f41
--- /dev/null
+++ b/lib/model/om/BaseLogEntry.php
@@ -0,0 +1,548 @@
+<?php
+
+
+abstract class BaseLogEntry extends BaseObject implements Persistent {
+
+
+
+ protected static $peer;
+
+
+
+ protected $id;
+
+
+
+ protected $user_id = 0;
+
+
+
+ protected $created_at;
+
+
+
+ protected $message;
+
+
+
+ protected $host;
+
+
+
+ protected $priority;
+
+
+ protected $aUser;
+
+
+ protected $alreadyInSave = false;
+
+
+ protected $alreadyInValidation = false;
+
+
+ public function getId()
+ {
+
+ return $this->id;
+ }
+
+
+ public function getUserId()
+ {
+
+ return $this->user_id;
+ }
+
+
+ public function getCreatedAt($format = 'Y-m-d H:i:s')
+ {
+
+ if ($this->created_at === null || $this->created_at === '') {
+ return null;
+ } elseif (!is_int($this->created_at)) {
+ $ts = strtotime($this->created_at);
+ if ($ts === -1 || $ts === false) { throw new PropelException("Unable to parse value of [created_at] as date/time value: " . var_export($this->created_at, true));
+ }
+ } else {
+ $ts = $this->created_at;
+ }
+ if ($format === null) {
+ return $ts;
+ } elseif (strpos($format, '%') !== false) {
+ return strftime($format, $ts);
+ } else {
+ return date($format, $ts);
+ }
+ }
+
+
+ public function getMessage()
+ {
+
+ return $this->message;
+ }
+
+
+ public function getHost()
+ {
+
+ return $this->host;
+ }
+
+
+ public function getPriority()
+ {
+
+ return $this->priority;
+ }
+
+
+ public function setId($v)
+ {
+
+ if ($v !== null && !is_int($v) && is_numeric($v)) {
+ $v = (int) $v;
+ }
+
+ if ($this->id !== $v) {
+ $this->id = $v;
+ $this->modifiedColumns[] = LogEntryPeer::ID;
+ }
+
+ }
+
+ public function setUserId($v)
+ {
+
+ if ($v !== null && !is_int($v) && is_numeric($v)) {
+ $v = (int) $v;
+ }
+
+ if ($this->user_id !== $v || $v === 0) {
+ $this->user_id = $v;
+ $this->modifiedColumns[] = LogEntryPeer::USER_ID;
+ }
+
+ if ($this->aUser !== null && $this->aUser->getId() !== $v) {
+ $this->aUser = null;
+ }
+
+ }
+
+ public function setCreatedAt($v)
+ {
+
+ if ($v !== null && !is_int($v)) {
+ $ts = strtotime($v);
+ if ($ts === -1 || $ts === false) { throw new PropelException("Unable to parse date/time value for [created_at] from input: " . var_export($v, true));
+ }
+ } else {
+ $ts = $v;
+ }
+ if ($this->created_at !== $ts) {
+ $this->created_at = $ts;
+ $this->modifiedColumns[] = LogEntryPeer::CREATED_AT;
+ }
+
+ }
+
+ public function setMessage($v)
+ {
+
+ if ($v !== null && !is_string($v)) {
+ $v = (string) $v;
+ }
+
+ if ($this->message !== $v) {
+ $this->message = $v;
+ $this->modifiedColumns[] = LogEntryPeer::MESSAGE;
+ }
+
+ }
+
+ public function setHost($v)
+ {
+
+ if ($v !== null && !is_string($v)) {
+ $v = (string) $v;
+ }
+
+ if ($this->host !== $v) {
+ $this->host = $v;
+ $this->modifiedColumns[] = LogEntryPeer::HOST;
+ }
+
+ }
+
+ public function setPriority($v)
+ {
+
+ if ($v !== null && !is_int($v) && is_numeric($v)) {
+ $v = (int) $v;
+ }
+
+ if ($this->priority !== $v) {
+ $this->priority = $v;
+ $this->modifiedColumns[] = LogEntryPeer::PRIORITY;
+ }
+
+ }
+
+ public function hydrate(ResultSet $rs, $startcol = 1)
+ {
+ try {
+
+ $this->id = $rs->getInt($startcol + 0);
+
+ $this->user_id = $rs->getInt($startcol + 1);
+
+ $this->created_at = $rs->getTimestamp($startcol + 2, null);
+
+ $this->message = $rs->getString($startcol + 3);
+
+ $this->host = $rs->getString($startcol + 4);
+
+ $this->priority = $rs->getInt($startcol + 5);
+
+ $this->resetModified();
+
+ $this->setNew(false);
+
+ return $startcol + 6;
+ } catch (Exception $e) {
+ throw new PropelException("Error populating LogEntry object", $e);
+ }
+ }
+
+
+ public function delete($con = null)
+ {
+ if ($this->isDeleted()) {
+ throw new PropelException("This object has already been deleted.");
+ }
+
+ if ($con === null) {
+ $con = Propel::getConnection(LogEntryPeer::DATABASE_NAME);
+ }
+
+ try {
+ $con->begin();
+ LogEntryPeer::doDelete($this, $con);
+ $this->setDeleted(true);
+ $con->commit();
+ } catch (PropelException $e) {
+ $con->rollback();
+ throw $e;
+ }
+ }
+
+
+ public function save($con = null)
+ {
+ if ($this->isNew() && !$this->isColumnModified(LogEntryPeer::CREATED_AT))
+ {
+ $this->setCreatedAt(time());
+ }
+
+ if ($this->isDeleted()) {
+ throw new PropelException("You cannot save an object that has been deleted.");
+ }
+
+ if ($con === null) {
+ $con = Propel::getConnection(LogEntryPeer::DATABASE_NAME);
+ }
+
+ try {
+ $con->begin();
+ $affectedRows = $this->doSave($con);
+ $con->commit();
+ return $affectedRows;
+ } catch (PropelException $e) {
+ $con->rollback();
+ throw $e;
+ }
+ }
+
+
+ protected function doSave($con)
+ {
+ $affectedRows = 0; if (!$this->alreadyInSave) {
+ $this->alreadyInSave = true;
+
+
+
+ if ($this->aUser !== null) {
+ if ($this->aUser->isModified()) {
+ $affectedRows += $this->aUser->save($con);
+ }
+ $this->setUser($this->aUser);
+ }
+
+
+ if ($this->isModified()) {
+ if ($this->isNew()) {
+ $pk = LogEntryPeer::doInsert($this, $con);
+ $affectedRows += 1;
+ $this->setId($pk);
+ $this->setNew(false);
+ } else {
+ $affectedRows += LogEntryPeer::doUpdate($this, $con);
+ }
+ $this->resetModified(); }
+
+ $this->alreadyInSave = false;
+ }
+ return $affectedRows;
+ }
+
+ protected $validationFailures = array();
+
+
+ public function getValidationFailures()
+ {
+ return $this->validationFailures;
+ }
+
+
+ public function validate($columns = null)
+ {
+ $res = $this->doValidate($columns);
+ if ($res === true) {
+ $this->validationFailures = array();
+ return true;
+ } else {
+ $this->validationFailures = $res;
+ return false;
+ }
+ }
+
+
+ protected function doValidate($columns = null)
+ {
+ if (!$this->alreadyInValidation) {
+ $this->alreadyInValidation = true;
+ $retval = null;
+
+ $failureMap = array();
+
+
+
+ if ($this->aUser !== null) {
+ if (!$this->aUser->validate($columns)) {
+ $failureMap = array_merge($failureMap, $this->aUser->getValidationFailures());
+ }
+ }
+
+
+ if (($retval = LogEntryPeer::doValidate($this, $columns)) !== true) {
+ $failureMap = array_merge($failureMap, $retval);
+ }
+
+
+
+ $this->alreadyInValidation = false;
+ }
+
+ return (!empty($failureMap) ? $failureMap : true);
+ }
+
+
+ public function getByName($name, $type = BasePeer::TYPE_PHPNAME)
+ {
+ $pos = LogEntryPeer::translateFieldName($name, $type, BasePeer::TYPE_NUM);
+ return $this->getByPosition($pos);
+ }
+
+
+ public function getByPosition($pos)
+ {
+ switch($pos) {
+ case 0:
+ return $this->getId();
+ break;
+ case 1:
+ return $this->getUserId();
+ break;
+ case 2:
+ return $this->getCreatedAt();
+ break;
+ case 3:
+ return $this->getMessage();
+ break;
+ case 4:
+ return $this->getHost();
+ break;
+ case 5:
+ return $this->getPriority();
+ break;
+ default:
+ return null;
+ break;
+ } }
+
+
+ public function toArray($keyType = BasePeer::TYPE_PHPNAME)
+ {
+ $keys = LogEntryPeer::getFieldNames($keyType);
+ $result = array(
+ $keys[0] => $this->getId(),
+ $keys[1] => $this->getUserId(),
+ $keys[2] => $this->getCreatedAt(),
+ $keys[3] => $this->getMessage(),
+ $keys[4] => $this->getHost(),
+ $keys[5] => $this->getPriority(),
+ );
+ return $result;
+ }
+
+
+ public function setByName($name, $value, $type = BasePeer::TYPE_PHPNAME)
+ {
+ $pos = LogEntryPeer::translateFieldName($name, $type, BasePeer::TYPE_NUM);
+ return $this->setByPosition($pos, $value);
+ }
+
+
+ public function setByPosition($pos, $value)
+ {
+ switch($pos) {
+ case 0:
+ $this->setId($value);
+ break;
+ case 1:
+ $this->setUserId($value);
+ break;
+ case 2:
+ $this->setCreatedAt($value);
+ break;
+ case 3:
+ $this->setMessage($value);
+ break;
+ case 4:
+ $this->setHost($value);
+ break;
+ case 5:
+ $this->setPriority($value);
+ break;
+ } }
+
+
+ public function fromArray($arr, $keyType = BasePeer::TYPE_PHPNAME)
+ {
+ $keys = LogEntryPeer::getFieldNames($keyType);
+
+ if (array_key_exists($keys[0], $arr)) $this->setId($arr[$keys[0]]);
+ if (array_key_exists($keys[1], $arr)) $this->setUserId($arr[$keys[1]]);
+ if (array_key_exists($keys[2], $arr)) $this->setCreatedAt($arr[$keys[2]]);
+ if (array_key_exists($keys[3], $arr)) $this->setMessage($arr[$keys[3]]);
+ if (array_key_exists($keys[4], $arr)) $this->setHost($arr[$keys[4]]);
+ if (array_key_exists($keys[5], $arr)) $this->setPriority($arr[$keys[5]]);
+ }
+
+
+ public function buildCriteria()
+ {
+ $criteria = new Criteria(LogEntryPeer::DATABASE_NAME);
+
+ if ($this->isColumnModified(LogEntryPeer::ID)) $criteria->add(LogEntryPeer::ID, $this->id);
+ if ($this->isColumnModified(LogEntryPeer::USER_ID)) $criteria->add(LogEntryPeer::USER_ID, $this->user_id);
+ if ($this->isColumnModified(LogEntryPeer::CREATED_AT)) $criteria->add(LogEntryPeer::CREATED_AT, $this->created_at);
+ if ($this->isColumnModified(LogEntryPeer::MESSAGE)) $criteria->add(LogEntryPeer::MESSAGE, $this->message);
+ if ($this->isColumnModified(LogEntryPeer::HOST)) $criteria->add(LogEntryPeer::HOST, $this->host);
+ if ($this->isColumnModified(LogEntryPeer::PRIORITY)) $criteria->add(LogEntryPeer::PRIORITY, $this->priority);
+
+ return $criteria;
+ }
+
+
+ public function buildPkeyCriteria()
+ {
+ $criteria = new Criteria(LogEntryPeer::DATABASE_NAME);
+
+ $criteria->add(LogEntryPeer::ID, $this->id);
+
+ return $criteria;
+ }
+
+
+ public function getPrimaryKey()
+ {
+ return $this->getId();
+ }
+
+
+ public function setPrimaryKey($key)
+ {
+ $this->setId($key);
+ }
+
+
+ public function copyInto($copyObj, $deepCopy = false)
+ {
+
+ $copyObj->setUserId($this->user_id);
+
+ $copyObj->setCreatedAt($this->created_at);
+
+ $copyObj->setMessage($this->message);
+
+ $copyObj->setHost($this->host);
+
+ $copyObj->setPriority($this->priority);
+
+
+ $copyObj->setNew(true);
+
+ $copyObj->setId(NULL);
+ }
+
+
+ public function copy($deepCopy = false)
+ {
+ $clazz = get_class($this);
+ $copyObj = new $clazz();
+ $this->copyInto($copyObj, $deepCopy);
+ return $copyObj;
+ }
+
+
+ public function getPeer()
+ {
+ if (self::$peer === null) {
+ self::$peer = new LogEntryPeer();
+ }
+ return self::$peer;
+ }
+
+
+ public function setUser($v)
+ {
+
+
+ if ($v === null) {
+ $this->setUserId('null');
+ } else {
+ $this->setUserId($v->getId());
+ }
+
+
+ $this->aUser = $v;
+ }
+
+
+
+ public function getUser($con = null)
+ {
+ include_once 'lib/model/om/BaseUserPeer.php';
+
+ if ($this->aUser === null && ($this->user_id !== null)) {
+
+ $this->aUser = UserPeer::retrieveByPK($this->user_id, $con);
+
+
+ }
+ return $this->aUser;
+ }
+
+} \ No newline at end of file