From 9f108dd1a969473375341d92a7b1252fa2cedc9a Mon Sep 17 00:00:00 2001 From: mszulecki Date: Thu, 14 Jun 2007 17:09:01 +0000 Subject: Initial import. git-svn-id: http://svn.sukimashita.com/repos/mailadmin/trunk@2 4281df72-ff29-0410-8fee-2d9ac0c5f5a7 --- lib/model/om/BaseDomainPermission.php | 461 ++++++++++++++++++++++++++++++++++ 1 file changed, 461 insertions(+) create mode 100644 lib/model/om/BaseDomainPermission.php (limited to 'lib/model/om/BaseDomainPermission.php') diff --git a/lib/model/om/BaseDomainPermission.php b/lib/model/om/BaseDomainPermission.php new file mode 100644 index 0000000..48a6e89 --- /dev/null +++ b/lib/model/om/BaseDomainPermission.php @@ -0,0 +1,461 @@ +user_id; + } + + + public function getDomainId() + { + + return $this->domain_id; + } + + + public function getId() + { + + return $this->id; + } + + + public function setUserId($v) + { + + if ($v !== null && !is_int($v) && is_numeric($v)) { + $v = (int) $v; + } + + if ($this->user_id !== $v) { + $this->user_id = $v; + $this->modifiedColumns[] = DomainPermissionPeer::USER_ID; + } + + if ($this->aUser !== null && $this->aUser->getId() !== $v) { + $this->aUser = null; + } + + } + + 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[] = DomainPermissionPeer::DOMAIN_ID; + } + + if ($this->aDomain !== null && $this->aDomain->getId() !== $v) { + $this->aDomain = null; + } + + } + + 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[] = DomainPermissionPeer::ID; + } + + } + + public function hydrate(ResultSet $rs, $startcol = 1) + { + try { + + $this->user_id = $rs->getInt($startcol + 0); + + $this->domain_id = $rs->getInt($startcol + 1); + + $this->id = $rs->getInt($startcol + 2); + + $this->resetModified(); + + $this->setNew(false); + + return $startcol + 3; + } catch (Exception $e) { + throw new PropelException("Error populating DomainPermission 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(DomainPermissionPeer::DATABASE_NAME); + } + + try { + $con->begin(); + DomainPermissionPeer::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(DomainPermissionPeer::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->aDomain !== null) { + if ($this->aDomain->isModified()) { + $affectedRows += $this->aDomain->save($con); + } + $this->setDomain($this->aDomain); + } + + + if ($this->isModified()) { + if ($this->isNew()) { + $pk = DomainPermissionPeer::doInsert($this, $con); + $affectedRows += 1; + $this->setId($pk); + $this->setNew(false); + } else { + $affectedRows += DomainPermissionPeer::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 ($this->aDomain !== null) { + if (!$this->aDomain->validate($columns)) { + $failureMap = array_merge($failureMap, $this->aDomain->getValidationFailures()); + } + } + + + if (($retval = DomainPermissionPeer::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 = DomainPermissionPeer::translateFieldName($name, $type, BasePeer::TYPE_NUM); + return $this->getByPosition($pos); + } + + + public function getByPosition($pos) + { + switch($pos) { + case 0: + return $this->getUserId(); + break; + case 1: + return $this->getDomainId(); + break; + case 2: + return $this->getId(); + break; + default: + return null; + break; + } } + + + public function toArray($keyType = BasePeer::TYPE_PHPNAME) + { + $keys = DomainPermissionPeer::getFieldNames($keyType); + $result = array( + $keys[0] => $this->getUserId(), + $keys[1] => $this->getDomainId(), + $keys[2] => $this->getId(), + ); + return $result; + } + + + public function setByName($name, $value, $type = BasePeer::TYPE_PHPNAME) + { + $pos = DomainPermissionPeer::translateFieldName($name, $type, BasePeer::TYPE_NUM); + return $this->setByPosition($pos, $value); + } + + + public function setByPosition($pos, $value) + { + switch($pos) { + case 0: + $this->setUserId($value); + break; + case 1: + $this->setDomainId($value); + break; + case 2: + $this->setId($value); + break; + } } + + + public function fromArray($arr, $keyType = BasePeer::TYPE_PHPNAME) + { + $keys = DomainPermissionPeer::getFieldNames($keyType); + + if (array_key_exists($keys[0], $arr)) $this->setUserId($arr[$keys[0]]); + if (array_key_exists($keys[1], $arr)) $this->setDomainId($arr[$keys[1]]); + if (array_key_exists($keys[2], $arr)) $this->setId($arr[$keys[2]]); + } + + + public function buildCriteria() + { + $criteria = new Criteria(DomainPermissionPeer::DATABASE_NAME); + + if ($this->isColumnModified(DomainPermissionPeer::USER_ID)) $criteria->add(DomainPermissionPeer::USER_ID, $this->user_id); + if ($this->isColumnModified(DomainPermissionPeer::DOMAIN_ID)) $criteria->add(DomainPermissionPeer::DOMAIN_ID, $this->domain_id); + if ($this->isColumnModified(DomainPermissionPeer::ID)) $criteria->add(DomainPermissionPeer::ID, $this->id); + + return $criteria; + } + + + public function buildPkeyCriteria() + { + $criteria = new Criteria(DomainPermissionPeer::DATABASE_NAME); + + $criteria->add(DomainPermissionPeer::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->setDomainId($this->domain_id); + + + $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 DomainPermissionPeer(); + } + 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; + } + + + 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 -- cgit v1.1-32-gdbae