summaryrefslogtreecommitdiffstats
path: root/lib/model/om/BaseAddress.php
diff options
context:
space:
mode:
Diffstat (limited to 'lib/model/om/BaseAddress.php')
-rw-r--r--lib/model/om/BaseAddress.php643
1 files changed, 643 insertions, 0 deletions
diff --git a/lib/model/om/BaseAddress.php b/lib/model/om/BaseAddress.php
new file mode 100644
index 0000000..8e9c258
--- /dev/null
+++ b/lib/model/om/BaseAddress.php
@@ -0,0 +1,643 @@
+<?php
+
+
+abstract class BaseAddress extends BaseObject implements Persistent {
+
+
+
+ protected static $peer;
+
+
+
+ protected $id;
+
+
+
+ protected $mailbox_id;
+
+
+
+ protected $localpart;
+
+
+
+ protected $domain_id;
+
+
+
+ protected $alias;
+
+
+
+ protected $destination;
+
+
+
+ protected $active = true;
+
+
+
+ protected $save_in_mailbox = true;
+
+
+ protected $aMailbox;
+
+
+ protected $aDomain;
+
+
+ protected $alreadyInSave = false;
+
+
+ protected $alreadyInValidation = false;
+
+
+ public function getId()
+ {
+
+ return $this->id;
+ }
+
+
+ public function getMailboxId()
+ {
+
+ return $this->mailbox_id;
+ }
+
+
+ public function getLocalpart()
+ {
+
+ return $this->localpart;
+ }
+
+
+ public function getDomainId()
+ {
+
+ return $this->domain_id;
+ }
+
+
+ public function getAlias()
+ {
+
+ return $this->alias;
+ }
+
+
+ public function getDestination()
+ {
+
+ return $this->destination;
+ }
+
+
+ public function getActive()
+ {
+
+ return $this->active;
+ }
+
+
+ public function getSaveInMailbox()
+ {
+
+ return $this->save_in_mailbox;
+ }
+
+
+ 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[] = AddressPeer::ID;
+ }
+
+ }
+
+ public function setMailboxId($v)
+ {
+
+ if ($v !== null && !is_int($v) && is_numeric($v)) {
+ $v = (int) $v;
+ }
+
+ if ($this->mailbox_id !== $v) {
+ $this->mailbox_id = $v;
+ $this->modifiedColumns[] = AddressPeer::MAILBOX_ID;
+ }
+
+ if ($this->aMailbox !== null && $this->aMailbox->getId() !== $v) {
+ $this->aMailbox = null;
+ }
+
+ }
+
+ public function setLocalpart($v)
+ {
+
+ if ($v !== null && !is_string($v)) {
+ $v = (string) $v;
+ }
+
+ if ($this->localpart !== $v) {
+ $this->localpart = $v;
+ $this->modifiedColumns[] = AddressPeer::LOCALPART;
+ }
+
+ }
+
+ public function setDomainId($v)
+ {
+
+ if ($v !== null && !is_int($v) && is_numeric($v)) {
+ $v = (int) $v;
+ }
+
+ if ($this->domain_id !== $v) {
+ $this->domain_id = $v;
+ $this->modifiedColumns[] = AddressPeer::DOMAIN_ID;
+ }
+
+ if ($this->aDomain !== null && $this->aDomain->getId() !== $v) {
+ $this->aDomain = null;
+ }
+
+ }
+
+ public function setAlias($v)
+ {
+
+ if ($v !== null && !is_string($v)) {
+ $v = (string) $v;
+ }
+
+ if ($this->alias !== $v) {
+ $this->alias = $v;
+ $this->modifiedColumns[] = AddressPeer::ALIAS;
+ }
+
+ }
+
+ public function setDestination($v)
+ {
+
+ if ($v !== null && !is_string($v)) {
+ $v = (string) $v;
+ }
+
+ if ($this->destination !== $v) {
+ $this->destination = $v;
+ $this->modifiedColumns[] = AddressPeer::DESTINATION;
+ }
+
+ }
+
+ public function setActive($v)
+ {
+
+ if ($this->active !== $v || $v === true) {
+ $this->active = $v;
+ $this->modifiedColumns[] = AddressPeer::ACTIVE;
+ }
+
+ }
+
+ public function setSaveInMailbox($v)
+ {
+
+ if ($this->save_in_mailbox !== $v || $v === true) {
+ $this->save_in_mailbox = $v;
+ $this->modifiedColumns[] = AddressPeer::SAVE_IN_MAILBOX;
+ }
+
+ }
+
+ public function hydrate(ResultSet $rs, $startcol = 1)
+ {
+ try {
+
+ $this->id = $rs->getInt($startcol + 0);
+
+ $this->mailbox_id = $rs->getInt($startcol + 1);
+
+ $this->localpart = $rs->getString($startcol + 2);
+
+ $this->domain_id = $rs->getInt($startcol + 3);
+
+ $this->alias = $rs->getString($startcol + 4);
+
+ $this->destination = $rs->getString($startcol + 5);
+
+ $this->active = $rs->getBoolean($startcol + 6);
+
+ $this->save_in_mailbox = $rs->getBoolean($startcol + 7);
+
+ $this->resetModified();
+
+ $this->setNew(false);
+
+ return $startcol + 8;
+ } catch (Exception $e) {
+ throw new PropelException("Error populating Address 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(AddressPeer::DATABASE_NAME);
+ }
+
+ try {
+ $con->begin();
+ AddressPeer::doDelete($this, $con);
+ $this->setDeleted(true);
+ $con->commit();
+ } catch (PropelException $e) {
+ $con->rollback();
+ throw $e;
+ }
+ }
+
+
+ public function save($con = null)
+ {
+ if ($this->isDeleted()) {
+ throw new PropelException("You cannot save an object that has been deleted.");
+ }
+
+ if ($con === null) {
+ $con = Propel::getConnection(AddressPeer::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->aMailbox !== null) {
+ if ($this->aMailbox->isModified()) {
+ $affectedRows += $this->aMailbox->save($con);
+ }
+ $this->setMailbox($this->aMailbox);
+ }
+
+ if ($this->aDomain !== null) {
+ if ($this->aDomain->isModified()) {
+ $affectedRows += $this->aDomain->save($con);
+ }
+ $this->setDomain($this->aDomain);
+ }
+
+
+ if ($this->isModified()) {
+ if ($this->isNew()) {
+ $pk = AddressPeer::doInsert($this, $con);
+ $affectedRows += 1;
+ $this->setId($pk);
+ $this->setNew(false);
+ } else {
+ $affectedRows += AddressPeer::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->aMailbox !== null) {
+ if (!$this->aMailbox->validate($columns)) {
+ $failureMap = array_merge($failureMap, $this->aMailbox->getValidationFailures());
+ }
+ }
+
+ if ($this->aDomain !== null) {
+ if (!$this->aDomain->validate($columns)) {
+ $failureMap = array_merge($failureMap, $this->aDomain->getValidationFailures());
+ }
+ }
+
+
+ if (($retval = AddressPeer::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 = AddressPeer::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->getMailboxId();
+ break;
+ case 2:
+ return $this->getLocalpart();
+ break;
+ case 3:
+ return $this->getDomainId();
+ break;
+ case 4:
+ return $this->getAlias();
+ break;
+ case 5:
+ return $this->getDestination();
+ break;
+ case 6:
+ return $this->getActive();
+ break;
+ case 7:
+ return $this->getSaveInMailbox();
+ break;
+ default:
+ return null;
+ break;
+ } }
+
+
+ public function toArray($keyType = BasePeer::TYPE_PHPNAME)
+ {
+ $keys = AddressPeer::getFieldNames($keyType);
+ $result = array(
+ $keys[0] => $this->getId(),
+ $keys[1] => $this->getMailboxId(),
+ $keys[2] => $this->getLocalpart(),
+ $keys[3] => $this->getDomainId(),
+ $keys[4] => $this->getAlias(),
+ $keys[5] => $this->getDestination(),
+ $keys[6] => $this->getActive(),
+ $keys[7] => $this->getSaveInMailbox(),
+ );
+ return $result;
+ }
+
+
+ public function setByName($name, $value, $type = BasePeer::TYPE_PHPNAME)
+ {
+ $pos = AddressPeer::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->setMailboxId($value);
+ break;
+ case 2:
+ $this->setLocalpart($value);
+ break;
+ case 3:
+ $this->setDomainId($value);
+ break;
+ case 4:
+ $this->setAlias($value);
+ break;
+ case 5:
+ $this->setDestination($value);
+ break;
+ case 6:
+ $this->setActive($value);
+ break;
+ case 7:
+ $this->setSaveInMailbox($value);
+ break;
+ } }
+
+
+ public function fromArray($arr, $keyType = BasePeer::TYPE_PHPNAME)
+ {
+ $keys = AddressPeer::getFieldNames($keyType);
+
+ if (array_key_exists($keys[0], $arr)) $this->setId($arr[$keys[0]]);
+ if (array_key_exists($keys[1], $arr)) $this->setMailboxId($arr[$keys[1]]);
+ if (array_key_exists($keys[2], $arr)) $this->setLocalpart($arr[$keys[2]]);
+ if (array_key_exists($keys[3], $arr)) $this->setDomainId($arr[$keys[3]]);
+ if (array_key_exists($keys[4], $arr)) $this->setAlias($arr[$keys[4]]);
+ if (array_key_exists($keys[5], $arr)) $this->setDestination($arr[$keys[5]]);
+ if (array_key_exists($keys[6], $arr)) $this->setActive($arr[$keys[6]]);
+ if (array_key_exists($keys[7], $arr)) $this->setSaveInMailbox($arr[$keys[7]]);
+ }
+
+
+ public function buildCriteria()
+ {
+ $criteria = new Criteria(AddressPeer::DATABASE_NAME);
+
+ if ($this->isColumnModified(AddressPeer::ID)) $criteria->add(AddressPeer::ID, $this->id);
+ if ($this->isColumnModified(AddressPeer::MAILBOX_ID)) $criteria->add(AddressPeer::MAILBOX_ID, $this->mailbox_id);
+ if ($this->isColumnModified(AddressPeer::LOCALPART)) $criteria->add(AddressPeer::LOCALPART, $this->localpart);
+ if ($this->isColumnModified(AddressPeer::DOMAIN_ID)) $criteria->add(AddressPeer::DOMAIN_ID, $this->domain_id);
+ if ($this->isColumnModified(AddressPeer::ALIAS)) $criteria->add(AddressPeer::ALIAS, $this->alias);
+ if ($this->isColumnModified(AddressPeer::DESTINATION)) $criteria->add(AddressPeer::DESTINATION, $this->destination);
+ if ($this->isColumnModified(AddressPeer::ACTIVE)) $criteria->add(AddressPeer::ACTIVE, $this->active);
+ if ($this->isColumnModified(AddressPeer::SAVE_IN_MAILBOX)) $criteria->add(AddressPeer::SAVE_IN_MAILBOX, $this->save_in_mailbox);
+
+ return $criteria;
+ }
+
+
+ public function buildPkeyCriteria()
+ {
+ $criteria = new Criteria(AddressPeer::DATABASE_NAME);
+
+ $criteria->add(AddressPeer::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->setMailboxId($this->mailbox_id);
+
+ $copyObj->setLocalpart($this->localpart);
+
+ $copyObj->setDomainId($this->domain_id);
+
+ $copyObj->setAlias($this->alias);
+
+ $copyObj->setDestination($this->destination);
+
+ $copyObj->setActive($this->active);
+
+ $copyObj->setSaveInMailbox($this->save_in_mailbox);
+
+
+ $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 AddressPeer();
+ }
+ return self::$peer;
+ }
+
+
+ public function setMailbox($v)
+ {
+
+
+ if ($v === null) {
+ $this->setMailboxId(NULL);
+ } else {
+ $this->setMailboxId($v->getId());
+ }
+
+
+ $this->aMailbox = $v;
+ }
+
+
+
+ public function getMailbox($con = null)
+ {
+ include_once 'lib/model/om/BaseMailboxPeer.php';
+
+ if ($this->aMailbox === null && ($this->mailbox_id !== null)) {
+
+ $this->aMailbox = MailboxPeer::retrieveByPK($this->mailbox_id, $con);
+
+
+ }
+ return $this->aMailbox;
+ }
+
+
+ public function setDomain($v)
+ {
+
+
+ if ($v === null) {
+ $this->setDomainId(NULL);
+ } else {
+ $this->setDomainId($v->getId());
+ }
+
+
+ $this->aDomain = $v;
+ }
+
+
+
+ public function getDomain($con = null)
+ {
+ include_once 'lib/model/om/BaseDomainPeer.php';
+
+ if ($this->aDomain === null && ($this->domain_id !== null)) {
+
+ $this->aDomain = DomainPeer::retrieveByPK($this->domain_id, $con);
+
+
+ }
+ return $this->aDomain;
+ }
+
+} \ No newline at end of file