summaryrefslogtreecommitdiffstats
path: root/lib/model/om
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
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')
-rw-r--r--lib/model/om/BaseAddress.php643
-rw-r--r--lib/model/om/BaseAddressPeer.php834
-rw-r--r--lib/model/om/BaseDomain.php926
-rw-r--r--lib/model/om/BaseDomainPeer.php591
-rw-r--r--lib/model/om/BaseDomainPermission.php461
-rw-r--r--lib/model/om/BaseDomainPermissionPeer.php809
-rw-r--r--lib/model/om/BaseLogEntry.php548
-rw-r--r--lib/model/om/BaseLogEntryPeer.php549
-rw-r--r--lib/model/om/BaseMailbox.php751
-rw-r--r--lib/model/om/BaseMailboxPeer.php579
-rw-r--r--lib/model/om/BaseRole.php493
-rw-r--r--lib/model/om/BaseRolePeer.php373
-rw-r--r--lib/model/om/BaseUser.php1261
-rw-r--r--lib/model/om/BaseUserPeer.php758
14 files changed, 9576 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
diff --git a/lib/model/om/BaseAddressPeer.php b/lib/model/om/BaseAddressPeer.php
new file mode 100644
index 0000000..acc23cb
--- /dev/null
+++ b/lib/model/om/BaseAddressPeer.php
@@ -0,0 +1,834 @@
+<?php
+
+
+abstract class BaseAddressPeer {
+
+
+ const DATABASE_NAME = 'propel';
+
+
+ const TABLE_NAME = 'address';
+
+
+ const CLASS_DEFAULT = 'lib.model.Address';
+
+
+ const NUM_COLUMNS = 8;
+
+
+ const NUM_LAZY_LOAD_COLUMNS = 0;
+
+
+
+ const ID = 'address.ID';
+
+
+ const MAILBOX_ID = 'address.MAILBOX_ID';
+
+
+ const LOCALPART = 'address.LOCALPART';
+
+
+ const DOMAIN_ID = 'address.DOMAIN_ID';
+
+
+ const ALIAS = 'address.ALIAS';
+
+
+ const DESTINATION = 'address.DESTINATION';
+
+
+ const ACTIVE = 'address.ACTIVE';
+
+
+ const SAVE_IN_MAILBOX = 'address.SAVE_IN_MAILBOX';
+
+
+ private static $phpNameMap = null;
+
+
+
+ private static $fieldNames = array (
+ BasePeer::TYPE_PHPNAME => array ('Id', 'MailboxId', 'Localpart', 'DomainId', 'Alias', 'Destination', 'Active', 'SaveInMailbox', ),
+ BasePeer::TYPE_COLNAME => array (AddressPeer::ID, AddressPeer::MAILBOX_ID, AddressPeer::LOCALPART, AddressPeer::DOMAIN_ID, AddressPeer::ALIAS, AddressPeer::DESTINATION, AddressPeer::ACTIVE, AddressPeer::SAVE_IN_MAILBOX, ),
+ BasePeer::TYPE_FIELDNAME => array ('id', 'mailbox_id', 'localpart', 'domain_id', 'alias', 'destination', 'active', 'save_in_mailbox', ),
+ BasePeer::TYPE_NUM => array (0, 1, 2, 3, 4, 5, 6, 7, )
+ );
+
+
+ private static $fieldKeys = array (
+ BasePeer::TYPE_PHPNAME => array ('Id' => 0, 'MailboxId' => 1, 'Localpart' => 2, 'DomainId' => 3, 'Alias' => 4, 'Destination' => 5, 'Active' => 6, 'SaveInMailbox' => 7, ),
+ BasePeer::TYPE_COLNAME => array (AddressPeer::ID => 0, AddressPeer::MAILBOX_ID => 1, AddressPeer::LOCALPART => 2, AddressPeer::DOMAIN_ID => 3, AddressPeer::ALIAS => 4, AddressPeer::DESTINATION => 5, AddressPeer::ACTIVE => 6, AddressPeer::SAVE_IN_MAILBOX => 7, ),
+ BasePeer::TYPE_FIELDNAME => array ('id' => 0, 'mailbox_id' => 1, 'localpart' => 2, 'domain_id' => 3, 'alias' => 4, 'destination' => 5, 'active' => 6, 'save_in_mailbox' => 7, ),
+ BasePeer::TYPE_NUM => array (0, 1, 2, 3, 4, 5, 6, 7, )
+ );
+
+
+ public static function getMapBuilder()
+ {
+ include_once 'lib/model/map/AddressMapBuilder.php';
+ return BasePeer::getMapBuilder('lib.model.map.AddressMapBuilder');
+ }
+
+ public static function getPhpNameMap()
+ {
+ if (self::$phpNameMap === null) {
+ $map = AddressPeer::getTableMap();
+ $columns = $map->getColumns();
+ $nameMap = array();
+ foreach ($columns as $column) {
+ $nameMap[$column->getPhpName()] = $column->getColumnName();
+ }
+ self::$phpNameMap = $nameMap;
+ }
+ return self::$phpNameMap;
+ }
+
+ static public function translateFieldName($name, $fromType, $toType)
+ {
+ $toNames = self::getFieldNames($toType);
+ $key = isset(self::$fieldKeys[$fromType][$name]) ? self::$fieldKeys[$fromType][$name] : null;
+ if ($key === null) {
+ throw new PropelException("'$name' could not be found in the field names of type '$fromType'. These are: " . print_r(self::$fieldKeys[$fromType], true));
+ }
+ return $toNames[$key];
+ }
+
+
+
+ static public function getFieldNames($type = BasePeer::TYPE_PHPNAME)
+ {
+ if (!array_key_exists($type, self::$fieldNames)) {
+ throw new PropelException('Method getFieldNames() expects the parameter $type to be one of the class constants TYPE_PHPNAME, TYPE_COLNAME, TYPE_FIELDNAME, TYPE_NUM. ' . $type . ' was given.');
+ }
+ return self::$fieldNames[$type];
+ }
+
+
+ public static function alias($alias, $column)
+ {
+ return str_replace(AddressPeer::TABLE_NAME.'.', $alias.'.', $column);
+ }
+
+
+ public static function addSelectColumns(Criteria $criteria)
+ {
+
+ $criteria->addSelectColumn(AddressPeer::ID);
+
+ $criteria->addSelectColumn(AddressPeer::MAILBOX_ID);
+
+ $criteria->addSelectColumn(AddressPeer::LOCALPART);
+
+ $criteria->addSelectColumn(AddressPeer::DOMAIN_ID);
+
+ $criteria->addSelectColumn(AddressPeer::ALIAS);
+
+ $criteria->addSelectColumn(AddressPeer::DESTINATION);
+
+ $criteria->addSelectColumn(AddressPeer::ACTIVE);
+
+ $criteria->addSelectColumn(AddressPeer::SAVE_IN_MAILBOX);
+
+ }
+
+ const COUNT = 'COUNT(address.ID)';
+ const COUNT_DISTINCT = 'COUNT(DISTINCT address.ID)';
+
+
+ public static function doCount(Criteria $criteria, $distinct = false, $con = null)
+ {
+ $criteria = clone $criteria;
+
+ $criteria->clearSelectColumns()->clearOrderByColumns();
+ if ($distinct || in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) {
+ $criteria->addSelectColumn(AddressPeer::COUNT_DISTINCT);
+ } else {
+ $criteria->addSelectColumn(AddressPeer::COUNT);
+ }
+
+ foreach($criteria->getGroupByColumns() as $column)
+ {
+ $criteria->addSelectColumn($column);
+ }
+
+ $rs = AddressPeer::doSelectRS($criteria, $con);
+ if ($rs->next()) {
+ return $rs->getInt(1);
+ } else {
+ return 0;
+ }
+ }
+
+ public static function doSelectOne(Criteria $criteria, $con = null)
+ {
+ $critcopy = clone $criteria;
+ $critcopy->setLimit(1);
+ $objects = AddressPeer::doSelect($critcopy, $con);
+ if ($objects) {
+ return $objects[0];
+ }
+ return null;
+ }
+
+ public static function doSelect(Criteria $criteria, $con = null)
+ {
+ return AddressPeer::populateObjects(AddressPeer::doSelectRS($criteria, $con));
+ }
+
+ public static function doSelectRS(Criteria $criteria, $con = null)
+ {
+ if ($con === null) {
+ $con = Propel::getConnection(self::DATABASE_NAME);
+ }
+
+ if (!$criteria->getSelectColumns()) {
+ $criteria = clone $criteria;
+ AddressPeer::addSelectColumns($criteria);
+ }
+
+ $criteria->setDbName(self::DATABASE_NAME);
+
+ return BasePeer::doSelect($criteria, $con);
+ }
+
+ public static function populateObjects(ResultSet $rs)
+ {
+ $results = array();
+
+ $cls = AddressPeer::getOMClass();
+ $cls = Propel::import($cls);
+ while($rs->next()) {
+
+ $obj = new $cls();
+ $obj->hydrate($rs);
+ $results[] = $obj;
+
+ }
+ return $results;
+ }
+
+
+ public static function doCountJoinMailbox(Criteria $criteria, $distinct = false, $con = null)
+ {
+ $criteria = clone $criteria;
+
+ $criteria->clearSelectColumns()->clearOrderByColumns();
+ if ($distinct || in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) {
+ $criteria->addSelectColumn(AddressPeer::COUNT_DISTINCT);
+ } else {
+ $criteria->addSelectColumn(AddressPeer::COUNT);
+ }
+
+ foreach($criteria->getGroupByColumns() as $column)
+ {
+ $criteria->addSelectColumn($column);
+ }
+
+ $criteria->addJoin(AddressPeer::MAILBOX_ID, MailboxPeer::ID);
+
+ $rs = AddressPeer::doSelectRS($criteria, $con);
+ if ($rs->next()) {
+ return $rs->getInt(1);
+ } else {
+ return 0;
+ }
+ }
+
+
+
+ public static function doCountJoinDomain(Criteria $criteria, $distinct = false, $con = null)
+ {
+ $criteria = clone $criteria;
+
+ $criteria->clearSelectColumns()->clearOrderByColumns();
+ if ($distinct || in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) {
+ $criteria->addSelectColumn(AddressPeer::COUNT_DISTINCT);
+ } else {
+ $criteria->addSelectColumn(AddressPeer::COUNT);
+ }
+
+ foreach($criteria->getGroupByColumns() as $column)
+ {
+ $criteria->addSelectColumn($column);
+ }
+
+ $criteria->addJoin(AddressPeer::DOMAIN_ID, DomainPeer::ID);
+
+ $rs = AddressPeer::doSelectRS($criteria, $con);
+ if ($rs->next()) {
+ return $rs->getInt(1);
+ } else {
+ return 0;
+ }
+ }
+
+
+
+ public static function doSelectJoinMailbox(Criteria $c, $con = null)
+ {
+ $c = clone $c;
+
+ if ($c->getDbName() == Propel::getDefaultDB()) {
+ $c->setDbName(self::DATABASE_NAME);
+ }
+
+ AddressPeer::addSelectColumns($c);
+ $startcol = (AddressPeer::NUM_COLUMNS - AddressPeer::NUM_LAZY_LOAD_COLUMNS) + 1;
+ MailboxPeer::addSelectColumns($c);
+
+ $c->addJoin(AddressPeer::MAILBOX_ID, MailboxPeer::ID);
+ $rs = BasePeer::doSelect($c, $con);
+ $results = array();
+
+ while($rs->next()) {
+
+ $omClass = AddressPeer::getOMClass();
+
+ $cls = Propel::import($omClass);
+ $obj1 = new $cls();
+ $obj1->hydrate($rs);
+
+ $omClass = MailboxPeer::getOMClass();
+
+ $cls = Propel::import($omClass);
+ $obj2 = new $cls();
+ $obj2->hydrate($rs, $startcol);
+
+ $newObject = true;
+ foreach($results as $temp_obj1) {
+ $temp_obj2 = $temp_obj1->getMailbox(); if ($temp_obj2->getPrimaryKey() === $obj2->getPrimaryKey()) {
+ $newObject = false;
+ $temp_obj2->addAddress($obj1); break;
+ }
+ }
+ if ($newObject) {
+ $obj2->initAddresss();
+ $obj2->addAddress($obj1); }
+ $results[] = $obj1;
+ }
+ return $results;
+ }
+
+
+
+ public static function doSelectJoinDomain(Criteria $c, $con = null)
+ {
+ $c = clone $c;
+
+ if ($c->getDbName() == Propel::getDefaultDB()) {
+ $c->setDbName(self::DATABASE_NAME);
+ }
+
+ AddressPeer::addSelectColumns($c);
+ $startcol = (AddressPeer::NUM_COLUMNS - AddressPeer::NUM_LAZY_LOAD_COLUMNS) + 1;
+ DomainPeer::addSelectColumns($c);
+
+ $c->addJoin(AddressPeer::DOMAIN_ID, DomainPeer::ID);
+ $rs = BasePeer::doSelect($c, $con);
+ $results = array();
+
+ while($rs->next()) {
+
+ $omClass = AddressPeer::getOMClass();
+
+ $cls = Propel::import($omClass);
+ $obj1 = new $cls();
+ $obj1->hydrate($rs);
+
+ $omClass = DomainPeer::getOMClass();
+
+ $cls = Propel::import($omClass);
+ $obj2 = new $cls();
+ $obj2->hydrate($rs, $startcol);
+
+ $newObject = true;
+ foreach($results as $temp_obj1) {
+ $temp_obj2 = $temp_obj1->getDomain(); if ($temp_obj2->getPrimaryKey() === $obj2->getPrimaryKey()) {
+ $newObject = false;
+ $temp_obj2->addAddress($obj1); break;
+ }
+ }
+ if ($newObject) {
+ $obj2->initAddresss();
+ $obj2->addAddress($obj1); }
+ $results[] = $obj1;
+ }
+ return $results;
+ }
+
+
+
+ public static function doCountJoinAll(Criteria $criteria, $distinct = false, $con = null)
+ {
+ $criteria = clone $criteria;
+
+ $criteria->clearSelectColumns()->clearOrderByColumns();
+ if ($distinct || in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) {
+ $criteria->addSelectColumn(AddressPeer::COUNT_DISTINCT);
+ } else {
+ $criteria->addSelectColumn(AddressPeer::COUNT);
+ }
+
+ foreach($criteria->getGroupByColumns() as $column)
+ {
+ $criteria->addSelectColumn($column);
+ }
+
+ $criteria->addJoin(AddressPeer::MAILBOX_ID, MailboxPeer::ID);
+
+ $criteria->addJoin(AddressPeer::DOMAIN_ID, DomainPeer::ID);
+
+ $rs = AddressPeer::doSelectRS($criteria, $con);
+ if ($rs->next()) {
+ return $rs->getInt(1);
+ } else {
+ return 0;
+ }
+ }
+
+
+
+ public static function doSelectJoinAll(Criteria $c, $con = null)
+ {
+ $c = clone $c;
+
+ if ($c->getDbName() == Propel::getDefaultDB()) {
+ $c->setDbName(self::DATABASE_NAME);
+ }
+
+ AddressPeer::addSelectColumns($c);
+ $startcol2 = (AddressPeer::NUM_COLUMNS - AddressPeer::NUM_LAZY_LOAD_COLUMNS) + 1;
+
+ MailboxPeer::addSelectColumns($c);
+ $startcol3 = $startcol2 + MailboxPeer::NUM_COLUMNS;
+
+ DomainPeer::addSelectColumns($c);
+ $startcol4 = $startcol3 + DomainPeer::NUM_COLUMNS;
+
+ $c->addJoin(AddressPeer::MAILBOX_ID, MailboxPeer::ID);
+
+ $c->addJoin(AddressPeer::DOMAIN_ID, DomainPeer::ID);
+
+ $rs = BasePeer::doSelect($c, $con);
+ $results = array();
+
+ while($rs->next()) {
+
+ $omClass = AddressPeer::getOMClass();
+
+
+ $cls = Propel::import($omClass);
+ $obj1 = new $cls();
+ $obj1->hydrate($rs);
+
+
+
+ $omClass = MailboxPeer::getOMClass();
+
+
+ $cls = Propel::import($omClass);
+ $obj2 = new $cls();
+ $obj2->hydrate($rs, $startcol2);
+
+ $newObject = true;
+ for ($j=0, $resCount=count($results); $j < $resCount; $j++) {
+ $temp_obj1 = $results[$j];
+ $temp_obj2 = $temp_obj1->getMailbox(); if ($temp_obj2->getPrimaryKey() === $obj2->getPrimaryKey()) {
+ $newObject = false;
+ $temp_obj2->addAddress($obj1); break;
+ }
+ }
+
+ if ($newObject) {
+ $obj2->initAddresss();
+ $obj2->addAddress($obj1);
+ }
+
+
+
+ $omClass = DomainPeer::getOMClass();
+
+
+ $cls = Propel::import($omClass);
+ $obj3 = new $cls();
+ $obj3->hydrate($rs, $startcol3);
+
+ $newObject = true;
+ for ($j=0, $resCount=count($results); $j < $resCount; $j++) {
+ $temp_obj1 = $results[$j];
+ $temp_obj3 = $temp_obj1->getDomain(); if ($temp_obj3->getPrimaryKey() === $obj3->getPrimaryKey()) {
+ $newObject = false;
+ $temp_obj3->addAddress($obj1); break;
+ }
+ }
+
+ if ($newObject) {
+ $obj3->initAddresss();
+ $obj3->addAddress($obj1);
+ }
+
+ $results[] = $obj1;
+ }
+ return $results;
+ }
+
+
+
+ public static function doCountJoinAllExceptMailbox(Criteria $criteria, $distinct = false, $con = null)
+ {
+ $criteria = clone $criteria;
+
+ $criteria->clearSelectColumns()->clearOrderByColumns();
+ if ($distinct || in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) {
+ $criteria->addSelectColumn(AddressPeer::COUNT_DISTINCT);
+ } else {
+ $criteria->addSelectColumn(AddressPeer::COUNT);
+ }
+
+ foreach($criteria->getGroupByColumns() as $column)
+ {
+ $criteria->addSelectColumn($column);
+ }
+
+ $criteria->addJoin(AddressPeer::DOMAIN_ID, DomainPeer::ID);
+
+ $rs = AddressPeer::doSelectRS($criteria, $con);
+ if ($rs->next()) {
+ return $rs->getInt(1);
+ } else {
+ return 0;
+ }
+ }
+
+
+
+ public static function doCountJoinAllExceptDomain(Criteria $criteria, $distinct = false, $con = null)
+ {
+ $criteria = clone $criteria;
+
+ $criteria->clearSelectColumns()->clearOrderByColumns();
+ if ($distinct || in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) {
+ $criteria->addSelectColumn(AddressPeer::COUNT_DISTINCT);
+ } else {
+ $criteria->addSelectColumn(AddressPeer::COUNT);
+ }
+
+ foreach($criteria->getGroupByColumns() as $column)
+ {
+ $criteria->addSelectColumn($column);
+ }
+
+ $criteria->addJoin(AddressPeer::MAILBOX_ID, MailboxPeer::ID);
+
+ $rs = AddressPeer::doSelectRS($criteria, $con);
+ if ($rs->next()) {
+ return $rs->getInt(1);
+ } else {
+ return 0;
+ }
+ }
+
+
+
+ public static function doSelectJoinAllExceptMailbox(Criteria $c, $con = null)
+ {
+ $c = clone $c;
+
+ if ($c->getDbName() == Propel::getDefaultDB()) {
+ $c->setDbName(self::DATABASE_NAME);
+ }
+
+ AddressPeer::addSelectColumns($c);
+ $startcol2 = (AddressPeer::NUM_COLUMNS - AddressPeer::NUM_LAZY_LOAD_COLUMNS) + 1;
+
+ DomainPeer::addSelectColumns($c);
+ $startcol3 = $startcol2 + DomainPeer::NUM_COLUMNS;
+
+ $c->addJoin(AddressPeer::DOMAIN_ID, DomainPeer::ID);
+
+
+ $rs = BasePeer::doSelect($c, $con);
+ $results = array();
+
+ while($rs->next()) {
+
+ $omClass = AddressPeer::getOMClass();
+
+ $cls = Propel::import($omClass);
+ $obj1 = new $cls();
+ $obj1->hydrate($rs);
+
+ $omClass = DomainPeer::getOMClass();
+
+
+ $cls = Propel::import($omClass);
+ $obj2 = new $cls();
+ $obj2->hydrate($rs, $startcol2);
+
+ $newObject = true;
+ for ($j=0, $resCount=count($results); $j < $resCount; $j++) {
+ $temp_obj1 = $results[$j];
+ $temp_obj2 = $temp_obj1->getDomain(); if ($temp_obj2->getPrimaryKey() === $obj2->getPrimaryKey()) {
+ $newObject = false;
+ $temp_obj2->addAddress($obj1);
+ break;
+ }
+ }
+
+ if ($newObject) {
+ $obj2->initAddresss();
+ $obj2->addAddress($obj1);
+ }
+
+ $results[] = $obj1;
+ }
+ return $results;
+ }
+
+
+
+ public static function doSelectJoinAllExceptDomain(Criteria $c, $con = null)
+ {
+ $c = clone $c;
+
+ if ($c->getDbName() == Propel::getDefaultDB()) {
+ $c->setDbName(self::DATABASE_NAME);
+ }
+
+ AddressPeer::addSelectColumns($c);
+ $startcol2 = (AddressPeer::NUM_COLUMNS - AddressPeer::NUM_LAZY_LOAD_COLUMNS) + 1;
+
+ MailboxPeer::addSelectColumns($c);
+ $startcol3 = $startcol2 + MailboxPeer::NUM_COLUMNS;
+
+ $c->addJoin(AddressPeer::MAILBOX_ID, MailboxPeer::ID);
+
+
+ $rs = BasePeer::doSelect($c, $con);
+ $results = array();
+
+ while($rs->next()) {
+
+ $omClass = AddressPeer::getOMClass();
+
+ $cls = Propel::import($omClass);
+ $obj1 = new $cls();
+ $obj1->hydrate($rs);
+
+ $omClass = MailboxPeer::getOMClass();
+
+
+ $cls = Propel::import($omClass);
+ $obj2 = new $cls();
+ $obj2->hydrate($rs, $startcol2);
+
+ $newObject = true;
+ for ($j=0, $resCount=count($results); $j < $resCount; $j++) {
+ $temp_obj1 = $results[$j];
+ $temp_obj2 = $temp_obj1->getMailbox(); if ($temp_obj2->getPrimaryKey() === $obj2->getPrimaryKey()) {
+ $newObject = false;
+ $temp_obj2->addAddress($obj1);
+ break;
+ }
+ }
+
+ if ($newObject) {
+ $obj2->initAddresss();
+ $obj2->addAddress($obj1);
+ }
+
+ $results[] = $obj1;
+ }
+ return $results;
+ }
+
+
+ public static function getTableMap()
+ {
+ return Propel::getDatabaseMap(self::DATABASE_NAME)->getTable(self::TABLE_NAME);
+ }
+
+
+ public static function getOMClass()
+ {
+ return AddressPeer::CLASS_DEFAULT;
+ }
+
+
+ public static function doInsert($values, $con = null)
+ {
+ if ($con === null) {
+ $con = Propel::getConnection(self::DATABASE_NAME);
+ }
+
+ if ($values instanceof Criteria) {
+ $criteria = clone $values; } else {
+ $criteria = $values->buildCriteria(); }
+
+ $criteria->remove(AddressPeer::ID);
+
+ $criteria->setDbName(self::DATABASE_NAME);
+
+ try {
+ $con->begin();
+ $pk = BasePeer::doInsert($criteria, $con);
+ $con->commit();
+ } catch(PropelException $e) {
+ $con->rollback();
+ throw $e;
+ }
+
+ return $pk;
+ }
+
+
+ public static function doUpdate($values, $con = null)
+ {
+ if ($con === null) {
+ $con = Propel::getConnection(self::DATABASE_NAME);
+ }
+
+ $selectCriteria = new Criteria(self::DATABASE_NAME);
+
+ if ($values instanceof Criteria) {
+ $criteria = clone $values;
+ $comparison = $criteria->getComparison(AddressPeer::ID);
+ $selectCriteria->add(AddressPeer::ID, $criteria->remove(AddressPeer::ID), $comparison);
+
+ } else { $criteria = $values->buildCriteria(); $selectCriteria = $values->buildPkeyCriteria(); }
+
+ $criteria->setDbName(self::DATABASE_NAME);
+
+ return BasePeer::doUpdate($selectCriteria, $criteria, $con);
+ }
+
+
+ public static function doDeleteAll($con = null)
+ {
+ if ($con === null) {
+ $con = Propel::getConnection(self::DATABASE_NAME);
+ }
+ $affectedRows = 0; try {
+ $con->begin();
+ $affectedRows += BasePeer::doDeleteAll(AddressPeer::TABLE_NAME, $con);
+ $con->commit();
+ return $affectedRows;
+ } catch (PropelException $e) {
+ $con->rollback();
+ throw $e;
+ }
+ }
+
+
+ public static function doDelete($values, $con = null)
+ {
+ if ($con === null) {
+ $con = Propel::getConnection(AddressPeer::DATABASE_NAME);
+ }
+
+ if ($values instanceof Criteria) {
+ $criteria = clone $values; } elseif ($values instanceof Address) {
+
+ $criteria = $values->buildPkeyCriteria();
+ } else {
+ $criteria = new Criteria(self::DATABASE_NAME);
+ $criteria->add(AddressPeer::ID, (array) $values, Criteria::IN);
+ }
+
+ $criteria->setDbName(self::DATABASE_NAME);
+
+ $affectedRows = 0;
+ try {
+ $con->begin();
+
+ $affectedRows += BasePeer::doDelete($criteria, $con);
+ $con->commit();
+ return $affectedRows;
+ } catch (PropelException $e) {
+ $con->rollback();
+ throw $e;
+ }
+ }
+
+
+ public static function doValidate(Address $obj, $cols = null)
+ {
+ $columns = array();
+
+ if ($cols) {
+ $dbMap = Propel::getDatabaseMap(AddressPeer::DATABASE_NAME);
+ $tableMap = $dbMap->getTable(AddressPeer::TABLE_NAME);
+
+ if (! is_array($cols)) {
+ $cols = array($cols);
+ }
+
+ foreach($cols as $colName) {
+ if ($tableMap->containsColumn($colName)) {
+ $get = 'get' . $tableMap->getColumn($colName)->getPhpName();
+ $columns[$colName] = $obj->$get();
+ }
+ }
+ } else {
+
+ }
+
+ $res = BasePeer::doValidate(AddressPeer::DATABASE_NAME, AddressPeer::TABLE_NAME, $columns);
+ if ($res !== true) {
+ $request = sfContext::getInstance()->getRequest();
+ foreach ($res as $failed) {
+ $col = AddressPeer::translateFieldname($failed->getColumn(), BasePeer::TYPE_COLNAME, BasePeer::TYPE_PHPNAME);
+ $request->setError($col, $failed->getMessage());
+ }
+ }
+
+ return $res;
+ }
+
+
+ public static function retrieveByPK($pk, $con = null)
+ {
+ if ($con === null) {
+ $con = Propel::getConnection(self::DATABASE_NAME);
+ }
+
+ $criteria = new Criteria(AddressPeer::DATABASE_NAME);
+
+ $criteria->add(AddressPeer::ID, $pk);
+
+
+ $v = AddressPeer::doSelect($criteria, $con);
+
+ return !empty($v) > 0 ? $v[0] : null;
+ }
+
+
+ public static function retrieveByPKs($pks, $con = null)
+ {
+ if ($con === null) {
+ $con = Propel::getConnection(self::DATABASE_NAME);
+ }
+
+ $objs = null;
+ if (empty($pks)) {
+ $objs = array();
+ } else {
+ $criteria = new Criteria();
+ $criteria->add(AddressPeer::ID, $pks, Criteria::IN);
+ $objs = AddressPeer::doSelect($criteria, $con);
+ }
+ return $objs;
+ }
+
+}
+if (Propel::isInit()) {
+ try {
+ BaseAddressPeer::getMapBuilder();
+ } catch (Exception $e) {
+ Propel::log('Could not initialize Peer: ' . $e->getMessage(), Propel::LOG_ERR);
+ }
+} else {
+ require_once 'lib/model/map/AddressMapBuilder.php';
+ Propel::registerMapBuilder('lib.model.map.AddressMapBuilder');
+}
diff --git a/lib/model/om/BaseDomain.php b/lib/model/om/BaseDomain.php
new file mode 100644
index 0000000..0c8317c
--- /dev/null
+++ b/lib/model/om/BaseDomain.php
@@ -0,0 +1,926 @@
+<?php
+
+
+abstract class BaseDomain extends BaseObject implements Persistent {
+
+
+
+ protected static $peer;
+
+
+
+ protected $id;
+
+
+
+ protected $name;
+
+
+
+ protected $creator_id;
+
+
+
+ protected $mailbox_prefix;
+
+
+
+ protected $max_mailbox_count;
+
+
+
+ protected $quota;
+
+
+
+ protected $default_mailbox_quota;
+
+
+ protected $aUser;
+
+
+ protected $collDomainPermissions;
+
+
+ protected $lastDomainPermissionCriteria = null;
+
+
+ protected $collMailboxs;
+
+
+ protected $lastMailboxCriteria = null;
+
+
+ protected $collAddresss;
+
+
+ protected $lastAddressCriteria = null;
+
+
+ protected $alreadyInSave = false;
+
+
+ protected $alreadyInValidation = false;
+
+
+ public function getId()
+ {
+
+ return $this->id;
+ }
+
+
+ public function getName()
+ {
+
+ return $this->name;
+ }
+
+
+ public function getCreatorId()
+ {
+
+ return $this->creator_id;
+ }
+
+
+ public function getMailboxPrefix()
+ {
+
+ return $this->mailbox_prefix;
+ }
+
+
+ public function getMaxMailboxCount()
+ {
+
+ return $this->max_mailbox_count;
+ }
+
+
+ public function getQuota()
+ {
+
+ return $this->quota;
+ }
+
+
+ public function getDefaultMailboxQuota()
+ {
+
+ return $this->default_mailbox_quota;
+ }
+
+
+ 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[] = DomainPeer::ID;
+ }
+
+ }
+
+ public function setName($v)
+ {
+
+ if ($v !== null && !is_string($v)) {
+ $v = (string) $v;
+ }
+
+ if ($this->name !== $v) {
+ $this->name = $v;
+ $this->modifiedColumns[] = DomainPeer::NAME;
+ }
+
+ }
+
+ public function setCreatorId($v)
+ {
+
+ if ($v !== null && !is_int($v) && is_numeric($v)) {
+ $v = (int) $v;
+ }
+
+ if ($this->creator_id !== $v) {
+ $this->creator_id = $v;
+ $this->modifiedColumns[] = DomainPeer::CREATOR_ID;
+ }
+
+ if ($this->aUser !== null && $this->aUser->getId() !== $v) {
+ $this->aUser = null;
+ }
+
+ }
+
+ public function setMailboxPrefix($v)
+ {
+
+ if ($v !== null && !is_string($v)) {
+ $v = (string) $v;
+ }
+
+ if ($this->mailbox_prefix !== $v) {
+ $this->mailbox_prefix = $v;
+ $this->modifiedColumns[] = DomainPeer::MAILBOX_PREFIX;
+ }
+
+ }
+
+ public function setMaxMailboxCount($v)
+ {
+
+ if ($v !== null && !is_int($v) && is_numeric($v)) {
+ $v = (int) $v;
+ }
+
+ if ($this->max_mailbox_count !== $v) {
+ $this->max_mailbox_count = $v;
+ $this->modifiedColumns[] = DomainPeer::MAX_MAILBOX_COUNT;
+ }
+
+ }
+
+ public function setQuota($v)
+ {
+
+ if ($v !== null && !is_int($v) && is_numeric($v)) {
+ $v = (int) $v;
+ }
+
+ if ($this->quota !== $v) {
+ $this->quota = $v;
+ $this->modifiedColumns[] = DomainPeer::QUOTA;
+ }
+
+ }
+
+ public function setDefaultMailboxQuota($v)
+ {
+
+ if ($v !== null && !is_int($v) && is_numeric($v)) {
+ $v = (int) $v;
+ }
+
+ if ($this->default_mailbox_quota !== $v) {
+ $this->default_mailbox_quota = $v;
+ $this->modifiedColumns[] = DomainPeer::DEFAULT_MAILBOX_QUOTA;
+ }
+
+ }
+
+ public function hydrate(ResultSet $rs, $startcol = 1)
+ {
+ try {
+
+ $this->id = $rs->getInt($startcol + 0);
+
+ $this->name = $rs->getString($startcol + 1);
+
+ $this->creator_id = $rs->getInt($startcol + 2);
+
+ $this->mailbox_prefix = $rs->getString($startcol + 3);
+
+ $this->max_mailbox_count = $rs->getInt($startcol + 4);
+
+ $this->quota = $rs->getInt($startcol + 5);
+
+ $this->default_mailbox_quota = $rs->getInt($startcol + 6);
+
+ $this->resetModified();
+
+ $this->setNew(false);
+
+ return $startcol + 7;
+ } catch (Exception $e) {
+ throw new PropelException("Error populating Domain 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(DomainPeer::DATABASE_NAME);
+ }
+
+ try {
+ $con->begin();
+ DomainPeer::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(DomainPeer::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 = DomainPeer::doInsert($this, $con);
+ $affectedRows += 1;
+ $this->setId($pk);
+ $this->setNew(false);
+ } else {
+ $affectedRows += DomainPeer::doUpdate($this, $con);
+ }
+ $this->resetModified(); }
+
+ if ($this->collDomainPermissions !== null) {
+ foreach($this->collDomainPermissions as $referrerFK) {
+ if (!$referrerFK->isDeleted()) {
+ $affectedRows += $referrerFK->save($con);
+ }
+ }
+ }
+
+ if ($this->collMailboxs !== null) {
+ foreach($this->collMailboxs as $referrerFK) {
+ if (!$referrerFK->isDeleted()) {
+ $affectedRows += $referrerFK->save($con);
+ }
+ }
+ }
+
+ if ($this->collAddresss !== null) {
+ foreach($this->collAddresss as $referrerFK) {
+ if (!$referrerFK->isDeleted()) {
+ $affectedRows += $referrerFK->save($con);
+ }
+ }
+ }
+
+ $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 = DomainPeer::doValidate($this, $columns)) !== true) {
+ $failureMap = array_merge($failureMap, $retval);
+ }
+
+
+ if ($this->collDomainPermissions !== null) {
+ foreach($this->collDomainPermissions as $referrerFK) {
+ if (!$referrerFK->validate($columns)) {
+ $failureMap = array_merge($failureMap, $referrerFK->getValidationFailures());
+ }
+ }
+ }
+
+ if ($this->collMailboxs !== null) {
+ foreach($this->collMailboxs as $referrerFK) {
+ if (!$referrerFK->validate($columns)) {
+ $failureMap = array_merge($failureMap, $referrerFK->getValidationFailures());
+ }
+ }
+ }
+
+ if ($this->collAddresss !== null) {
+ foreach($this->collAddresss as $referrerFK) {
+ if (!$referrerFK->validate($columns)) {
+ $failureMap = array_merge($failureMap, $referrerFK->getValidationFailures());
+ }
+ }
+ }
+
+
+ $this->alreadyInValidation = false;
+ }
+
+ return (!empty($failureMap) ? $failureMap : true);
+ }
+
+
+ public function getByName($name, $type = BasePeer::TYPE_PHPNAME)
+ {
+ $pos = DomainPeer::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->getName();
+ break;
+ case 2:
+ return $this->getCreatorId();
+ break;
+ case 3:
+ return $this->getMailboxPrefix();
+ break;
+ case 4:
+ return $this->getMaxMailboxCount();
+ break;
+ case 5:
+ return $this->getQuota();
+ break;
+ case 6:
+ return $this->getDefaultMailboxQuota();
+ break;
+ default:
+ return null;
+ break;
+ } }
+
+
+ public function toArray($keyType = BasePeer::TYPE_PHPNAME)
+ {
+ $keys = DomainPeer::getFieldNames($keyType);
+ $result = array(
+ $keys[0] => $this->getId(),
+ $keys[1] => $this->getName(),
+ $keys[2] => $this->getCreatorId(),
+ $keys[3] => $this->getMailboxPrefix(),
+ $keys[4] => $this->getMaxMailboxCount(),
+ $keys[5] => $this->getQuota(),
+ $keys[6] => $this->getDefaultMailboxQuota(),
+ );
+ return $result;
+ }
+
+
+ public function setByName($name, $value, $type = BasePeer::TYPE_PHPNAME)
+ {
+ $pos = DomainPeer::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->setName($value);
+ break;
+ case 2:
+ $this->setCreatorId($value);
+ break;
+ case 3:
+ $this->setMailboxPrefix($value);
+ break;
+ case 4:
+ $this->setMaxMailboxCount($value);
+ break;
+ case 5:
+ $this->setQuota($value);
+ break;
+ case 6:
+ $this->setDefaultMailboxQuota($value);
+ break;
+ } }
+
+
+ public function fromArray($arr, $keyType = BasePeer::TYPE_PHPNAME)
+ {
+ $keys = DomainPeer::getFieldNames($keyType);
+
+ if (array_key_exists($keys[0], $arr)) $this->setId($arr[$keys[0]]);
+ if (array_key_exists($keys[1], $arr)) $this->setName($arr[$keys[1]]);
+ if (array_key_exists($keys[2], $arr)) $this->setCreatorId($arr[$keys[2]]);
+ if (array_key_exists($keys[3], $arr)) $this->setMailboxPrefix($arr[$keys[3]]);
+ if (array_key_exists($keys[4], $arr)) $this->setMaxMailboxCount($arr[$keys[4]]);
+ if (array_key_exists($keys[5], $arr)) $this->setQuota($arr[$keys[5]]);
+ if (array_key_exists($keys[6], $arr)) $this->setDefaultMailboxQuota($arr[$keys[6]]);
+ }
+
+
+ public function buildCriteria()
+ {
+ $criteria = new Criteria(DomainPeer::DATABASE_NAME);
+
+ if ($this->isColumnModified(DomainPeer::ID)) $criteria->add(DomainPeer::ID, $this->id);
+ if ($this->isColumnModified(DomainPeer::NAME)) $criteria->add(DomainPeer::NAME, $this->name);
+ if ($this->isColumnModified(DomainPeer::CREATOR_ID)) $criteria->add(DomainPeer::CREATOR_ID, $this->creator_id);
+ if ($this->isColumnModified(DomainPeer::MAILBOX_PREFIX)) $criteria->add(DomainPeer::MAILBOX_PREFIX, $this->mailbox_prefix);
+ if ($this->isColumnModified(DomainPeer::MAX_MAILBOX_COUNT)) $criteria->add(DomainPeer::MAX_MAILBOX_COUNT, $this->max_mailbox_count);
+ if ($this->isColumnModified(DomainPeer::QUOTA)) $criteria->add(DomainPeer::QUOTA, $this->quota);
+ if ($this->isColumnModified(DomainPeer::DEFAULT_MAILBOX_QUOTA)) $criteria->add(DomainPeer::DEFAULT_MAILBOX_QUOTA, $this->default_mailbox_quota);
+
+ return $criteria;
+ }
+
+
+ public function buildPkeyCriteria()
+ {
+ $criteria = new Criteria(DomainPeer::DATABASE_NAME);
+
+ $criteria->add(DomainPeer::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->setName($this->name);
+
+ $copyObj->setCreatorId($this->creator_id);
+
+ $copyObj->setMailboxPrefix($this->mailbox_prefix);
+
+ $copyObj->setMaxMailboxCount($this->max_mailbox_count);
+
+ $copyObj->setQuota($this->quota);
+
+ $copyObj->setDefaultMailboxQuota($this->default_mailbox_quota);
+
+
+ if ($deepCopy) {
+ $copyObj->setNew(false);
+
+ foreach($this->getDomainPermissions() as $relObj) {
+ $copyObj->addDomainPermission($relObj->copy($deepCopy));
+ }
+
+ foreach($this->getMailboxs() as $relObj) {
+ $copyObj->addMailbox($relObj->copy($deepCopy));
+ }
+
+ foreach($this->getAddresss() as $relObj) {
+ $copyObj->addAddress($relObj->copy($deepCopy));
+ }
+
+ }
+
+ $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 DomainPeer();
+ }
+ return self::$peer;
+ }
+
+
+ public function setUser($v)
+ {
+
+
+ if ($v === null) {
+ $this->setCreatorId(NULL);
+ } else {
+ $this->setCreatorId($v->getId());
+ }
+
+
+ $this->aUser = $v;
+ }
+
+
+
+ public function getUser($con = null)
+ {
+ include_once 'lib/model/om/BaseUserPeer.php';
+
+ if ($this->aUser === null && ($this->creator_id !== null)) {
+
+ $this->aUser = UserPeer::retrieveByPK($this->creator_id, $con);
+
+
+ }
+ return $this->aUser;
+ }
+
+
+ public function initDomainPermissions()
+ {
+ if ($this->collDomainPermissions === null) {
+ $this->collDomainPermissions = array();
+ }
+ }
+
+
+ public function getDomainPermissions($criteria = null, $con = null)
+ {
+ include_once 'lib/model/om/BaseDomainPermissionPeer.php';
+ if ($criteria === null) {
+ $criteria = new Criteria();
+ }
+ elseif ($criteria instanceof Criteria)
+ {
+ $criteria = clone $criteria;
+ }
+
+ if ($this->collDomainPermissions === null) {
+ if ($this->isNew()) {
+ $this->collDomainPermissions = array();
+ } else {
+
+ $criteria->add(DomainPermissionPeer::DOMAIN_ID, $this->getId());
+
+ DomainPermissionPeer::addSelectColumns($criteria);
+ $this->collDomainPermissions = DomainPermissionPeer::doSelect($criteria, $con);
+ }
+ } else {
+ if (!$this->isNew()) {
+
+
+ $criteria->add(DomainPermissionPeer::DOMAIN_ID, $this->getId());
+
+ DomainPermissionPeer::addSelectColumns($criteria);
+ if (!isset($this->lastDomainPermissionCriteria) || !$this->lastDomainPermissionCriteria->equals($criteria)) {
+ $this->collDomainPermissions = DomainPermissionPeer::doSelect($criteria, $con);
+ }
+ }
+ }
+ $this->lastDomainPermissionCriteria = $criteria;
+ return $this->collDomainPermissions;
+ }
+
+
+ public function countDomainPermissions($criteria = null, $distinct = false, $con = null)
+ {
+ include_once 'lib/model/om/BaseDomainPermissionPeer.php';
+ if ($criteria === null) {
+ $criteria = new Criteria();
+ }
+ elseif ($criteria instanceof Criteria)
+ {
+ $criteria = clone $criteria;
+ }
+
+ $criteria->add(DomainPermissionPeer::DOMAIN_ID, $this->getId());
+
+ return DomainPermissionPeer::doCount($criteria, $distinct, $con);
+ }
+
+
+ public function addDomainPermission(DomainPermission $l)
+ {
+ $this->collDomainPermissions[] = $l;
+ $l->setDomain($this);
+ }
+
+
+
+ public function getDomainPermissionsJoinUser($criteria = null, $con = null)
+ {
+ include_once 'lib/model/om/BaseDomainPermissionPeer.php';
+ if ($criteria === null) {
+ $criteria = new Criteria();
+ }
+ elseif ($criteria instanceof Criteria)
+ {
+ $criteria = clone $criteria;
+ }
+
+ if ($this->collDomainPermissions === null) {
+ if ($this->isNew()) {
+ $this->collDomainPermissions = array();
+ } else {
+
+ $criteria->add(DomainPermissionPeer::DOMAIN_ID, $this->getId());
+
+ $this->collDomainPermissions = DomainPermissionPeer::doSelectJoinUser($criteria, $con);
+ }
+ } else {
+
+ $criteria->add(DomainPermissionPeer::DOMAIN_ID, $this->getId());
+
+ if (!isset($this->lastDomainPermissionCriteria) || !$this->lastDomainPermissionCriteria->equals($criteria)) {
+ $this->collDomainPermissions = DomainPermissionPeer::doSelectJoinUser($criteria, $con);
+ }
+ }
+ $this->lastDomainPermissionCriteria = $criteria;
+
+ return $this->collDomainPermissions;
+ }
+
+
+ public function initMailboxs()
+ {
+ if ($this->collMailboxs === null) {
+ $this->collMailboxs = array();
+ }
+ }
+
+
+ public function getMailboxs($criteria = null, $con = null)
+ {
+ include_once 'lib/model/om/BaseMailboxPeer.php';
+ if ($criteria === null) {
+ $criteria = new Criteria();
+ }
+ elseif ($criteria instanceof Criteria)
+ {
+ $criteria = clone $criteria;
+ }
+
+ if ($this->collMailboxs === null) {
+ if ($this->isNew()) {
+ $this->collMailboxs = array();
+ } else {
+
+ $criteria->add(MailboxPeer::DOMAIN_ID, $this->getId());
+
+ MailboxPeer::addSelectColumns($criteria);
+ $this->collMailboxs = MailboxPeer::doSelect($criteria, $con);
+ }
+ } else {
+ if (!$this->isNew()) {
+
+
+ $criteria->add(MailboxPeer::DOMAIN_ID, $this->getId());
+
+ MailboxPeer::addSelectColumns($criteria);
+ if (!isset($this->lastMailboxCriteria) || !$this->lastMailboxCriteria->equals($criteria)) {
+ $this->collMailboxs = MailboxPeer::doSelect($criteria, $con);
+ }
+ }
+ }
+ $this->lastMailboxCriteria = $criteria;
+ return $this->collMailboxs;
+ }
+
+
+ public function countMailboxs($criteria = null, $distinct = false, $con = null)
+ {
+ include_once 'lib/model/om/BaseMailboxPeer.php';
+ if ($criteria === null) {
+ $criteria = new Criteria();
+ }
+ elseif ($criteria instanceof Criteria)
+ {
+ $criteria = clone $criteria;
+ }
+
+ $criteria->add(MailboxPeer::DOMAIN_ID, $this->getId());
+
+ return MailboxPeer::doCount($criteria, $distinct, $con);
+ }
+
+
+ public function addMailbox(Mailbox $l)
+ {
+ $this->collMailboxs[] = $l;
+ $l->setDomain($this);
+ }
+
+
+ public function initAddresss()
+ {
+ if ($this->collAddresss === null) {
+ $this->collAddresss = array();
+ }
+ }
+
+
+ public function getAddresss($criteria = null, $con = null)
+ {
+ include_once 'lib/model/om/BaseAddressPeer.php';
+ if ($criteria === null) {
+ $criteria = new Criteria();
+ }
+ elseif ($criteria instanceof Criteria)
+ {
+ $criteria = clone $criteria;
+ }
+
+ if ($this->collAddresss === null) {
+ if ($this->isNew()) {
+ $this->collAddresss = array();
+ } else {
+
+ $criteria->add(AddressPeer::DOMAIN_ID, $this->getId());
+
+ AddressPeer::addSelectColumns($criteria);
+ $this->collAddresss = AddressPeer::doSelect($criteria, $con);
+ }
+ } else {
+ if (!$this->isNew()) {
+
+
+ $criteria->add(AddressPeer::DOMAIN_ID, $this->getId());
+
+ AddressPeer::addSelectColumns($criteria);
+ if (!isset($this->lastAddressCriteria) || !$this->lastAddressCriteria->equals($criteria)) {
+ $this->collAddresss = AddressPeer::doSelect($criteria, $con);
+ }
+ }
+ }
+ $this->lastAddressCriteria = $criteria;
+ return $this->collAddresss;
+ }
+
+
+ public function countAddresss($criteria = null, $distinct = false, $con = null)
+ {
+ include_once 'lib/model/om/BaseAddressPeer.php';
+ if ($criteria === null) {
+ $criteria = new Criteria();
+ }
+ elseif ($criteria instanceof Criteria)
+ {
+ $criteria = clone $criteria;
+ }
+
+ $criteria->add(AddressPeer::DOMAIN_ID, $this->getId());
+
+ return AddressPeer::doCount($criteria, $distinct, $con);
+ }
+
+
+ public function addAddress(Address $l)
+ {
+ $this->collAddresss[] = $l;
+ $l->setDomain($this);
+ }
+
+
+
+ public function getAddresssJoinMailbox($criteria = null, $con = null)
+ {
+ include_once 'lib/model/om/BaseAddressPeer.php';
+ if ($criteria === null) {
+ $criteria = new Criteria();
+ }
+ elseif ($criteria instanceof Criteria)
+ {
+ $criteria = clone $criteria;
+ }
+
+ if ($this->collAddresss === null) {
+ if ($this->isNew()) {
+ $this->collAddresss = array();
+ } else {
+
+ $criteria->add(AddressPeer::DOMAIN_ID, $this->getId());
+
+ $this->collAddresss = AddressPeer::doSelectJoinMailbox($criteria, $con);
+ }
+ } else {
+
+ $criteria->add(AddressPeer::DOMAIN_ID, $this->getId());
+
+ if (!isset($this->lastAddressCriteria) || !$this->lastAddressCriteria->equals($criteria)) {
+ $this->collAddresss = AddressPeer::doSelectJoinMailbox($criteria, $con);
+ }
+ }
+ $this->lastAddressCriteria = $criteria;
+
+ return $this->collAddresss;
+ }
+
+} \ No newline at end of file
diff --git a/lib/model/om/BaseDomainPeer.php b/lib/model/om/BaseDomainPeer.php
new file mode 100644
index 0000000..93ee281
--- /dev/null
+++ b/lib/model/om/BaseDomainPeer.php
@@ -0,0 +1,591 @@
+<?php
+
+
+abstract class BaseDomainPeer {
+
+
+ const DATABASE_NAME = 'propel';
+
+
+ const TABLE_NAME = 'domain';
+
+
+ const CLASS_DEFAULT = 'lib.model.Domain';
+
+
+ const NUM_COLUMNS = 7;
+
+
+ const NUM_LAZY_LOAD_COLUMNS = 0;
+
+
+
+ const ID = 'domain.ID';
+
+
+ const NAME = 'domain.NAME';
+
+
+ const CREATOR_ID = 'domain.CREATOR_ID';
+
+
+ const MAILBOX_PREFIX = 'domain.MAILBOX_PREFIX';
+
+
+ const MAX_MAILBOX_COUNT = 'domain.MAX_MAILBOX_COUNT';
+
+
+ const QUOTA = 'domain.QUOTA';
+
+
+ const DEFAULT_MAILBOX_QUOTA = 'domain.DEFAULT_MAILBOX_QUOTA';
+
+
+ private static $phpNameMap = null;
+
+
+
+ private static $fieldNames = array (
+ BasePeer::TYPE_PHPNAME => array ('Id', 'Name', 'CreatorId', 'MailboxPrefix', 'MaxMailboxCount', 'Quota', 'DefaultMailboxQuota', ),
+ BasePeer::TYPE_COLNAME => array (DomainPeer::ID, DomainPeer::NAME, DomainPeer::CREATOR_ID, DomainPeer::MAILBOX_PREFIX, DomainPeer::MAX_MAILBOX_COUNT, DomainPeer::QUOTA, DomainPeer::DEFAULT_MAILBOX_QUOTA, ),
+ BasePeer::TYPE_FIELDNAME => array ('id', 'name', 'creator_id', 'mailbox_prefix', 'max_mailbox_count', 'quota', 'default_mailbox_quota', ),
+ BasePeer::TYPE_NUM => array (0, 1, 2, 3, 4, 5, 6, )
+ );
+
+
+ private static $fieldKeys = array (
+ BasePeer::TYPE_PHPNAME => array ('Id' => 0, 'Name' => 1, 'CreatorId' => 2, 'MailboxPrefix' => 3, 'MaxMailboxCount' => 4, 'Quota' => 5, 'DefaultMailboxQuota' => 6, ),
+ BasePeer::TYPE_COLNAME => array (DomainPeer::ID => 0, DomainPeer::NAME => 1, DomainPeer::CREATOR_ID => 2, DomainPeer::MAILBOX_PREFIX => 3, DomainPeer::MAX_MAILBOX_COUNT => 4, DomainPeer::QUOTA => 5, DomainPeer::DEFAULT_MAILBOX_QUOTA => 6, ),
+ BasePeer::TYPE_FIELDNAME => array ('id' => 0, 'name' => 1, 'creator_id' => 2, 'mailbox_prefix' => 3, 'max_mailbox_count' => 4, 'quota' => 5, 'default_mailbox_quota' => 6, ),
+ BasePeer::TYPE_NUM => array (0, 1, 2, 3, 4, 5, 6, )
+ );
+
+
+ public static function getMapBuilder()
+ {
+ include_once 'lib/model/map/DomainMapBuilder.php';
+ return BasePeer::getMapBuilder('lib.model.map.DomainMapBuilder');
+ }
+
+ public static function getPhpNameMap()
+ {
+ if (self::$phpNameMap === null) {
+ $map = DomainPeer::getTableMap();
+ $columns = $map->getColumns();
+ $nameMap = array();
+ foreach ($columns as $column) {
+ $nameMap[$column->getPhpName()] = $column->getColumnName();
+ }
+ self::$phpNameMap = $nameMap;
+ }
+ return self::$phpNameMap;
+ }
+
+ static public function translateFieldName($name, $fromType, $toType)
+ {
+ $toNames = self::getFieldNames($toType);
+ $key = isset(self::$fieldKeys[$fromType][$name]) ? self::$fieldKeys[$fromType][$name] : null;
+ if ($key === null) {
+ throw new PropelException("'$name' could not be found in the field names of type '$fromType'. These are: " . print_r(self::$fieldKeys[$fromType], true));
+ }
+ return $toNames[$key];
+ }
+
+
+
+ static public function getFieldNames($type = BasePeer::TYPE_PHPNAME)
+ {
+ if (!array_key_exists($type, self::$fieldNames)) {
+ throw new PropelException('Method getFieldNames() expects the parameter $type to be one of the class constants TYPE_PHPNAME, TYPE_COLNAME, TYPE_FIELDNAME, TYPE_NUM. ' . $type . ' was given.');
+ }
+ return self::$fieldNames[$type];
+ }
+
+
+ public static function alias($alias, $column)
+ {
+ return str_replace(DomainPeer::TABLE_NAME.'.', $alias.'.', $column);
+ }
+
+
+ public static function addSelectColumns(Criteria $criteria)
+ {
+
+ $criteria->addSelectColumn(DomainPeer::ID);
+
+ $criteria->addSelectColumn(DomainPeer::NAME);
+
+ $criteria->addSelectColumn(DomainPeer::CREATOR_ID);
+
+ $criteria->addSelectColumn(DomainPeer::MAILBOX_PREFIX);
+
+ $criteria->addSelectColumn(DomainPeer::MAX_MAILBOX_COUNT);
+
+ $criteria->addSelectColumn(DomainPeer::QUOTA);
+
+ $criteria->addSelectColumn(DomainPeer::DEFAULT_MAILBOX_QUOTA);
+
+ }
+
+ const COUNT = 'COUNT(domain.ID)';
+ const COUNT_DISTINCT = 'COUNT(DISTINCT domain.ID)';
+
+
+ public static function doCount(Criteria $criteria, $distinct = false, $con = null)
+ {
+ $criteria = clone $criteria;
+
+ $criteria->clearSelectColumns()->clearOrderByColumns();
+ if ($distinct || in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) {
+ $criteria->addSelectColumn(DomainPeer::COUNT_DISTINCT);
+ } else {
+ $criteria->addSelectColumn(DomainPeer::COUNT);
+ }
+
+ foreach($criteria->getGroupByColumns() as $column)
+ {
+ $criteria->addSelectColumn($column);
+ }
+
+ $rs = DomainPeer::doSelectRS($criteria, $con);
+ if ($rs->next()) {
+ return $rs->getInt(1);
+ } else {
+ return 0;
+ }
+ }
+
+ public static function doSelectOne(Criteria $criteria, $con = null)
+ {
+ $critcopy = clone $criteria;
+ $critcopy->setLimit(1);
+ $objects = DomainPeer::doSelect($critcopy, $con);
+ if ($objects) {
+ return $objects[0];
+ }
+ return null;
+ }
+
+ public static function doSelect(Criteria $criteria, $con = null)
+ {
+ return DomainPeer::populateObjects(DomainPeer::doSelectRS($criteria, $con));
+ }
+
+ public static function doSelectRS(Criteria $criteria, $con = null)
+ {
+ if ($con === null) {
+ $con = Propel::getConnection(self::DATABASE_NAME);
+ }
+
+ if (!$criteria->getSelectColumns()) {
+ $criteria = clone $criteria;
+ DomainPeer::addSelectColumns($criteria);
+ }
+
+ $criteria->setDbName(self::DATABASE_NAME);
+
+ return BasePeer::doSelect($criteria, $con);
+ }
+
+ public static function populateObjects(ResultSet $rs)
+ {
+ $results = array();
+
+ $cls = DomainPeer::getOMClass();
+ $cls = Propel::import($cls);
+ while($rs->next()) {
+
+ $obj = new $cls();
+ $obj->hydrate($rs);
+ $results[] = $obj;
+
+ }
+ return $results;
+ }
+
+
+ public static function doCountJoinUser(Criteria $criteria, $distinct = false, $con = null)
+ {
+ $criteria = clone $criteria;
+
+ $criteria->clearSelectColumns()->clearOrderByColumns();
+ if ($distinct || in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) {
+ $criteria->addSelectColumn(DomainPeer::COUNT_DISTINCT);
+ } else {
+ $criteria->addSelectColumn(DomainPeer::COUNT);
+ }
+
+ foreach($criteria->getGroupByColumns() as $column)
+ {
+ $criteria->addSelectColumn($column);
+ }
+
+ $criteria->addJoin(DomainPeer::CREATOR_ID, UserPeer::ID);
+
+ $rs = DomainPeer::doSelectRS($criteria, $con);
+ if ($rs->next()) {
+ return $rs->getInt(1);
+ } else {
+ return 0;
+ }
+ }
+
+
+
+ public static function doSelectJoinUser(Criteria $c, $con = null)
+ {
+ $c = clone $c;
+
+ if ($c->getDbName() == Propel::getDefaultDB()) {
+ $c->setDbName(self::DATABASE_NAME);
+ }
+
+ DomainPeer::addSelectColumns($c);
+ $startcol = (DomainPeer::NUM_COLUMNS - DomainPeer::NUM_LAZY_LOAD_COLUMNS) + 1;
+ UserPeer::addSelectColumns($c);
+
+ $c->addJoin(DomainPeer::CREATOR_ID, UserPeer::ID);
+ $rs = BasePeer::doSelect($c, $con);
+ $results = array();
+
+ while($rs->next()) {
+
+ $omClass = DomainPeer::getOMClass();
+
+ $cls = Propel::import($omClass);
+ $obj1 = new $cls();
+ $obj1->hydrate($rs);
+
+ $omClass = UserPeer::getOMClass();
+
+ $cls = Propel::import($omClass);
+ $obj2 = new $cls();
+ $obj2->hydrate($rs, $startcol);
+
+ $newObject = true;
+ foreach($results as $temp_obj1) {
+ $temp_obj2 = $temp_obj1->getUser(); if ($temp_obj2->getPrimaryKey() === $obj2->getPrimaryKey()) {
+ $newObject = false;
+ $temp_obj2->addDomain($obj1); break;
+ }
+ }
+ if ($newObject) {
+ $obj2->initDomains();
+ $obj2->addDomain($obj1); }
+ $results[] = $obj1;
+ }
+ return $results;
+ }
+
+
+
+ public static function doCountJoinAll(Criteria $criteria, $distinct = false, $con = null)
+ {
+ $criteria = clone $criteria;
+
+ $criteria->clearSelectColumns()->clearOrderByColumns();
+ if ($distinct || in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) {
+ $criteria->addSelectColumn(DomainPeer::COUNT_DISTINCT);
+ } else {
+ $criteria->addSelectColumn(DomainPeer::COUNT);
+ }
+
+ foreach($criteria->getGroupByColumns() as $column)
+ {
+ $criteria->addSelectColumn($column);
+ }
+
+ $criteria->addJoin(DomainPeer::CREATOR_ID, UserPeer::ID);
+
+ $rs = DomainPeer::doSelectRS($criteria, $con);
+ if ($rs->next()) {
+ return $rs->getInt(1);
+ } else {
+ return 0;
+ }
+ }
+
+
+
+ public static function doSelectJoinAll(Criteria $c, $con = null)
+ {
+ $c = clone $c;
+
+ if ($c->getDbName() == Propel::getDefaultDB()) {
+ $c->setDbName(self::DATABASE_NAME);
+ }
+
+ DomainPeer::addSelectColumns($c);
+ $startcol2 = (DomainPeer::NUM_COLUMNS - DomainPeer::NUM_LAZY_LOAD_COLUMNS) + 1;
+
+ UserPeer::addSelectColumns($c);
+ $startcol3 = $startcol2 + UserPeer::NUM_COLUMNS;
+
+ $c->addJoin(DomainPeer::CREATOR_ID, UserPeer::ID);
+
+ $rs = BasePeer::doSelect($c, $con);
+ $results = array();
+
+ while($rs->next()) {
+
+ $omClass = DomainPeer::getOMClass();
+
+
+ $cls = Propel::import($omClass);
+ $obj1 = new $cls();
+ $obj1->hydrate($rs);
+
+
+
+ $omClass = UserPeer::getOMClass();
+
+
+ $cls = Propel::import($omClass);
+ $obj2 = new $cls();
+ $obj2->hydrate($rs, $startcol2);
+
+ $newObject = true;
+ for ($j=0, $resCount=count($results); $j < $resCount; $j++) {
+ $temp_obj1 = $results[$j];
+ $temp_obj2 = $temp_obj1->getUser(); if ($temp_obj2->getPrimaryKey() === $obj2->getPrimaryKey()) {
+ $newObject = false;
+ $temp_obj2->addDomain($obj1); break;
+ }
+ }
+
+ if ($newObject) {
+ $obj2->initDomains();
+ $obj2->addDomain($obj1);
+ }
+
+ $results[] = $obj1;
+ }
+ return $results;
+ }
+
+
+ public static function getTableMap()
+ {
+ return Propel::getDatabaseMap(self::DATABASE_NAME)->getTable(self::TABLE_NAME);
+ }
+
+
+ public static function getOMClass()
+ {
+ return DomainPeer::CLASS_DEFAULT;
+ }
+
+
+ public static function doInsert($values, $con = null)
+ {
+ if ($con === null) {
+ $con = Propel::getConnection(self::DATABASE_NAME);
+ }
+
+ if ($values instanceof Criteria) {
+ $criteria = clone $values; } else {
+ $criteria = $values->buildCriteria(); }
+
+ $criteria->remove(DomainPeer::ID);
+
+ $criteria->setDbName(self::DATABASE_NAME);
+
+ try {
+ $con->begin();
+ $pk = BasePeer::doInsert($criteria, $con);
+ $con->commit();
+ } catch(PropelException $e) {
+ $con->rollback();
+ throw $e;
+ }
+
+ return $pk;
+ }
+
+
+ public static function doUpdate($values, $con = null)
+ {
+ if ($con === null) {
+ $con = Propel::getConnection(self::DATABASE_NAME);
+ }
+
+ $selectCriteria = new Criteria(self::DATABASE_NAME);
+
+ if ($values instanceof Criteria) {
+ $criteria = clone $values;
+ $comparison = $criteria->getComparison(DomainPeer::ID);
+ $selectCriteria->add(DomainPeer::ID, $criteria->remove(DomainPeer::ID), $comparison);
+
+ } else { $criteria = $values->buildCriteria(); $selectCriteria = $values->buildPkeyCriteria(); }
+
+ $criteria->setDbName(self::DATABASE_NAME);
+
+ return BasePeer::doUpdate($selectCriteria, $criteria, $con);
+ }
+
+
+ public static function doDeleteAll($con = null)
+ {
+ if ($con === null) {
+ $con = Propel::getConnection(self::DATABASE_NAME);
+ }
+ $affectedRows = 0; try {
+ $con->begin();
+ $affectedRows += DomainPeer::doOnDeleteCascade(new Criteria(), $con);
+ DomainPeer::doOnDeleteSetNull(new Criteria(), $con);
+ $affectedRows += BasePeer::doDeleteAll(DomainPeer::TABLE_NAME, $con);
+ $con->commit();
+ return $affectedRows;
+ } catch (PropelException $e) {
+ $con->rollback();
+ throw $e;
+ }
+ }
+
+
+ public static function doDelete($values, $con = null)
+ {
+ if ($con === null) {
+ $con = Propel::getConnection(DomainPeer::DATABASE_NAME);
+ }
+
+ if ($values instanceof Criteria) {
+ $criteria = clone $values; } elseif ($values instanceof Domain) {
+
+ $criteria = $values->buildPkeyCriteria();
+ } else {
+ $criteria = new Criteria(self::DATABASE_NAME);
+ $criteria->add(DomainPeer::ID, (array) $values, Criteria::IN);
+ }
+
+ $criteria->setDbName(self::DATABASE_NAME);
+
+ $affectedRows = 0;
+ try {
+ $con->begin();
+ $affectedRows += DomainPeer::doOnDeleteCascade($criteria, $con);DomainPeer::doOnDeleteSetNull($criteria, $con);
+ $affectedRows += BasePeer::doDelete($criteria, $con);
+ $con->commit();
+ return $affectedRows;
+ } catch (PropelException $e) {
+ $con->rollback();
+ throw $e;
+ }
+ }
+
+
+ protected static function doOnDeleteCascade(Criteria $criteria, Connection $con)
+ {
+ $affectedRows = 0;
+
+ $objects = DomainPeer::doSelect($criteria, $con);
+ foreach($objects as $obj) {
+
+
+ include_once 'lib/model/DomainPermission.php';
+
+ $c = new Criteria();
+
+ $c->add(DomainPermissionPeer::DOMAIN_ID, $obj->getId());
+ $affectedRows += DomainPermissionPeer::doDelete($c, $con);
+ }
+ return $affectedRows;
+ }
+
+
+ protected static function doOnDeleteSetNull(Criteria $criteria, Connection $con)
+ {
+
+ $objects = DomainPeer::doSelect($criteria, $con);
+ foreach($objects as $obj) {
+
+ $selectCriteria = new Criteria(DomainPeer::DATABASE_NAME);
+ $updateValues = new Criteria(DomainPeer::DATABASE_NAME);
+ $selectCriteria->add(MailboxPeer::DOMAIN_ID, $obj->getId());
+ $updateValues->add(MailboxPeer::DOMAIN_ID, null);
+
+ BasePeer::doUpdate($selectCriteria, $updateValues, $con);
+ }
+ }
+
+
+ public static function doValidate(Domain $obj, $cols = null)
+ {
+ $columns = array();
+
+ if ($cols) {
+ $dbMap = Propel::getDatabaseMap(DomainPeer::DATABASE_NAME);
+ $tableMap = $dbMap->getTable(DomainPeer::TABLE_NAME);
+
+ if (! is_array($cols)) {
+ $cols = array($cols);
+ }
+
+ foreach($cols as $colName) {
+ if ($tableMap->containsColumn($colName)) {
+ $get = 'get' . $tableMap->getColumn($colName)->getPhpName();
+ $columns[$colName] = $obj->$get();
+ }
+ }
+ } else {
+
+ }
+
+ $res = BasePeer::doValidate(DomainPeer::DATABASE_NAME, DomainPeer::TABLE_NAME, $columns);
+ if ($res !== true) {
+ $request = sfContext::getInstance()->getRequest();
+ foreach ($res as $failed) {
+ $col = DomainPeer::translateFieldname($failed->getColumn(), BasePeer::TYPE_COLNAME, BasePeer::TYPE_PHPNAME);
+ $request->setError($col, $failed->getMessage());
+ }
+ }
+
+ return $res;
+ }
+
+
+ public static function retrieveByPK($pk, $con = null)
+ {
+ if ($con === null) {
+ $con = Propel::getConnection(self::DATABASE_NAME);
+ }
+
+ $criteria = new Criteria(DomainPeer::DATABASE_NAME);
+
+ $criteria->add(DomainPeer::ID, $pk);
+
+
+ $v = DomainPeer::doSelect($criteria, $con);
+
+ return !empty($v) > 0 ? $v[0] : null;
+ }
+
+
+ public static function retrieveByPKs($pks, $con = null)
+ {
+ if ($con === null) {
+ $con = Propel::getConnection(self::DATABASE_NAME);
+ }
+
+ $objs = null;
+ if (empty($pks)) {
+ $objs = array();
+ } else {
+ $criteria = new Criteria();
+ $criteria->add(DomainPeer::ID, $pks, Criteria::IN);
+ $objs = DomainPeer::doSelect($criteria, $con);
+ }
+ return $objs;
+ }
+
+}
+if (Propel::isInit()) {
+ try {
+ BaseDomainPeer::getMapBuilder();
+ } catch (Exception $e) {
+ Propel::log('Could not initialize Peer: ' . $e->getMessage(), Propel::LOG_ERR);
+ }
+} else {
+ require_once 'lib/model/map/DomainMapBuilder.php';
+ Propel::registerMapBuilder('lib.model.map.DomainMapBuilder');
+}
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 @@
+<?php
+
+
+abstract class BaseDomainPermission extends BaseObject implements Persistent {
+
+
+
+ protected static $peer;
+
+
+
+ protected $user_id;
+
+
+
+ protected $domain_id;
+
+
+
+ protected $id;
+
+
+ protected $aUser;
+
+
+ protected $aDomain;
+
+
+ protected $alreadyInSave = false;
+
+
+ protected $alreadyInValidation = false;
+
+
+ public function getUserId()
+ {
+
+ return $this->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
diff --git a/lib/model/om/BaseDomainPermissionPeer.php b/lib/model/om/BaseDomainPermissionPeer.php
new file mode 100644
index 0000000..747cea0
--- /dev/null
+++ b/lib/model/om/BaseDomainPermissionPeer.php
@@ -0,0 +1,809 @@
+<?php
+
+
+abstract class BaseDomainPermissionPeer {
+
+
+ const DATABASE_NAME = 'propel';
+
+
+ const TABLE_NAME = 'domain_permission';
+
+
+ const CLASS_DEFAULT = 'lib.model.DomainPermission';
+
+
+ const NUM_COLUMNS = 3;
+
+
+ const NUM_LAZY_LOAD_COLUMNS = 0;
+
+
+
+ const USER_ID = 'domain_permission.USER_ID';
+
+
+ const DOMAIN_ID = 'domain_permission.DOMAIN_ID';
+
+
+ const ID = 'domain_permission.ID';
+
+
+ private static $phpNameMap = null;
+
+
+
+ private static $fieldNames = array (
+ BasePeer::TYPE_PHPNAME => array ('UserId', 'DomainId', 'Id', ),
+ BasePeer::TYPE_COLNAME => array (DomainPermissionPeer::USER_ID, DomainPermissionPeer::DOMAIN_ID, DomainPermissionPeer::ID, ),
+ BasePeer::TYPE_FIELDNAME => array ('user_id', 'domain_id', 'id', ),
+ BasePeer::TYPE_NUM => array (0, 1, 2, )
+ );
+
+
+ private static $fieldKeys = array (
+ BasePeer::TYPE_PHPNAME => array ('UserId' => 0, 'DomainId' => 1, 'Id' => 2, ),
+ BasePeer::TYPE_COLNAME => array (DomainPermissionPeer::USER_ID => 0, DomainPermissionPeer::DOMAIN_ID => 1, DomainPermissionPeer::ID => 2, ),
+ BasePeer::TYPE_FIELDNAME => array ('user_id' => 0, 'domain_id' => 1, 'id' => 2, ),
+ BasePeer::TYPE_NUM => array (0, 1, 2, )
+ );
+
+
+ public static function getMapBuilder()
+ {
+ include_once 'lib/model/map/DomainPermissionMapBuilder.php';
+ return BasePeer::getMapBuilder('lib.model.map.DomainPermissionMapBuilder');
+ }
+
+ public static function getPhpNameMap()
+ {
+ if (self::$phpNameMap === null) {
+ $map = DomainPermissionPeer::getTableMap();
+ $columns = $map->getColumns();
+ $nameMap = array();
+ foreach ($columns as $column) {
+ $nameMap[$column->getPhpName()] = $column->getColumnName();
+ }
+ self::$phpNameMap = $nameMap;
+ }
+ return self::$phpNameMap;
+ }
+
+ static public function translateFieldName($name, $fromType, $toType)
+ {
+ $toNames = self::getFieldNames($toType);
+ $key = isset(self::$fieldKeys[$fromType][$name]) ? self::$fieldKeys[$fromType][$name] : null;
+ if ($key === null) {
+ throw new PropelException("'$name' could not be found in the field names of type '$fromType'. These are: " . print_r(self::$fieldKeys[$fromType], true));
+ }
+ return $toNames[$key];
+ }
+
+
+
+ static public function getFieldNames($type = BasePeer::TYPE_PHPNAME)
+ {
+ if (!array_key_exists($type, self::$fieldNames)) {
+ throw new PropelException('Method getFieldNames() expects the parameter $type to be one of the class constants TYPE_PHPNAME, TYPE_COLNAME, TYPE_FIELDNAME, TYPE_NUM. ' . $type . ' was given.');
+ }
+ return self::$fieldNames[$type];
+ }
+
+
+ public static function alias($alias, $column)
+ {
+ return str_replace(DomainPermissionPeer::TABLE_NAME.'.', $alias.'.', $column);
+ }
+
+
+ public static function addSelectColumns(Criteria $criteria)
+ {
+
+ $criteria->addSelectColumn(DomainPermissionPeer::USER_ID);
+
+ $criteria->addSelectColumn(DomainPermissionPeer::DOMAIN_ID);
+
+ $criteria->addSelectColumn(DomainPermissionPeer::ID);
+
+ }
+
+ const COUNT = 'COUNT(domain_permission.ID)';
+ const COUNT_DISTINCT = 'COUNT(DISTINCT domain_permission.ID)';
+
+
+ public static function doCount(Criteria $criteria, $distinct = false, $con = null)
+ {
+ $criteria = clone $criteria;
+
+ $criteria->clearSelectColumns()->clearOrderByColumns();
+ if ($distinct || in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) {
+ $criteria->addSelectColumn(DomainPermissionPeer::COUNT_DISTINCT);
+ } else {
+ $criteria->addSelectColumn(DomainPermissionPeer::COUNT);
+ }
+
+ foreach($criteria->getGroupByColumns() as $column)
+ {
+ $criteria->addSelectColumn($column);
+ }
+
+ $rs = DomainPermissionPeer::doSelectRS($criteria, $con);
+ if ($rs->next()) {
+ return $rs->getInt(1);
+ } else {
+ return 0;
+ }
+ }
+
+ public static function doSelectOne(Criteria $criteria, $con = null)
+ {
+ $critcopy = clone $criteria;
+ $critcopy->setLimit(1);
+ $objects = DomainPermissionPeer::doSelect($critcopy, $con);
+ if ($objects) {
+ return $objects[0];
+ }
+ return null;
+ }
+
+ public static function doSelect(Criteria $criteria, $con = null)
+ {
+ return DomainPermissionPeer::populateObjects(DomainPermissionPeer::doSelectRS($criteria, $con));
+ }
+
+ public static function doSelectRS(Criteria $criteria, $con = null)
+ {
+ if ($con === null) {
+ $con = Propel::getConnection(self::DATABASE_NAME);
+ }
+
+ if (!$criteria->getSelectColumns()) {
+ $criteria = clone $criteria;
+ DomainPermissionPeer::addSelectColumns($criteria);
+ }
+
+ $criteria->setDbName(self::DATABASE_NAME);
+
+ return BasePeer::doSelect($criteria, $con);
+ }
+
+ public static function populateObjects(ResultSet $rs)
+ {
+ $results = array();
+
+ $cls = DomainPermissionPeer::getOMClass();
+ $cls = Propel::import($cls);
+ while($rs->next()) {
+
+ $obj = new $cls();
+ $obj->hydrate($rs);
+ $results[] = $obj;
+
+ }
+ return $results;
+ }
+
+
+ public static function doCountJoinUser(Criteria $criteria, $distinct = false, $con = null)
+ {
+ $criteria = clone $criteria;
+
+ $criteria->clearSelectColumns()->clearOrderByColumns();
+ if ($distinct || in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) {
+ $criteria->addSelectColumn(DomainPermissionPeer::COUNT_DISTINCT);
+ } else {
+ $criteria->addSelectColumn(DomainPermissionPeer::COUNT);
+ }
+
+ foreach($criteria->getGroupByColumns() as $column)
+ {
+ $criteria->addSelectColumn($column);
+ }
+
+ $criteria->addJoin(DomainPermissionPeer::USER_ID, UserPeer::ID);
+
+ $rs = DomainPermissionPeer::doSelectRS($criteria, $con);
+ if ($rs->next()) {
+ return $rs->getInt(1);
+ } else {
+ return 0;
+ }
+ }
+
+
+
+ public static function doCountJoinDomain(Criteria $criteria, $distinct = false, $con = null)
+ {
+ $criteria = clone $criteria;
+
+ $criteria->clearSelectColumns()->clearOrderByColumns();
+ if ($distinct || in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) {
+ $criteria->addSelectColumn(DomainPermissionPeer::COUNT_DISTINCT);
+ } else {
+ $criteria->addSelectColumn(DomainPermissionPeer::COUNT);
+ }
+
+ foreach($criteria->getGroupByColumns() as $column)
+ {
+ $criteria->addSelectColumn($column);
+ }
+
+ $criteria->addJoin(DomainPermissionPeer::DOMAIN_ID, DomainPeer::ID);
+
+ $rs = DomainPermissionPeer::doSelectRS($criteria, $con);
+ if ($rs->next()) {
+ return $rs->getInt(1);
+ } else {
+ return 0;
+ }
+ }
+
+
+
+ public static function doSelectJoinUser(Criteria $c, $con = null)
+ {
+ $c = clone $c;
+
+ if ($c->getDbName() == Propel::getDefaultDB()) {
+ $c->setDbName(self::DATABASE_NAME);
+ }
+
+ DomainPermissionPeer::addSelectColumns($c);
+ $startcol = (DomainPermissionPeer::NUM_COLUMNS - DomainPermissionPeer::NUM_LAZY_LOAD_COLUMNS) + 1;
+ UserPeer::addSelectColumns($c);
+
+ $c->addJoin(DomainPermissionPeer::USER_ID, UserPeer::ID);
+ $rs = BasePeer::doSelect($c, $con);
+ $results = array();
+
+ while($rs->next()) {
+
+ $omClass = DomainPermissionPeer::getOMClass();
+
+ $cls = Propel::import($omClass);
+ $obj1 = new $cls();
+ $obj1->hydrate($rs);
+
+ $omClass = UserPeer::getOMClass();
+
+ $cls = Propel::import($omClass);
+ $obj2 = new $cls();
+ $obj2->hydrate($rs, $startcol);
+
+ $newObject = true;
+ foreach($results as $temp_obj1) {
+ $temp_obj2 = $temp_obj1->getUser(); if ($temp_obj2->getPrimaryKey() === $obj2->getPrimaryKey()) {
+ $newObject = false;
+ $temp_obj2->addDomainPermission($obj1); break;
+ }
+ }
+ if ($newObject) {
+ $obj2->initDomainPermissions();
+ $obj2->addDomainPermission($obj1); }
+ $results[] = $obj1;
+ }
+ return $results;
+ }
+
+
+
+ public static function doSelectJoinDomain(Criteria $c, $con = null)
+ {
+ $c = clone $c;
+
+ if ($c->getDbName() == Propel::getDefaultDB()) {
+ $c->setDbName(self::DATABASE_NAME);
+ }
+
+ DomainPermissionPeer::addSelectColumns($c);
+ $startcol = (DomainPermissionPeer::NUM_COLUMNS - DomainPermissionPeer::NUM_LAZY_LOAD_COLUMNS) + 1;
+ DomainPeer::addSelectColumns($c);
+
+ $c->addJoin(DomainPermissionPeer::DOMAIN_ID, DomainPeer::ID);
+ $rs = BasePeer::doSelect($c, $con);
+ $results = array();
+
+ while($rs->next()) {
+
+ $omClass = DomainPermissionPeer::getOMClass();
+
+ $cls = Propel::import($omClass);
+ $obj1 = new $cls();
+ $obj1->hydrate($rs);
+
+ $omClass = DomainPeer::getOMClass();
+
+ $cls = Propel::import($omClass);
+ $obj2 = new $cls();
+ $obj2->hydrate($rs, $startcol);
+
+ $newObject = true;
+ foreach($results as $temp_obj1) {
+ $temp_obj2 = $temp_obj1->getDomain(); if ($temp_obj2->getPrimaryKey() === $obj2->getPrimaryKey()) {
+ $newObject = false;
+ $temp_obj2->addDomainPermission($obj1); break;
+ }
+ }
+ if ($newObject) {
+ $obj2->initDomainPermissions();
+ $obj2->addDomainPermission($obj1); }
+ $results[] = $obj1;
+ }
+ return $results;
+ }
+
+
+
+ public static function doCountJoinAll(Criteria $criteria, $distinct = false, $con = null)
+ {
+ $criteria = clone $criteria;
+
+ $criteria->clearSelectColumns()->clearOrderByColumns();
+ if ($distinct || in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) {
+ $criteria->addSelectColumn(DomainPermissionPeer::COUNT_DISTINCT);
+ } else {
+ $criteria->addSelectColumn(DomainPermissionPeer::COUNT);
+ }
+
+ foreach($criteria->getGroupByColumns() as $column)
+ {
+ $criteria->addSelectColumn($column);
+ }
+
+ $criteria->addJoin(DomainPermissionPeer::USER_ID, UserPeer::ID);
+
+ $criteria->addJoin(DomainPermissionPeer::DOMAIN_ID, DomainPeer::ID);
+
+ $rs = DomainPermissionPeer::doSelectRS($criteria, $con);
+ if ($rs->next()) {
+ return $rs->getInt(1);
+ } else {
+ return 0;
+ }
+ }
+
+
+
+ public static function doSelectJoinAll(Criteria $c, $con = null)
+ {
+ $c = clone $c;
+
+ if ($c->getDbName() == Propel::getDefaultDB()) {
+ $c->setDbName(self::DATABASE_NAME);
+ }
+
+ DomainPermissionPeer::addSelectColumns($c);
+ $startcol2 = (DomainPermissionPeer::NUM_COLUMNS - DomainPermissionPeer::NUM_LAZY_LOAD_COLUMNS) + 1;
+
+ UserPeer::addSelectColumns($c);
+ $startcol3 = $startcol2 + UserPeer::NUM_COLUMNS;
+
+ DomainPeer::addSelectColumns($c);
+ $startcol4 = $startcol3 + DomainPeer::NUM_COLUMNS;
+
+ $c->addJoin(DomainPermissionPeer::USER_ID, UserPeer::ID);
+
+ $c->addJoin(DomainPermissionPeer::DOMAIN_ID, DomainPeer::ID);
+
+ $rs = BasePeer::doSelect($c, $con);
+ $results = array();
+
+ while($rs->next()) {
+
+ $omClass = DomainPermissionPeer::getOMClass();
+
+
+ $cls = Propel::import($omClass);
+ $obj1 = new $cls();
+ $obj1->hydrate($rs);
+
+
+
+ $omClass = UserPeer::getOMClass();
+
+
+ $cls = Propel::import($omClass);
+ $obj2 = new $cls();
+ $obj2->hydrate($rs, $startcol2);
+
+ $newObject = true;
+ for ($j=0, $resCount=count($results); $j < $resCount; $j++) {
+ $temp_obj1 = $results[$j];
+ $temp_obj2 = $temp_obj1->getUser(); if ($temp_obj2->getPrimaryKey() === $obj2->getPrimaryKey()) {
+ $newObject = false;
+ $temp_obj2->addDomainPermission($obj1); break;
+ }
+ }
+
+ if ($newObject) {
+ $obj2->initDomainPermissions();
+ $obj2->addDomainPermission($obj1);
+ }
+
+
+
+ $omClass = DomainPeer::getOMClass();
+
+
+ $cls = Propel::import($omClass);
+ $obj3 = new $cls();
+ $obj3->hydrate($rs, $startcol3);
+
+ $newObject = true;
+ for ($j=0, $resCount=count($results); $j < $resCount; $j++) {
+ $temp_obj1 = $results[$j];
+ $temp_obj3 = $temp_obj1->getDomain(); if ($temp_obj3->getPrimaryKey() === $obj3->getPrimaryKey()) {
+ $newObject = false;
+ $temp_obj3->addDomainPermission($obj1); break;
+ }
+ }
+
+ if ($newObject) {
+ $obj3->initDomainPermissions();
+ $obj3->addDomainPermission($obj1);
+ }
+
+ $results[] = $obj1;
+ }
+ return $results;
+ }
+
+
+
+ public static function doCountJoinAllExceptUser(Criteria $criteria, $distinct = false, $con = null)
+ {
+ $criteria = clone $criteria;
+
+ $criteria->clearSelectColumns()->clearOrderByColumns();
+ if ($distinct || in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) {
+ $criteria->addSelectColumn(DomainPermissionPeer::COUNT_DISTINCT);
+ } else {
+ $criteria->addSelectColumn(DomainPermissionPeer::COUNT);
+ }
+
+ foreach($criteria->getGroupByColumns() as $column)
+ {
+ $criteria->addSelectColumn($column);
+ }
+
+ $criteria->addJoin(DomainPermissionPeer::DOMAIN_ID, DomainPeer::ID);
+
+ $rs = DomainPermissionPeer::doSelectRS($criteria, $con);
+ if ($rs->next()) {
+ return $rs->getInt(1);
+ } else {
+ return 0;
+ }
+ }
+
+
+
+ public static function doCountJoinAllExceptDomain(Criteria $criteria, $distinct = false, $con = null)
+ {
+ $criteria = clone $criteria;
+
+ $criteria->clearSelectColumns()->clearOrderByColumns();
+ if ($distinct || in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) {
+ $criteria->addSelectColumn(DomainPermissionPeer::COUNT_DISTINCT);
+ } else {
+ $criteria->addSelectColumn(DomainPermissionPeer::COUNT);
+ }
+
+ foreach($criteria->getGroupByColumns() as $column)
+ {
+ $criteria->addSelectColumn($column);
+ }
+
+ $criteria->addJoin(DomainPermissionPeer::USER_ID, UserPeer::ID);
+
+ $rs = DomainPermissionPeer::doSelectRS($criteria, $con);
+ if ($rs->next()) {
+ return $rs->getInt(1);
+ } else {
+ return 0;
+ }
+ }
+
+
+
+ public static function doSelectJoinAllExceptUser(Criteria $c, $con = null)
+ {
+ $c = clone $c;
+
+ if ($c->getDbName() == Propel::getDefaultDB()) {
+ $c->setDbName(self::DATABASE_NAME);
+ }
+
+ DomainPermissionPeer::addSelectColumns($c);
+ $startcol2 = (DomainPermissionPeer::NUM_COLUMNS - DomainPermissionPeer::NUM_LAZY_LOAD_COLUMNS) + 1;
+
+ DomainPeer::addSelectColumns($c);
+ $startcol3 = $startcol2 + DomainPeer::NUM_COLUMNS;
+
+ $c->addJoin(DomainPermissionPeer::DOMAIN_ID, DomainPeer::ID);
+
+
+ $rs = BasePeer::doSelect($c, $con);
+ $results = array();
+
+ while($rs->next()) {
+
+ $omClass = DomainPermissionPeer::getOMClass();
+
+ $cls = Propel::import($omClass);
+ $obj1 = new $cls();
+ $obj1->hydrate($rs);
+
+ $omClass = DomainPeer::getOMClass();
+
+
+ $cls = Propel::import($omClass);
+ $obj2 = new $cls();
+ $obj2->hydrate($rs, $startcol2);
+
+ $newObject = true;
+ for ($j=0, $resCount=count($results); $j < $resCount; $j++) {
+ $temp_obj1 = $results[$j];
+ $temp_obj2 = $temp_obj1->getDomain(); if ($temp_obj2->getPrimaryKey() === $obj2->getPrimaryKey()) {
+ $newObject = false;
+ $temp_obj2->addDomainPermission($obj1);
+ break;
+ }
+ }
+
+ if ($newObject) {
+ $obj2->initDomainPermissions();
+ $obj2->addDomainPermission($obj1);
+ }
+
+ $results[] = $obj1;
+ }
+ return $results;
+ }
+
+
+
+ public static function doSelectJoinAllExceptDomain(Criteria $c, $con = null)
+ {
+ $c = clone $c;
+
+ if ($c->getDbName() == Propel::getDefaultDB()) {
+ $c->setDbName(self::DATABASE_NAME);
+ }
+
+ DomainPermissionPeer::addSelectColumns($c);
+ $startcol2 = (DomainPermissionPeer::NUM_COLUMNS - DomainPermissionPeer::NUM_LAZY_LOAD_COLUMNS) + 1;
+
+ UserPeer::addSelectColumns($c);
+ $startcol3 = $startcol2 + UserPeer::NUM_COLUMNS;
+
+ $c->addJoin(DomainPermissionPeer::USER_ID, UserPeer::ID);
+
+
+ $rs = BasePeer::doSelect($c, $con);
+ $results = array();
+
+ while($rs->next()) {
+
+ $omClass = DomainPermissionPeer::getOMClass();
+
+ $cls = Propel::import($omClass);
+ $obj1 = new $cls();
+ $obj1->hydrate($rs);
+
+ $omClass = UserPeer::getOMClass();
+
+
+ $cls = Propel::import($omClass);
+ $obj2 = new $cls();
+ $obj2->hydrate($rs, $startcol2);
+
+ $newObject = true;
+ for ($j=0, $resCount=count($results); $j < $resCount; $j++) {
+ $temp_obj1 = $results[$j];
+ $temp_obj2 = $temp_obj1->getUser(); if ($temp_obj2->getPrimaryKey() === $obj2->getPrimaryKey()) {
+ $newObject = false;
+ $temp_obj2->addDomainPermission($obj1);
+ break;
+ }
+ }
+
+ if ($newObject) {
+ $obj2->initDomainPermissions();
+ $obj2->addDomainPermission($obj1);
+ }
+
+ $results[] = $obj1;
+ }
+ return $results;
+ }
+
+
+ public static function getTableMap()
+ {
+ return Propel::getDatabaseMap(self::DATABASE_NAME)->getTable(self::TABLE_NAME);
+ }
+
+
+ public static function getOMClass()
+ {
+ return DomainPermissionPeer::CLASS_DEFAULT;
+ }
+
+
+ public static function doInsert($values, $con = null)
+ {
+ if ($con === null) {
+ $con = Propel::getConnection(self::DATABASE_NAME);
+ }
+
+ if ($values instanceof Criteria) {
+ $criteria = clone $values; } else {
+ $criteria = $values->buildCriteria(); }
+
+ $criteria->remove(DomainPermissionPeer::ID);
+
+ $criteria->setDbName(self::DATABASE_NAME);
+
+ try {
+ $con->begin();
+ $pk = BasePeer::doInsert($criteria, $con);
+ $con->commit();
+ } catch(PropelException $e) {
+ $con->rollback();
+ throw $e;
+ }
+
+ return $pk;
+ }
+
+
+ public static function doUpdate($values, $con = null)
+ {
+ if ($con === null) {
+ $con = Propel::getConnection(self::DATABASE_NAME);
+ }
+
+ $selectCriteria = new Criteria(self::DATABASE_NAME);
+
+ if ($values instanceof Criteria) {
+ $criteria = clone $values;
+ $comparison = $criteria->getComparison(DomainPermissionPeer::ID);
+ $selectCriteria->add(DomainPermissionPeer::ID, $criteria->remove(DomainPermissionPeer::ID), $comparison);
+
+ } else { $criteria = $values->buildCriteria(); $selectCriteria = $values->buildPkeyCriteria(); }
+
+ $criteria->setDbName(self::DATABASE_NAME);
+
+ return BasePeer::doUpdate($selectCriteria, $criteria, $con);
+ }
+
+
+ public static function doDeleteAll($con = null)
+ {
+ if ($con === null) {
+ $con = Propel::getConnection(self::DATABASE_NAME);
+ }
+ $affectedRows = 0; try {
+ $con->begin();
+ $affectedRows += BasePeer::doDeleteAll(DomainPermissionPeer::TABLE_NAME, $con);
+ $con->commit();
+ return $affectedRows;
+ } catch (PropelException $e) {
+ $con->rollback();
+ throw $e;
+ }
+ }
+
+
+ public static function doDelete($values, $con = null)
+ {
+ if ($con === null) {
+ $con = Propel::getConnection(DomainPermissionPeer::DATABASE_NAME);
+ }
+
+ if ($values instanceof Criteria) {
+ $criteria = clone $values; } elseif ($values instanceof DomainPermission) {
+
+ $criteria = $values->buildPkeyCriteria();
+ } else {
+ $criteria = new Criteria(self::DATABASE_NAME);
+ $criteria->add(DomainPermissionPeer::ID, (array) $values, Criteria::IN);
+ }
+
+ $criteria->setDbName(self::DATABASE_NAME);
+
+ $affectedRows = 0;
+ try {
+ $con->begin();
+
+ $affectedRows += BasePeer::doDelete($criteria, $con);
+ $con->commit();
+ return $affectedRows;
+ } catch (PropelException $e) {
+ $con->rollback();
+ throw $e;
+ }
+ }
+
+
+ public static function doValidate(DomainPermission $obj, $cols = null)
+ {
+ $columns = array();
+
+ if ($cols) {
+ $dbMap = Propel::getDatabaseMap(DomainPermissionPeer::DATABASE_NAME);
+ $tableMap = $dbMap->getTable(DomainPermissionPeer::TABLE_NAME);
+
+ if (! is_array($cols)) {
+ $cols = array($cols);
+ }
+
+ foreach($cols as $colName) {
+ if ($tableMap->containsColumn($colName)) {
+ $get = 'get' . $tableMap->getColumn($colName)->getPhpName();
+ $columns[$colName] = $obj->$get();
+ }
+ }
+ } else {
+
+ }
+
+ $res = BasePeer::doValidate(DomainPermissionPeer::DATABASE_NAME, DomainPermissionPeer::TABLE_NAME, $columns);
+ if ($res !== true) {
+ $request = sfContext::getInstance()->getRequest();
+ foreach ($res as $failed) {
+ $col = DomainPermissionPeer::translateFieldname($failed->getColumn(), BasePeer::TYPE_COLNAME, BasePeer::TYPE_PHPNAME);
+ $request->setError($col, $failed->getMessage());
+ }
+ }
+
+ return $res;
+ }
+
+
+ public static function retrieveByPK($pk, $con = null)
+ {
+ if ($con === null) {
+ $con = Propel::getConnection(self::DATABASE_NAME);
+ }
+
+ $criteria = new Criteria(DomainPermissionPeer::DATABASE_NAME);
+
+ $criteria->add(DomainPermissionPeer::ID, $pk);
+
+
+ $v = DomainPermissionPeer::doSelect($criteria, $con);
+
+ return !empty($v) > 0 ? $v[0] : null;
+ }
+
+
+ public static function retrieveByPKs($pks, $con = null)
+ {
+ if ($con === null) {
+ $con = Propel::getConnection(self::DATABASE_NAME);
+ }
+
+ $objs = null;
+ if (empty($pks)) {
+ $objs = array();
+ } else {
+ $criteria = new Criteria();
+ $criteria->add(DomainPermissionPeer::ID, $pks, Criteria::IN);
+ $objs = DomainPermissionPeer::doSelect($criteria, $con);
+ }
+ return $objs;
+ }
+
+}
+if (Propel::isInit()) {
+ try {
+ BaseDomainPermissionPeer::getMapBuilder();
+ } catch (Exception $e) {
+ Propel::log('Could not initialize Peer: ' . $e->getMessage(), Propel::LOG_ERR);
+ }
+} else {
+ require_once 'lib/model/map/DomainPermissionMapBuilder.php';
+ Propel::registerMapBuilder('lib.model.map.DomainPermissionMapBuilder');
+}
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
diff --git a/lib/model/om/BaseLogEntryPeer.php b/lib/model/om/BaseLogEntryPeer.php
new file mode 100644
index 0000000..2b3d8ec
--- /dev/null
+++ b/lib/model/om/BaseLogEntryPeer.php
@@ -0,0 +1,549 @@
+<?php
+
+
+abstract class BaseLogEntryPeer {
+
+
+ const DATABASE_NAME = 'propel';
+
+
+ const TABLE_NAME = 'log';
+
+
+ const CLASS_DEFAULT = 'lib.model.LogEntry';
+
+
+ const NUM_COLUMNS = 6;
+
+
+ const NUM_LAZY_LOAD_COLUMNS = 0;
+
+
+
+ const ID = 'log.ID';
+
+
+ const USER_ID = 'log.USER_ID';
+
+
+ const CREATED_AT = 'log.CREATED_AT';
+
+
+ const MESSAGE = 'log.MESSAGE';
+
+
+ const HOST = 'log.HOST';
+
+
+ const PRIORITY = 'log.PRIORITY';
+
+
+ private static $phpNameMap = null;
+
+
+
+ private static $fieldNames = array (
+ BasePeer::TYPE_PHPNAME => array ('Id', 'UserId', 'CreatedAt', 'Message', 'Host', 'Priority', ),
+ BasePeer::TYPE_COLNAME => array (LogEntryPeer::ID, LogEntryPeer::USER_ID, LogEntryPeer::CREATED_AT, LogEntryPeer::MESSAGE, LogEntryPeer::HOST, LogEntryPeer::PRIORITY, ),
+ BasePeer::TYPE_FIELDNAME => array ('id', 'user_id', 'created_at', 'message', 'host', 'priority', ),
+ BasePeer::TYPE_NUM => array (0, 1, 2, 3, 4, 5, )
+ );
+
+
+ private static $fieldKeys = array (
+ BasePeer::TYPE_PHPNAME => array ('Id' => 0, 'UserId' => 1, 'CreatedAt' => 2, 'Message' => 3, 'Host' => 4, 'Priority' => 5, ),
+ BasePeer::TYPE_COLNAME => array (LogEntryPeer::ID => 0, LogEntryPeer::USER_ID => 1, LogEntryPeer::CREATED_AT => 2, LogEntryPeer::MESSAGE => 3, LogEntryPeer::HOST => 4, LogEntryPeer::PRIORITY => 5, ),
+ BasePeer::TYPE_FIELDNAME => array ('id' => 0, 'user_id' => 1, 'created_at' => 2, 'message' => 3, 'host' => 4, 'priority' => 5, ),
+ BasePeer::TYPE_NUM => array (0, 1, 2, 3, 4, 5, )
+ );
+
+
+ public static function getMapBuilder()
+ {
+ include_once 'lib/model/map/LogEntryMapBuilder.php';
+ return BasePeer::getMapBuilder('lib.model.map.LogEntryMapBuilder');
+ }
+
+ public static function getPhpNameMap()
+ {
+ if (self::$phpNameMap === null) {
+ $map = LogEntryPeer::getTableMap();
+ $columns = $map->getColumns();
+ $nameMap = array();
+ foreach ($columns as $column) {
+ $nameMap[$column->getPhpName()] = $column->getColumnName();
+ }
+ self::$phpNameMap = $nameMap;
+ }
+ return self::$phpNameMap;
+ }
+
+ static public function translateFieldName($name, $fromType, $toType)
+ {
+ $toNames = self::getFieldNames($toType);
+ $key = isset(self::$fieldKeys[$fromType][$name]) ? self::$fieldKeys[$fromType][$name] : null;
+ if ($key === null) {
+ throw new PropelException("'$name' could not be found in the field names of type '$fromType'. These are: " . print_r(self::$fieldKeys[$fromType], true));
+ }
+ return $toNames[$key];
+ }
+
+
+
+ static public function getFieldNames($type = BasePeer::TYPE_PHPNAME)
+ {
+ if (!array_key_exists($type, self::$fieldNames)) {
+ throw new PropelException('Method getFieldNames() expects the parameter $type to be one of the class constants TYPE_PHPNAME, TYPE_COLNAME, TYPE_FIELDNAME, TYPE_NUM. ' . $type . ' was given.');
+ }
+ return self::$fieldNames[$type];
+ }
+
+
+ public static function alias($alias, $column)
+ {
+ return str_replace(LogEntryPeer::TABLE_NAME.'.', $alias.'.', $column);
+ }
+
+
+ public static function addSelectColumns(Criteria $criteria)
+ {
+
+ $criteria->addSelectColumn(LogEntryPeer::ID);
+
+ $criteria->addSelectColumn(LogEntryPeer::USER_ID);
+
+ $criteria->addSelectColumn(LogEntryPeer::CREATED_AT);
+
+ $criteria->addSelectColumn(LogEntryPeer::MESSAGE);
+
+ $criteria->addSelectColumn(LogEntryPeer::HOST);
+
+ $criteria->addSelectColumn(LogEntryPeer::PRIORITY);
+
+ }
+
+ const COUNT = 'COUNT(log.ID)';
+ const COUNT_DISTINCT = 'COUNT(DISTINCT log.ID)';
+
+
+ public static function doCount(Criteria $criteria, $distinct = false, $con = null)
+ {
+ $criteria = clone $criteria;
+
+ $criteria->clearSelectColumns()->clearOrderByColumns();
+ if ($distinct || in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) {
+ $criteria->addSelectColumn(LogEntryPeer::COUNT_DISTINCT);
+ } else {
+ $criteria->addSelectColumn(LogEntryPeer::COUNT);
+ }
+
+ foreach($criteria->getGroupByColumns() as $column)
+ {
+ $criteria->addSelectColumn($column);
+ }
+
+ $rs = LogEntryPeer::doSelectRS($criteria, $con);
+ if ($rs->next()) {
+ return $rs->getInt(1);
+ } else {
+ return 0;
+ }
+ }
+
+ public static function doSelectOne(Criteria $criteria, $con = null)
+ {
+ $critcopy = clone $criteria;
+ $critcopy->setLimit(1);
+ $objects = LogEntryPeer::doSelect($critcopy, $con);
+ if ($objects) {
+ return $objects[0];
+ }
+ return null;
+ }
+
+ public static function doSelect(Criteria $criteria, $con = null)
+ {
+ return LogEntryPeer::populateObjects(LogEntryPeer::doSelectRS($criteria, $con));
+ }
+
+ public static function doSelectRS(Criteria $criteria, $con = null)
+ {
+ if ($con === null) {
+ $con = Propel::getConnection(self::DATABASE_NAME);
+ }
+
+ if (!$criteria->getSelectColumns()) {
+ $criteria = clone $criteria;
+ LogEntryPeer::addSelectColumns($criteria);
+ }
+
+ $criteria->setDbName(self::DATABASE_NAME);
+
+ return BasePeer::doSelect($criteria, $con);
+ }
+
+ public static function populateObjects(ResultSet $rs)
+ {
+ $results = array();
+
+ $cls = LogEntryPeer::getOMClass();
+ $cls = Propel::import($cls);
+ while($rs->next()) {
+
+ $obj = new $cls();
+ $obj->hydrate($rs);
+ $results[] = $obj;
+
+ }
+ return $results;
+ }
+
+
+ public static function doCountJoinUser(Criteria $criteria, $distinct = false, $con = null)
+ {
+ $criteria = clone $criteria;
+
+ $criteria->clearSelectColumns()->clearOrderByColumns();
+ if ($distinct || in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) {
+ $criteria->addSelectColumn(LogEntryPeer::COUNT_DISTINCT);
+ } else {
+ $criteria->addSelectColumn(LogEntryPeer::COUNT);
+ }
+
+ foreach($criteria->getGroupByColumns() as $column)
+ {
+ $criteria->addSelectColumn($column);
+ }
+
+ $criteria->addJoin(LogEntryPeer::USER_ID, UserPeer::ID);
+
+ $rs = LogEntryPeer::doSelectRS($criteria, $con);
+ if ($rs->next()) {
+ return $rs->getInt(1);
+ } else {
+ return 0;
+ }
+ }
+
+
+
+ public static function doSelectJoinUser(Criteria $c, $con = null)
+ {
+ $c = clone $c;
+
+ if ($c->getDbName() == Propel::getDefaultDB()) {
+ $c->setDbName(self::DATABASE_NAME);
+ }
+
+ LogEntryPeer::addSelectColumns($c);
+ $startcol = (LogEntryPeer::NUM_COLUMNS - LogEntryPeer::NUM_LAZY_LOAD_COLUMNS) + 1;
+ UserPeer::addSelectColumns($c);
+
+ $c->addJoin(LogEntryPeer::USER_ID, UserPeer::ID);
+ $rs = BasePeer::doSelect($c, $con);
+ $results = array();
+
+ while($rs->next()) {
+
+ $omClass = LogEntryPeer::getOMClass();
+
+ $cls = Propel::import($omClass);
+ $obj1 = new $cls();
+ $obj1->hydrate($rs);
+
+ $omClass = UserPeer::getOMClass();
+
+ $cls = Propel::import($omClass);
+ $obj2 = new $cls();
+ $obj2->hydrate($rs, $startcol);
+
+ $newObject = true;
+ foreach($results as $temp_obj1) {
+ $temp_obj2 = $temp_obj1->getUser(); if ($temp_obj2->getPrimaryKey() === $obj2->getPrimaryKey()) {
+ $newObject = false;
+ $temp_obj2->addLogEntry($obj1); break;
+ }
+ }
+ if ($newObject) {
+ $obj2->initLogEntrys();
+ $obj2->addLogEntry($obj1); }
+ $results[] = $obj1;
+ }
+ return $results;
+ }
+
+
+
+ public static function doCountJoinAll(Criteria $criteria, $distinct = false, $con = null)
+ {
+ $criteria = clone $criteria;
+
+ $criteria->clearSelectColumns()->clearOrderByColumns();
+ if ($distinct || in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) {
+ $criteria->addSelectColumn(LogEntryPeer::COUNT_DISTINCT);
+ } else {
+ $criteria->addSelectColumn(LogEntryPeer::COUNT);
+ }
+
+ foreach($criteria->getGroupByColumns() as $column)
+ {
+ $criteria->addSelectColumn($column);
+ }
+
+ $criteria->addJoin(LogEntryPeer::USER_ID, UserPeer::ID);
+
+ $rs = LogEntryPeer::doSelectRS($criteria, $con);
+ if ($rs->next()) {
+ return $rs->getInt(1);
+ } else {
+ return 0;
+ }
+ }
+
+
+
+ public static function doSelectJoinAll(Criteria $c, $con = null)
+ {
+ $c = clone $c;
+
+ if ($c->getDbName() == Propel::getDefaultDB()) {
+ $c->setDbName(self::DATABASE_NAME);
+ }
+
+ LogEntryPeer::addSelectColumns($c);
+ $startcol2 = (LogEntryPeer::NUM_COLUMNS - LogEntryPeer::NUM_LAZY_LOAD_COLUMNS) + 1;
+
+ UserPeer::addSelectColumns($c);
+ $startcol3 = $startcol2 + UserPeer::NUM_COLUMNS;
+
+ $c->addJoin(LogEntryPeer::USER_ID, UserPeer::ID);
+
+ $rs = BasePeer::doSelect($c, $con);
+ $results = array();
+
+ while($rs->next()) {
+
+ $omClass = LogEntryPeer::getOMClass();
+
+
+ $cls = Propel::import($omClass);
+ $obj1 = new $cls();
+ $obj1->hydrate($rs);
+
+
+
+ $omClass = UserPeer::getOMClass();
+
+
+ $cls = Propel::import($omClass);
+ $obj2 = new $cls();
+ $obj2->hydrate($rs, $startcol2);
+
+ $newObject = true;
+ for ($j=0, $resCount=count($results); $j < $resCount; $j++) {
+ $temp_obj1 = $results[$j];
+ $temp_obj2 = $temp_obj1->getUser(); if ($temp_obj2->getPrimaryKey() === $obj2->getPrimaryKey()) {
+ $newObject = false;
+ $temp_obj2->addLogEntry($obj1); break;
+ }
+ }
+
+ if ($newObject) {
+ $obj2->initLogEntrys();
+ $obj2->addLogEntry($obj1);
+ }
+
+ $results[] = $obj1;
+ }
+ return $results;
+ }
+
+
+ public static function getTableMap()
+ {
+ return Propel::getDatabaseMap(self::DATABASE_NAME)->getTable(self::TABLE_NAME);
+ }
+
+
+ public static function getOMClass()
+ {
+ return LogEntryPeer::CLASS_DEFAULT;
+ }
+
+
+ public static function doInsert($values, $con = null)
+ {
+ if ($con === null) {
+ $con = Propel::getConnection(self::DATABASE_NAME);
+ }
+
+ if ($values instanceof Criteria) {
+ $criteria = clone $values; } else {
+ $criteria = $values->buildCriteria(); }
+
+ $criteria->remove(LogEntryPeer::ID);
+
+ $criteria->setDbName(self::DATABASE_NAME);
+
+ try {
+ $con->begin();
+ $pk = BasePeer::doInsert($criteria, $con);
+ $con->commit();
+ } catch(PropelException $e) {
+ $con->rollback();
+ throw $e;
+ }
+
+ return $pk;
+ }
+
+
+ public static function doUpdate($values, $con = null)
+ {
+ if ($con === null) {
+ $con = Propel::getConnection(self::DATABASE_NAME);
+ }
+
+ $selectCriteria = new Criteria(self::DATABASE_NAME);
+
+ if ($values instanceof Criteria) {
+ $criteria = clone $values;
+ $comparison = $criteria->getComparison(LogEntryPeer::ID);
+ $selectCriteria->add(LogEntryPeer::ID, $criteria->remove(LogEntryPeer::ID), $comparison);
+
+ } else { $criteria = $values->buildCriteria(); $selectCriteria = $values->buildPkeyCriteria(); }
+
+ $criteria->setDbName(self::DATABASE_NAME);
+
+ return BasePeer::doUpdate($selectCriteria, $criteria, $con);
+ }
+
+
+ public static function doDeleteAll($con = null)
+ {
+ if ($con === null) {
+ $con = Propel::getConnection(self::DATABASE_NAME);
+ }
+ $affectedRows = 0; try {
+ $con->begin();
+ $affectedRows += BasePeer::doDeleteAll(LogEntryPeer::TABLE_NAME, $con);
+ $con->commit();
+ return $affectedRows;
+ } catch (PropelException $e) {
+ $con->rollback();
+ throw $e;
+ }
+ }
+
+
+ public static function doDelete($values, $con = null)
+ {
+ if ($con === null) {
+ $con = Propel::getConnection(LogEntryPeer::DATABASE_NAME);
+ }
+
+ if ($values instanceof Criteria) {
+ $criteria = clone $values; } elseif ($values instanceof LogEntry) {
+
+ $criteria = $values->buildPkeyCriteria();
+ } else {
+ $criteria = new Criteria(self::DATABASE_NAME);
+ $criteria->add(LogEntryPeer::ID, (array) $values, Criteria::IN);
+ }
+
+ $criteria->setDbName(self::DATABASE_NAME);
+
+ $affectedRows = 0;
+ try {
+ $con->begin();
+
+ $affectedRows += BasePeer::doDelete($criteria, $con);
+ $con->commit();
+ return $affectedRows;
+ } catch (PropelException $e) {
+ $con->rollback();
+ throw $e;
+ }
+ }
+
+
+ public static function doValidate(LogEntry $obj, $cols = null)
+ {
+ $columns = array();
+
+ if ($cols) {
+ $dbMap = Propel::getDatabaseMap(LogEntryPeer::DATABASE_NAME);
+ $tableMap = $dbMap->getTable(LogEntryPeer::TABLE_NAME);
+
+ if (! is_array($cols)) {
+ $cols = array($cols);
+ }
+
+ foreach($cols as $colName) {
+ if ($tableMap->containsColumn($colName)) {
+ $get = 'get' . $tableMap->getColumn($colName)->getPhpName();
+ $columns[$colName] = $obj->$get();
+ }
+ }
+ } else {
+
+ }
+
+ $res = BasePeer::doValidate(LogEntryPeer::DATABASE_NAME, LogEntryPeer::TABLE_NAME, $columns);
+ if ($res !== true) {
+ $request = sfContext::getInstance()->getRequest();
+ foreach ($res as $failed) {
+ $col = LogEntryPeer::translateFieldname($failed->getColumn(), BasePeer::TYPE_COLNAME, BasePeer::TYPE_PHPNAME);
+ $request->setError($col, $failed->getMessage());
+ }
+ }
+
+ return $res;
+ }
+
+
+ public static function retrieveByPK($pk, $con = null)
+ {
+ if ($con === null) {
+ $con = Propel::getConnection(self::DATABASE_NAME);
+ }
+
+ $criteria = new Criteria(LogEntryPeer::DATABASE_NAME);
+
+ $criteria->add(LogEntryPeer::ID, $pk);
+
+
+ $v = LogEntryPeer::doSelect($criteria, $con);
+
+ return !empty($v) > 0 ? $v[0] : null;
+ }
+
+
+ public static function retrieveByPKs($pks, $con = null)
+ {
+ if ($con === null) {
+ $con = Propel::getConnection(self::DATABASE_NAME);
+ }
+
+ $objs = null;
+ if (empty($pks)) {
+ $objs = array();
+ } else {
+ $criteria = new Criteria();
+ $criteria->add(LogEntryPeer::ID, $pks, Criteria::IN);
+ $objs = LogEntryPeer::doSelect($criteria, $con);
+ }
+ return $objs;
+ }
+
+}
+if (Propel::isInit()) {
+ try {
+ BaseLogEntryPeer::getMapBuilder();
+ } catch (Exception $e) {
+ Propel::log('Could not initialize Peer: ' . $e->getMessage(), Propel::LOG_ERR);
+ }
+} else {
+ require_once 'lib/model/map/LogEntryMapBuilder.php';
+ Propel::registerMapBuilder('lib.model.map.LogEntryMapBuilder');
+}
diff --git a/lib/model/om/BaseMailbox.php b/lib/model/om/BaseMailbox.php
new file mode 100644
index 0000000..cda4d2f
--- /dev/null
+++ b/lib/model/om/BaseMailbox.php
@@ -0,0 +1,751 @@
+<?php
+
+
+abstract class BaseMailbox extends BaseObject implements Persistent {
+
+
+
+ protected static $peer;
+
+
+
+ protected $id;
+
+
+
+ protected $domain_id;
+
+
+
+ protected $name;
+
+
+
+ protected $password;
+
+
+
+ protected $max_quota;
+
+
+
+ protected $max_address_count;
+
+
+
+ protected $last_login;
+
+
+
+ protected $active = true;
+
+
+ protected $aDomain;
+
+
+ protected $collAddresss;
+
+
+ protected $lastAddressCriteria = null;
+
+
+ protected $alreadyInSave = false;
+
+
+ protected $alreadyInValidation = false;
+
+
+ public function getId()
+ {
+
+ return $this->id;
+ }
+
+
+ public function getDomainId()
+ {
+
+ return $this->domain_id;
+ }
+
+
+ public function getName()
+ {
+
+ return $this->name;
+ }
+
+
+ public function getPassword()
+ {
+
+ return $this->password;
+ }
+
+
+ public function getMaxQuota()
+ {
+
+ return $this->max_quota;
+ }
+
+
+ public function getMaxAddressCount()
+ {
+
+ return $this->max_address_count;
+ }
+
+
+ public function getLastLogin($format = 'Y-m-d H:i:s')
+ {
+
+ if ($this->last_login === null || $this->last_login === '') {
+ return null;
+ } elseif (!is_int($this->last_login)) {
+ $ts = strtotime($this->last_login);
+ if ($ts === -1 || $ts === false) { throw new PropelException("Unable to parse value of [last_login] as date/time value: " . var_export($this->last_login, true));
+ }
+ } else {
+ $ts = $this->last_login;
+ }
+ if ($format === null) {
+ return $ts;
+ } elseif (strpos($format, '%') !== false) {
+ return strftime($format, $ts);
+ } else {
+ return date($format, $ts);
+ }
+ }
+
+
+ public function getActive()
+ {
+
+ return $this->active;
+ }
+
+
+ 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[] = MailboxPeer::ID;
+ }
+
+ }
+
+ 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[] = MailboxPeer::DOMAIN_ID;
+ }
+
+ if ($this->aDomain !== null && $this->aDomain->getId() !== $v) {
+ $this->aDomain = null;
+ }
+
+ }
+
+ public function setName($v)
+ {
+
+ if ($v !== null && !is_string($v)) {
+ $v = (string) $v;
+ }
+
+ if ($this->name !== $v) {
+ $this->name = $v;
+ $this->modifiedColumns[] = MailboxPeer::NAME;
+ }
+
+ }
+
+ public function setPassword($v)
+ {
+
+ if ($v !== null && !is_string($v)) {
+ $v = (string) $v;
+ }
+
+ if ($this->password !== $v) {
+ $this->password = $v;
+ $this->modifiedColumns[] = MailboxPeer::PASSWORD;
+ }
+
+ }
+
+ public function setMaxQuota($v)
+ {
+
+ if ($v !== null && !is_int($v) && is_numeric($v)) {
+ $v = (int) $v;
+ }
+
+ if ($this->max_quota !== $v) {
+ $this->max_quota = $v;
+ $this->modifiedColumns[] = MailboxPeer::MAX_QUOTA;
+ }
+
+ }
+
+ public function setMaxAddressCount($v)
+ {
+
+ if ($v !== null && !is_int($v) && is_numeric($v)) {
+ $v = (int) $v;
+ }
+
+ if ($this->max_address_count !== $v) {
+ $this->max_address_count = $v;
+ $this->modifiedColumns[] = MailboxPeer::MAX_ADDRESS_COUNT;
+ }
+
+ }
+
+ public function setLastLogin($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 [last_login] from input: " . var_export($v, true));
+ }
+ } else {
+ $ts = $v;
+ }
+ if ($this->last_login !== $ts) {
+ $this->last_login = $ts;
+ $this->modifiedColumns[] = MailboxPeer::LAST_LOGIN;
+ }
+
+ }
+
+ public function setActive($v)
+ {
+
+ if ($this->active !== $v || $v === true) {
+ $this->active = $v;
+ $this->modifiedColumns[] = MailboxPeer::ACTIVE;
+ }
+
+ }
+
+ public function hydrate(ResultSet $rs, $startcol = 1)
+ {
+ try {
+
+ $this->id = $rs->getInt($startcol + 0);
+
+ $this->domain_id = $rs->getInt($startcol + 1);
+
+ $this->name = $rs->getString($startcol + 2);
+
+ $this->password = $rs->getString($startcol + 3);
+
+ $this->max_quota = $rs->getInt($startcol + 4);
+
+ $this->max_address_count = $rs->getInt($startcol + 5);
+
+ $this->last_login = $rs->getTimestamp($startcol + 6, null);
+
+ $this->active = $rs->getBoolean($startcol + 7);
+
+ $this->resetModified();
+
+ $this->setNew(false);
+
+ return $startcol + 8;
+ } catch (Exception $e) {
+ throw new PropelException("Error populating Mailbox 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(MailboxPeer::DATABASE_NAME);
+ }
+
+ try {
+ $con->begin();
+ MailboxPeer::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(MailboxPeer::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->aDomain !== null) {
+ if ($this->aDomain->isModified()) {
+ $affectedRows += $this->aDomain->save($con);
+ }
+ $this->setDomain($this->aDomain);
+ }
+
+
+ if ($this->isModified()) {
+ if ($this->isNew()) {
+ $pk = MailboxPeer::doInsert($this, $con);
+ $affectedRows += 1;
+ $this->setId($pk);
+ $this->setNew(false);
+ } else {
+ $affectedRows += MailboxPeer::doUpdate($this, $con);
+ }
+ $this->resetModified(); }
+
+ if ($this->collAddresss !== null) {
+ foreach($this->collAddresss as $referrerFK) {
+ if (!$referrerFK->isDeleted()) {
+ $affectedRows += $referrerFK->save($con);
+ }
+ }
+ }
+
+ $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->aDomain !== null) {
+ if (!$this->aDomain->validate($columns)) {
+ $failureMap = array_merge($failureMap, $this->aDomain->getValidationFailures());
+ }
+ }
+
+
+ if (($retval = MailboxPeer::doValidate($this, $columns)) !== true) {
+ $failureMap = array_merge($failureMap, $retval);
+ }
+
+
+ if ($this->collAddresss !== null) {
+ foreach($this->collAddresss as $referrerFK) {
+ if (!$referrerFK->validate($columns)) {
+ $failureMap = array_merge($failureMap, $referrerFK->getValidationFailures());
+ }
+ }
+ }
+
+
+ $this->alreadyInValidation = false;
+ }
+
+ return (!empty($failureMap) ? $failureMap : true);
+ }
+
+
+ public function getByName($name, $type = BasePeer::TYPE_PHPNAME)
+ {
+ $pos = MailboxPeer::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->getDomainId();
+ break;
+ case 2:
+ return $this->getName();
+ break;
+ case 3:
+ return $this->getPassword();
+ break;
+ case 4:
+ return $this->getMaxQuota();
+ break;
+ case 5:
+ return $this->getMaxAddressCount();
+ break;
+ case 6:
+ return $this->getLastLogin();
+ break;
+ case 7:
+ return $this->getActive();
+ break;
+ default:
+ return null;
+ break;
+ } }
+
+
+ public function toArray($keyType = BasePeer::TYPE_PHPNAME)
+ {
+ $keys = MailboxPeer::getFieldNames($keyType);
+ $result = array(
+ $keys[0] => $this->getId(),
+ $keys[1] => $this->getDomainId(),
+ $keys[2] => $this->getName(),
+ $keys[3] => $this->getPassword(),
+ $keys[4] => $this->getMaxQuota(),
+ $keys[5] => $this->getMaxAddressCount(),
+ $keys[6] => $this->getLastLogin(),
+ $keys[7] => $this->getActive(),
+ );
+ return $result;
+ }
+
+
+ public function setByName($name, $value, $type = BasePeer::TYPE_PHPNAME)
+ {
+ $pos = MailboxPeer::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->setDomainId($value);
+ break;
+ case 2:
+ $this->setName($value);
+ break;
+ case 3:
+ $this->setPassword($value);
+ break;
+ case 4:
+ $this->setMaxQuota($value);
+ break;
+ case 5:
+ $this->setMaxAddressCount($value);
+ break;
+ case 6:
+ $this->setLastLogin($value);
+ break;
+ case 7:
+ $this->setActive($value);
+ break;
+ } }
+
+
+ public function fromArray($arr, $keyType = BasePeer::TYPE_PHPNAME)
+ {
+ $keys = MailboxPeer::getFieldNames($keyType);
+
+ if (array_key_exists($keys[0], $arr)) $this->setId($arr[$keys[0]]);
+ if (array_key_exists($keys[1], $arr)) $this->setDomainId($arr[$keys[1]]);
+ if (array_key_exists($keys[2], $arr)) $this->setName($arr[$keys[2]]);
+ if (array_key_exists($keys[3], $arr)) $this->setPassword($arr[$keys[3]]);
+ if (array_key_exists($keys[4], $arr)) $this->setMaxQuota($arr[$keys[4]]);
+ if (array_key_exists($keys[5], $arr)) $this->setMaxAddressCount($arr[$keys[5]]);
+ if (array_key_exists($keys[6], $arr)) $this->setLastLogin($arr[$keys[6]]);
+ if (array_key_exists($keys[7], $arr)) $this->setActive($arr[$keys[7]]);
+ }
+
+
+ public function buildCriteria()
+ {
+ $criteria = new Criteria(MailboxPeer::DATABASE_NAME);
+
+ if ($this->isColumnModified(MailboxPeer::ID)) $criteria->add(MailboxPeer::ID, $this->id);
+ if ($this->isColumnModified(MailboxPeer::DOMAIN_ID)) $criteria->add(MailboxPeer::DOMAIN_ID, $this->domain_id);
+ if ($this->isColumnModified(MailboxPeer::NAME)) $criteria->add(MailboxPeer::NAME, $this->name);
+ if ($this->isColumnModified(MailboxPeer::PASSWORD)) $criteria->add(MailboxPeer::PASSWORD, $this->password);
+ if ($this->isColumnModified(MailboxPeer::MAX_QUOTA)) $criteria->add(MailboxPeer::MAX_QUOTA, $this->max_quota);
+ if ($this->isColumnModified(MailboxPeer::MAX_ADDRESS_COUNT)) $criteria->add(MailboxPeer::MAX_ADDRESS_COUNT, $this->max_address_count);
+ if ($this->isColumnModified(MailboxPeer::LAST_LOGIN)) $criteria->add(MailboxPeer::LAST_LOGIN, $this->last_login);
+ if ($this->isColumnModified(MailboxPeer::ACTIVE)) $criteria->add(MailboxPeer::ACTIVE, $this->active);
+
+ return $criteria;
+ }
+
+
+ public function buildPkeyCriteria()
+ {
+ $criteria = new Criteria(MailboxPeer::DATABASE_NAME);
+
+ $criteria->add(MailboxPeer::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->setDomainId($this->domain_id);
+
+ $copyObj->setName($this->name);
+
+ $copyObj->setPassword($this->password);
+
+ $copyObj->setMaxQuota($this->max_quota);
+
+ $copyObj->setMaxAddressCount($this->max_address_count);
+
+ $copyObj->setLastLogin($this->last_login);
+
+ $copyObj->setActive($this->active);
+
+
+ if ($deepCopy) {
+ $copyObj->setNew(false);
+
+ foreach($this->getAddresss() as $relObj) {
+ $copyObj->addAddress($relObj->copy($deepCopy));
+ }
+
+ }
+
+ $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 MailboxPeer();
+ }
+ return self::$peer;
+ }
+
+
+ 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;
+ }
+
+
+ public function initAddresss()
+ {
+ if ($this->collAddresss === null) {
+ $this->collAddresss = array();
+ }
+ }
+
+
+ public function getAddresss($criteria = null, $con = null)
+ {
+ include_once 'lib/model/om/BaseAddressPeer.php';
+ if ($criteria === null) {
+ $criteria = new Criteria();
+ }
+ elseif ($criteria instanceof Criteria)
+ {
+ $criteria = clone $criteria;
+ }
+
+ if ($this->collAddresss === null) {
+ if ($this->isNew()) {
+ $this->collAddresss = array();
+ } else {
+
+ $criteria->add(AddressPeer::MAILBOX_ID, $this->getId());
+
+ AddressPeer::addSelectColumns($criteria);
+ $this->collAddresss = AddressPeer::doSelect($criteria, $con);
+ }
+ } else {
+ if (!$this->isNew()) {
+
+
+ $criteria->add(AddressPeer::MAILBOX_ID, $this->getId());
+
+ AddressPeer::addSelectColumns($criteria);
+ if (!isset($this->lastAddressCriteria) || !$this->lastAddressCriteria->equals($criteria)) {
+ $this->collAddresss = AddressPeer::doSelect($criteria, $con);
+ }
+ }
+ }
+ $this->lastAddressCriteria = $criteria;
+ return $this->collAddresss;
+ }
+
+
+ public function countAddresss($criteria = null, $distinct = false, $con = null)
+ {
+ include_once 'lib/model/om/BaseAddressPeer.php';
+ if ($criteria === null) {
+ $criteria = new Criteria();
+ }
+ elseif ($criteria instanceof Criteria)
+ {
+ $criteria = clone $criteria;
+ }
+
+ $criteria->add(AddressPeer::MAILBOX_ID, $this->getId());
+
+ return AddressPeer::doCount($criteria, $distinct, $con);
+ }
+
+
+ public function addAddress(Address $l)
+ {
+ $this->collAddresss[] = $l;
+ $l->setMailbox($this);
+ }
+
+
+
+ public function getAddresssJoinDomain($criteria = null, $con = null)
+ {
+ include_once 'lib/model/om/BaseAddressPeer.php';
+ if ($criteria === null) {
+ $criteria = new Criteria();
+ }
+ elseif ($criteria instanceof Criteria)
+ {
+ $criteria = clone $criteria;
+ }
+
+ if ($this->collAddresss === null) {
+ if ($this->isNew()) {
+ $this->collAddresss = array();
+ } else {
+
+ $criteria->add(AddressPeer::MAILBOX_ID, $this->getId());
+
+ $this->collAddresss = AddressPeer::doSelectJoinDomain($criteria, $con);
+ }
+ } else {
+
+ $criteria->add(AddressPeer::MAILBOX_ID, $this->getId());
+
+ if (!isset($this->lastAddressCriteria) || !$this->lastAddressCriteria->equals($criteria)) {
+ $this->collAddresss = AddressPeer::doSelectJoinDomain($criteria, $con);
+ }
+ }
+ $this->lastAddressCriteria = $criteria;
+
+ return $this->collAddresss;
+ }
+
+} \ No newline at end of file
diff --git a/lib/model/om/BaseMailboxPeer.php b/lib/model/om/BaseMailboxPeer.php
new file mode 100644
index 0000000..4a7fd36
--- /dev/null
+++ b/lib/model/om/BaseMailboxPeer.php
@@ -0,0 +1,579 @@
+<?php
+
+
+abstract class BaseMailboxPeer {
+
+
+ const DATABASE_NAME = 'propel';
+
+
+ const TABLE_NAME = 'mailbox';
+
+
+ const CLASS_DEFAULT = 'lib.model.Mailbox';
+
+
+ const NUM_COLUMNS = 8;
+
+
+ const NUM_LAZY_LOAD_COLUMNS = 0;
+
+
+
+ const ID = 'mailbox.ID';
+
+
+ const DOMAIN_ID = 'mailbox.DOMAIN_ID';
+
+
+ const NAME = 'mailbox.NAME';
+
+
+ const PASSWORD = 'mailbox.PASSWORD';
+
+
+ const MAX_QUOTA = 'mailbox.MAX_QUOTA';
+
+
+ const MAX_ADDRESS_COUNT = 'mailbox.MAX_ADDRESS_COUNT';
+
+
+ const LAST_LOGIN = 'mailbox.LAST_LOGIN';
+
+
+ const ACTIVE = 'mailbox.ACTIVE';
+
+
+ private static $phpNameMap = null;
+
+
+
+ private static $fieldNames = array (
+ BasePeer::TYPE_PHPNAME => array ('Id', 'DomainId', 'Name', 'Password', 'MaxQuota', 'MaxAddressCount', 'LastLogin', 'Active', ),
+ BasePeer::TYPE_COLNAME => array (MailboxPeer::ID, MailboxPeer::DOMAIN_ID, MailboxPeer::NAME, MailboxPeer::PASSWORD, MailboxPeer::MAX_QUOTA, MailboxPeer::MAX_ADDRESS_COUNT, MailboxPeer::LAST_LOGIN, MailboxPeer::ACTIVE, ),
+ BasePeer::TYPE_FIELDNAME => array ('id', 'domain_id', 'name', 'password', 'max_quota', 'max_address_count', 'last_login', 'active', ),
+ BasePeer::TYPE_NUM => array (0, 1, 2, 3, 4, 5, 6, 7, )
+ );
+
+
+ private static $fieldKeys = array (
+ BasePeer::TYPE_PHPNAME => array ('Id' => 0, 'DomainId' => 1, 'Name' => 2, 'Password' => 3, 'MaxQuota' => 4, 'MaxAddressCount' => 5, 'LastLogin' => 6, 'Active' => 7, ),
+ BasePeer::TYPE_COLNAME => array (MailboxPeer::ID => 0, MailboxPeer::DOMAIN_ID => 1, MailboxPeer::NAME => 2, MailboxPeer::PASSWORD => 3, MailboxPeer::MAX_QUOTA => 4, MailboxPeer::MAX_ADDRESS_COUNT => 5, MailboxPeer::LAST_LOGIN => 6, MailboxPeer::ACTIVE => 7, ),
+ BasePeer::TYPE_FIELDNAME => array ('id' => 0, 'domain_id' => 1, 'name' => 2, 'password' => 3, 'max_quota' => 4, 'max_address_count' => 5, 'last_login' => 6, 'active' => 7, ),
+ BasePeer::TYPE_NUM => array (0, 1, 2, 3, 4, 5, 6, 7, )
+ );
+
+
+ public static function getMapBuilder()
+ {
+ include_once 'lib/model/map/MailboxMapBuilder.php';
+ return BasePeer::getMapBuilder('lib.model.map.MailboxMapBuilder');
+ }
+
+ public static function getPhpNameMap()
+ {
+ if (self::$phpNameMap === null) {
+ $map = MailboxPeer::getTableMap();
+ $columns = $map->getColumns();
+ $nameMap = array();
+ foreach ($columns as $column) {
+ $nameMap[$column->getPhpName()] = $column->getColumnName();
+ }
+ self::$phpNameMap = $nameMap;
+ }
+ return self::$phpNameMap;
+ }
+
+ static public function translateFieldName($name, $fromType, $toType)
+ {
+ $toNames = self::getFieldNames($toType);
+ $key = isset(self::$fieldKeys[$fromType][$name]) ? self::$fieldKeys[$fromType][$name] : null;
+ if ($key === null) {
+ throw new PropelException("'$name' could not be found in the field names of type '$fromType'. These are: " . print_r(self::$fieldKeys[$fromType], true));
+ }
+ return $toNames[$key];
+ }
+
+
+
+ static public function getFieldNames($type = BasePeer::TYPE_PHPNAME)
+ {
+ if (!array_key_exists($type, self::$fieldNames)) {
+ throw new PropelException('Method getFieldNames() expects the parameter $type to be one of the class constants TYPE_PHPNAME, TYPE_COLNAME, TYPE_FIELDNAME, TYPE_NUM. ' . $type . ' was given.');
+ }
+ return self::$fieldNames[$type];
+ }
+
+
+ public static function alias($alias, $column)
+ {
+ return str_replace(MailboxPeer::TABLE_NAME.'.', $alias.'.', $column);
+ }
+
+
+ public static function addSelectColumns(Criteria $criteria)
+ {
+
+ $criteria->addSelectColumn(MailboxPeer::ID);
+
+ $criteria->addSelectColumn(MailboxPeer::DOMAIN_ID);
+
+ $criteria->addSelectColumn(MailboxPeer::NAME);
+
+ $criteria->addSelectColumn(MailboxPeer::PASSWORD);
+
+ $criteria->addSelectColumn(MailboxPeer::MAX_QUOTA);
+
+ $criteria->addSelectColumn(MailboxPeer::MAX_ADDRESS_COUNT);
+
+ $criteria->addSelectColumn(MailboxPeer::LAST_LOGIN);
+
+ $criteria->addSelectColumn(MailboxPeer::ACTIVE);
+
+ }
+
+ const COUNT = 'COUNT(mailbox.ID)';
+ const COUNT_DISTINCT = 'COUNT(DISTINCT mailbox.ID)';
+
+
+ public static function doCount(Criteria $criteria, $distinct = false, $con = null)
+ {
+ $criteria = clone $criteria;
+
+ $criteria->clearSelectColumns()->clearOrderByColumns();
+ if ($distinct || in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) {
+ $criteria->addSelectColumn(MailboxPeer::COUNT_DISTINCT);
+ } else {
+ $criteria->addSelectColumn(MailboxPeer::COUNT);
+ }
+
+ foreach($criteria->getGroupByColumns() as $column)
+ {
+ $criteria->addSelectColumn($column);
+ }
+
+ $rs = MailboxPeer::doSelectRS($criteria, $con);
+ if ($rs->next()) {
+ return $rs->getInt(1);
+ } else {
+ return 0;
+ }
+ }
+
+ public static function doSelectOne(Criteria $criteria, $con = null)
+ {
+ $critcopy = clone $criteria;
+ $critcopy->setLimit(1);
+ $objects = MailboxPeer::doSelect($critcopy, $con);
+ if ($objects) {
+ return $objects[0];
+ }
+ return null;
+ }
+
+ public static function doSelect(Criteria $criteria, $con = null)
+ {
+ return MailboxPeer::populateObjects(MailboxPeer::doSelectRS($criteria, $con));
+ }
+
+ public static function doSelectRS(Criteria $criteria, $con = null)
+ {
+ if ($con === null) {
+ $con = Propel::getConnection(self::DATABASE_NAME);
+ }
+
+ if (!$criteria->getSelectColumns()) {
+ $criteria = clone $criteria;
+ MailboxPeer::addSelectColumns($criteria);
+ }
+
+ $criteria->setDbName(self::DATABASE_NAME);
+
+ return BasePeer::doSelect($criteria, $con);
+ }
+
+ public static function populateObjects(ResultSet $rs)
+ {
+ $results = array();
+
+ $cls = MailboxPeer::getOMClass();
+ $cls = Propel::import($cls);
+ while($rs->next()) {
+
+ $obj = new $cls();
+ $obj->hydrate($rs);
+ $results[] = $obj;
+
+ }
+ return $results;
+ }
+
+
+ public static function doCountJoinDomain(Criteria $criteria, $distinct = false, $con = null)
+ {
+ $criteria = clone $criteria;
+
+ $criteria->clearSelectColumns()->clearOrderByColumns();
+ if ($distinct || in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) {
+ $criteria->addSelectColumn(MailboxPeer::COUNT_DISTINCT);
+ } else {
+ $criteria->addSelectColumn(MailboxPeer::COUNT);
+ }
+
+ foreach($criteria->getGroupByColumns() as $column)
+ {
+ $criteria->addSelectColumn($column);
+ }
+
+ $criteria->addJoin(MailboxPeer::DOMAIN_ID, DomainPeer::ID);
+
+ $rs = MailboxPeer::doSelectRS($criteria, $con);
+ if ($rs->next()) {
+ return $rs->getInt(1);
+ } else {
+ return 0;
+ }
+ }
+
+
+
+ public static function doSelectJoinDomain(Criteria $c, $con = null)
+ {
+ $c = clone $c;
+
+ if ($c->getDbName() == Propel::getDefaultDB()) {
+ $c->setDbName(self::DATABASE_NAME);
+ }
+
+ MailboxPeer::addSelectColumns($c);
+ $startcol = (MailboxPeer::NUM_COLUMNS - MailboxPeer::NUM_LAZY_LOAD_COLUMNS) + 1;
+ DomainPeer::addSelectColumns($c);
+
+ $c->addJoin(MailboxPeer::DOMAIN_ID, DomainPeer::ID);
+ $rs = BasePeer::doSelect($c, $con);
+ $results = array();
+
+ while($rs->next()) {
+
+ $omClass = MailboxPeer::getOMClass();
+
+ $cls = Propel::import($omClass);
+ $obj1 = new $cls();
+ $obj1->hydrate($rs);
+
+ $omClass = DomainPeer::getOMClass();
+
+ $cls = Propel::import($omClass);
+ $obj2 = new $cls();
+ $obj2->hydrate($rs, $startcol);
+
+ $newObject = true;
+ foreach($results as $temp_obj1) {
+ $temp_obj2 = $temp_obj1->getDomain(); if ($temp_obj2->getPrimaryKey() === $obj2->getPrimaryKey()) {
+ $newObject = false;
+ $temp_obj2->addMailbox($obj1); break;
+ }
+ }
+ if ($newObject) {
+ $obj2->initMailboxs();
+ $obj2->addMailbox($obj1); }
+ $results[] = $obj1;
+ }
+ return $results;
+ }
+
+
+
+ public static function doCountJoinAll(Criteria $criteria, $distinct = false, $con = null)
+ {
+ $criteria = clone $criteria;
+
+ $criteria->clearSelectColumns()->clearOrderByColumns();
+ if ($distinct || in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) {
+ $criteria->addSelectColumn(MailboxPeer::COUNT_DISTINCT);
+ } else {
+ $criteria->addSelectColumn(MailboxPeer::COUNT);
+ }
+
+ foreach($criteria->getGroupByColumns() as $column)
+ {
+ $criteria->addSelectColumn($column);
+ }
+
+ $criteria->addJoin(MailboxPeer::DOMAIN_ID, DomainPeer::ID);
+
+ $rs = MailboxPeer::doSelectRS($criteria, $con);
+ if ($rs->next()) {
+ return $rs->getInt(1);
+ } else {
+ return 0;
+ }
+ }
+
+
+
+ public static function doSelectJoinAll(Criteria $c, $con = null)
+ {
+ $c = clone $c;
+
+ if ($c->getDbName() == Propel::getDefaultDB()) {
+ $c->setDbName(self::DATABASE_NAME);
+ }
+
+ MailboxPeer::addSelectColumns($c);
+ $startcol2 = (MailboxPeer::NUM_COLUMNS - MailboxPeer::NUM_LAZY_LOAD_COLUMNS) + 1;
+
+ DomainPeer::addSelectColumns($c);
+ $startcol3 = $startcol2 + DomainPeer::NUM_COLUMNS;
+
+ $c->addJoin(MailboxPeer::DOMAIN_ID, DomainPeer::ID);
+
+ $rs = BasePeer::doSelect($c, $con);
+ $results = array();
+
+ while($rs->next()) {
+
+ $omClass = MailboxPeer::getOMClass();
+
+
+ $cls = Propel::import($omClass);
+ $obj1 = new $cls();
+ $obj1->hydrate($rs);
+
+
+
+ $omClass = DomainPeer::getOMClass();
+
+
+ $cls = Propel::import($omClass);
+ $obj2 = new $cls();
+ $obj2->hydrate($rs, $startcol2);
+
+ $newObject = true;
+ for ($j=0, $resCount=count($results); $j < $resCount; $j++) {
+ $temp_obj1 = $results[$j];
+ $temp_obj2 = $temp_obj1->getDomain(); if ($temp_obj2->getPrimaryKey() === $obj2->getPrimaryKey()) {
+ $newObject = false;
+ $temp_obj2->addMailbox($obj1); break;
+ }
+ }
+
+ if ($newObject) {
+ $obj2->initMailboxs();
+ $obj2->addMailbox($obj1);
+ }
+
+ $results[] = $obj1;
+ }
+ return $results;
+ }
+
+
+ public static function getTableMap()
+ {
+ return Propel::getDatabaseMap(self::DATABASE_NAME)->getTable(self::TABLE_NAME);
+ }
+
+
+ public static function getOMClass()
+ {
+ return MailboxPeer::CLASS_DEFAULT;
+ }
+
+
+ public static function doInsert($values, $con = null)
+ {
+ if ($con === null) {
+ $con = Propel::getConnection(self::DATABASE_NAME);
+ }
+
+ if ($values instanceof Criteria) {
+ $criteria = clone $values; } else {
+ $criteria = $values->buildCriteria(); }
+
+ $criteria->remove(MailboxPeer::ID);
+
+ $criteria->setDbName(self::DATABASE_NAME);
+
+ try {
+ $con->begin();
+ $pk = BasePeer::doInsert($criteria, $con);
+ $con->commit();
+ } catch(PropelException $e) {
+ $con->rollback();
+ throw $e;
+ }
+
+ return $pk;
+ }
+
+
+ public static function doUpdate($values, $con = null)
+ {
+ if ($con === null) {
+ $con = Propel::getConnection(self::DATABASE_NAME);
+ }
+
+ $selectCriteria = new Criteria(self::DATABASE_NAME);
+
+ if ($values instanceof Criteria) {
+ $criteria = clone $values;
+ $comparison = $criteria->getComparison(MailboxPeer::ID);
+ $selectCriteria->add(MailboxPeer::ID, $criteria->remove(MailboxPeer::ID), $comparison);
+
+ } else { $criteria = $values->buildCriteria(); $selectCriteria = $values->buildPkeyCriteria(); }
+
+ $criteria->setDbName(self::DATABASE_NAME);
+
+ return BasePeer::doUpdate($selectCriteria, $criteria, $con);
+ }
+
+
+ public static function doDeleteAll($con = null)
+ {
+ if ($con === null) {
+ $con = Propel::getConnection(self::DATABASE_NAME);
+ }
+ $affectedRows = 0; try {
+ $con->begin();
+ $affectedRows += MailboxPeer::doOnDeleteCascade(new Criteria(), $con);
+ $affectedRows += BasePeer::doDeleteAll(MailboxPeer::TABLE_NAME, $con);
+ $con->commit();
+ return $affectedRows;
+ } catch (PropelException $e) {
+ $con->rollback();
+ throw $e;
+ }
+ }
+
+
+ public static function doDelete($values, $con = null)
+ {
+ if ($con === null) {
+ $con = Propel::getConnection(MailboxPeer::DATABASE_NAME);
+ }
+
+ if ($values instanceof Criteria) {
+ $criteria = clone $values; } elseif ($values instanceof Mailbox) {
+
+ $criteria = $values->buildPkeyCriteria();
+ } else {
+ $criteria = new Criteria(self::DATABASE_NAME);
+ $criteria->add(MailboxPeer::ID, (array) $values, Criteria::IN);
+ }
+
+ $criteria->setDbName(self::DATABASE_NAME);
+
+ $affectedRows = 0;
+ try {
+ $con->begin();
+ $affectedRows += MailboxPeer::doOnDeleteCascade($criteria, $con);
+ $affectedRows += BasePeer::doDelete($criteria, $con);
+ $con->commit();
+ return $affectedRows;
+ } catch (PropelException $e) {
+ $con->rollback();
+ throw $e;
+ }
+ }
+
+
+ protected static function doOnDeleteCascade(Criteria $criteria, Connection $con)
+ {
+ $affectedRows = 0;
+
+ $objects = MailboxPeer::doSelect($criteria, $con);
+ foreach($objects as $obj) {
+
+
+ include_once 'lib/model/Address.php';
+
+ $c = new Criteria();
+
+ $c->add(AddressPeer::MAILBOX_ID, $obj->getId());
+ $affectedRows += AddressPeer::doDelete($c, $con);
+ }
+ return $affectedRows;
+ }
+
+
+ public static function doValidate(Mailbox $obj, $cols = null)
+ {
+ $columns = array();
+
+ if ($cols) {
+ $dbMap = Propel::getDatabaseMap(MailboxPeer::DATABASE_NAME);
+ $tableMap = $dbMap->getTable(MailboxPeer::TABLE_NAME);
+
+ if (! is_array($cols)) {
+ $cols = array($cols);
+ }
+
+ foreach($cols as $colName) {
+ if ($tableMap->containsColumn($colName)) {
+ $get = 'get' . $tableMap->getColumn($colName)->getPhpName();
+ $columns[$colName] = $obj->$get();
+ }
+ }
+ } else {
+
+ }
+
+ $res = BasePeer::doValidate(MailboxPeer::DATABASE_NAME, MailboxPeer::TABLE_NAME, $columns);
+ if ($res !== true) {
+ $request = sfContext::getInstance()->getRequest();
+ foreach ($res as $failed) {
+ $col = MailboxPeer::translateFieldname($failed->getColumn(), BasePeer::TYPE_COLNAME, BasePeer::TYPE_PHPNAME);
+ $request->setError($col, $failed->getMessage());
+ }
+ }
+
+ return $res;
+ }
+
+
+ public static function retrieveByPK($pk, $con = null)
+ {
+ if ($con === null) {
+ $con = Propel::getConnection(self::DATABASE_NAME);
+ }
+
+ $criteria = new Criteria(MailboxPeer::DATABASE_NAME);
+
+ $criteria->add(MailboxPeer::ID, $pk);
+
+
+ $v = MailboxPeer::doSelect($criteria, $con);
+
+ return !empty($v) > 0 ? $v[0] : null;
+ }
+
+
+ public static function retrieveByPKs($pks, $con = null)
+ {
+ if ($con === null) {
+ $con = Propel::getConnection(self::DATABASE_NAME);
+ }
+
+ $objs = null;
+ if (empty($pks)) {
+ $objs = array();
+ } else {
+ $criteria = new Criteria();
+ $criteria->add(MailboxPeer::ID, $pks, Criteria::IN);
+ $objs = MailboxPeer::doSelect($criteria, $con);
+ }
+ return $objs;
+ }
+
+}
+if (Propel::isInit()) {
+ try {
+ BaseMailboxPeer::getMapBuilder();
+ } catch (Exception $e) {
+ Propel::log('Could not initialize Peer: ' . $e->getMessage(), Propel::LOG_ERR);
+ }
+} else {
+ require_once 'lib/model/map/MailboxMapBuilder.php';
+ Propel::registerMapBuilder('lib.model.map.MailboxMapBuilder');
+}
diff --git a/lib/model/om/BaseRole.php b/lib/model/om/BaseRole.php
new file mode 100644
index 0000000..7936e1e
--- /dev/null
+++ b/lib/model/om/BaseRole.php
@@ -0,0 +1,493 @@
+<?php
+
+
+abstract class BaseRole extends BaseObject implements Persistent {
+
+
+
+ protected static $peer;
+
+
+
+ protected $id;
+
+
+
+ protected $name;
+
+
+
+ protected $credentials;
+
+
+ protected $collUsers;
+
+
+ protected $lastUserCriteria = null;
+
+
+ protected $alreadyInSave = false;
+
+
+ protected $alreadyInValidation = false;
+
+
+ public function getId()
+ {
+
+ return $this->id;
+ }
+
+
+ public function getName()
+ {
+
+ return $this->name;
+ }
+
+
+ public function getCredentials()
+ {
+
+ return $this->credentials;
+ }
+
+
+ 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[] = RolePeer::ID;
+ }
+
+ }
+
+ public function setName($v)
+ {
+
+ if ($v !== null && !is_string($v)) {
+ $v = (string) $v;
+ }
+
+ if ($this->name !== $v) {
+ $this->name = $v;
+ $this->modifiedColumns[] = RolePeer::NAME;
+ }
+
+ }
+
+ public function setCredentials($v)
+ {
+
+ if ($v !== null && !is_string($v)) {
+ $v = (string) $v;
+ }
+
+ if ($this->credentials !== $v) {
+ $this->credentials = $v;
+ $this->modifiedColumns[] = RolePeer::CREDENTIALS;
+ }
+
+ }
+
+ public function hydrate(ResultSet $rs, $startcol = 1)
+ {
+ try {
+
+ $this->id = $rs->getInt($startcol + 0);
+
+ $this->name = $rs->getString($startcol + 1);
+
+ $this->credentials = $rs->getString($startcol + 2);
+
+ $this->resetModified();
+
+ $this->setNew(false);
+
+ return $startcol + 3;
+ } catch (Exception $e) {
+ throw new PropelException("Error populating Role 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(RolePeer::DATABASE_NAME);
+ }
+
+ try {
+ $con->begin();
+ RolePeer::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(RolePeer::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->isModified()) {
+ if ($this->isNew()) {
+ $pk = RolePeer::doInsert($this, $con);
+ $affectedRows += 1;
+ $this->setId($pk);
+ $this->setNew(false);
+ } else {
+ $affectedRows += RolePeer::doUpdate($this, $con);
+ }
+ $this->resetModified(); }
+
+ if ($this->collUsers !== null) {
+ foreach($this->collUsers as $referrerFK) {
+ if (!$referrerFK->isDeleted()) {
+ $affectedRows += $referrerFK->save($con);
+ }
+ }
+ }
+
+ $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 (($retval = RolePeer::doValidate($this, $columns)) !== true) {
+ $failureMap = array_merge($failureMap, $retval);
+ }
+
+
+ if ($this->collUsers !== null) {
+ foreach($this->collUsers as $referrerFK) {
+ if (!$referrerFK->validate($columns)) {
+ $failureMap = array_merge($failureMap, $referrerFK->getValidationFailures());
+ }
+ }
+ }
+
+
+ $this->alreadyInValidation = false;
+ }
+
+ return (!empty($failureMap) ? $failureMap : true);
+ }
+
+
+ public function getByName($name, $type = BasePeer::TYPE_PHPNAME)
+ {
+ $pos = RolePeer::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->getName();
+ break;
+ case 2:
+ return $this->getCredentials();
+ break;
+ default:
+ return null;
+ break;
+ } }
+
+
+ public function toArray($keyType = BasePeer::TYPE_PHPNAME)
+ {
+ $keys = RolePeer::getFieldNames($keyType);
+ $result = array(
+ $keys[0] => $this->getId(),
+ $keys[1] => $this->getName(),
+ $keys[2] => $this->getCredentials(),
+ );
+ return $result;
+ }
+
+
+ public function setByName($name, $value, $type = BasePeer::TYPE_PHPNAME)
+ {
+ $pos = RolePeer::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->setName($value);
+ break;
+ case 2:
+ $this->setCredentials($value);
+ break;
+ } }
+
+
+ public function fromArray($arr, $keyType = BasePeer::TYPE_PHPNAME)
+ {
+ $keys = RolePeer::getFieldNames($keyType);
+
+ if (array_key_exists($keys[0], $arr)) $this->setId($arr[$keys[0]]);
+ if (array_key_exists($keys[1], $arr)) $this->setName($arr[$keys[1]]);
+ if (array_key_exists($keys[2], $arr)) $this->setCredentials($arr[$keys[2]]);
+ }
+
+
+ public function buildCriteria()
+ {
+ $criteria = new Criteria(RolePeer::DATABASE_NAME);
+
+ if ($this->isColumnModified(RolePeer::ID)) $criteria->add(RolePeer::ID, $this->id);
+ if ($this->isColumnModified(RolePeer::NAME)) $criteria->add(RolePeer::NAME, $this->name);
+ if ($this->isColumnModified(RolePeer::CREDENTIALS)) $criteria->add(RolePeer::CREDENTIALS, $this->credentials);
+
+ return $criteria;
+ }
+
+
+ public function buildPkeyCriteria()
+ {
+ $criteria = new Criteria(RolePeer::DATABASE_NAME);
+
+ $criteria->add(RolePeer::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->setName($this->name);
+
+ $copyObj->setCredentials($this->credentials);
+
+
+ if ($deepCopy) {
+ $copyObj->setNew(false);
+
+ foreach($this->getUsers() as $relObj) {
+ $copyObj->addUser($relObj->copy($deepCopy));
+ }
+
+ }
+
+ $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 RolePeer();
+ }
+ return self::$peer;
+ }
+
+
+ public function initUsers()
+ {
+ if ($this->collUsers === null) {
+ $this->collUsers = array();
+ }
+ }
+
+
+ public function getUsers($criteria = null, $con = null)
+ {
+ include_once 'lib/model/om/BaseUserPeer.php';
+ if ($criteria === null) {
+ $criteria = new Criteria();
+ }
+ elseif ($criteria instanceof Criteria)
+ {
+ $criteria = clone $criteria;
+ }
+
+ if ($this->collUsers === null) {
+ if ($this->isNew()) {
+ $this->collUsers = array();
+ } else {
+
+ $criteria->add(UserPeer::ROLE_ID, $this->getId());
+
+ UserPeer::addSelectColumns($criteria);
+ $this->collUsers = UserPeer::doSelect($criteria, $con);
+ }
+ } else {
+ if (!$this->isNew()) {
+
+
+ $criteria->add(UserPeer::ROLE_ID, $this->getId());
+
+ UserPeer::addSelectColumns($criteria);
+ if (!isset($this->lastUserCriteria) || !$this->lastUserCriteria->equals($criteria)) {
+ $this->collUsers = UserPeer::doSelect($criteria, $con);
+ }
+ }
+ }
+ $this->lastUserCriteria = $criteria;
+ return $this->collUsers;
+ }
+
+
+ public function countUsers($criteria = null, $distinct = false, $con = null)
+ {
+ include_once 'lib/model/om/BaseUserPeer.php';
+ if ($criteria === null) {
+ $criteria = new Criteria();
+ }
+ elseif ($criteria instanceof Criteria)
+ {
+ $criteria = clone $criteria;
+ }
+
+ $criteria->add(UserPeer::ROLE_ID, $this->getId());
+
+ return UserPeer::doCount($criteria, $distinct, $con);
+ }
+
+
+ public function addUser(User $l)
+ {
+ $this->collUsers[] = $l;
+ $l->setRole($this);
+ }
+
+
+
+ public function getUsersJoinUserRelatedByParentUserId($criteria = null, $con = null)
+ {
+ include_once 'lib/model/om/BaseUserPeer.php';
+ if ($criteria === null) {
+ $criteria = new Criteria();
+ }
+ elseif ($criteria instanceof Criteria)
+ {
+ $criteria = clone $criteria;
+ }
+
+ if ($this->collUsers === null) {
+ if ($this->isNew()) {
+ $this->collUsers = array();
+ } else {
+
+ $criteria->add(UserPeer::ROLE_ID, $this->getId());
+
+ $this->collUsers = UserPeer::doSelectJoinUserRelatedByParentUserId($criteria, $con);
+ }
+ } else {
+
+ $criteria->add(UserPeer::ROLE_ID, $this->getId());
+
+ if (!isset($this->lastUserCriteria) || !$this->lastUserCriteria->equals($criteria)) {
+ $this->collUsers = UserPeer::doSelectJoinUserRelatedByParentUserId($criteria, $con);
+ }
+ }
+ $this->lastUserCriteria = $criteria;
+
+ return $this->collUsers;
+ }
+
+} \ No newline at end of file
diff --git a/lib/model/om/BaseRolePeer.php b/lib/model/om/BaseRolePeer.php
new file mode 100644
index 0000000..85130fb
--- /dev/null
+++ b/lib/model/om/BaseRolePeer.php
@@ -0,0 +1,373 @@
+<?php
+
+
+abstract class BaseRolePeer {
+
+
+ const DATABASE_NAME = 'propel';
+
+
+ const TABLE_NAME = 'role';
+
+
+ const CLASS_DEFAULT = 'lib.model.Role';
+
+
+ const NUM_COLUMNS = 3;
+
+
+ const NUM_LAZY_LOAD_COLUMNS = 0;
+
+
+
+ const ID = 'role.ID';
+
+
+ const NAME = 'role.NAME';
+
+
+ const CREDENTIALS = 'role.CREDENTIALS';
+
+
+ private static $phpNameMap = null;
+
+
+
+ private static $fieldNames = array (
+ BasePeer::TYPE_PHPNAME => array ('Id', 'Name', 'Credentials', ),
+ BasePeer::TYPE_COLNAME => array (RolePeer::ID, RolePeer::NAME, RolePeer::CREDENTIALS, ),
+ BasePeer::TYPE_FIELDNAME => array ('id', 'name', 'credentials', ),
+ BasePeer::TYPE_NUM => array (0, 1, 2, )
+ );
+
+
+ private static $fieldKeys = array (
+ BasePeer::TYPE_PHPNAME => array ('Id' => 0, 'Name' => 1, 'Credentials' => 2, ),
+ BasePeer::TYPE_COLNAME => array (RolePeer::ID => 0, RolePeer::NAME => 1, RolePeer::CREDENTIALS => 2, ),
+ BasePeer::TYPE_FIELDNAME => array ('id' => 0, 'name' => 1, 'credentials' => 2, ),
+ BasePeer::TYPE_NUM => array (0, 1, 2, )
+ );
+
+
+ public static function getMapBuilder()
+ {
+ include_once 'lib/model/map/RoleMapBuilder.php';
+ return BasePeer::getMapBuilder('lib.model.map.RoleMapBuilder');
+ }
+
+ public static function getPhpNameMap()
+ {
+ if (self::$phpNameMap === null) {
+ $map = RolePeer::getTableMap();
+ $columns = $map->getColumns();
+ $nameMap = array();
+ foreach ($columns as $column) {
+ $nameMap[$column->getPhpName()] = $column->getColumnName();
+ }
+ self::$phpNameMap = $nameMap;
+ }
+ return self::$phpNameMap;
+ }
+
+ static public function translateFieldName($name, $fromType, $toType)
+ {
+ $toNames = self::getFieldNames($toType);
+ $key = isset(self::$fieldKeys[$fromType][$name]) ? self::$fieldKeys[$fromType][$name] : null;
+ if ($key === null) {
+ throw new PropelException("'$name' could not be found in the field names of type '$fromType'. These are: " . print_r(self::$fieldKeys[$fromType], true));
+ }
+ return $toNames[$key];
+ }
+
+
+
+ static public function getFieldNames($type = BasePeer::TYPE_PHPNAME)
+ {
+ if (!array_key_exists($type, self::$fieldNames)) {
+ throw new PropelException('Method getFieldNames() expects the parameter $type to be one of the class constants TYPE_PHPNAME, TYPE_COLNAME, TYPE_FIELDNAME, TYPE_NUM. ' . $type . ' was given.');
+ }
+ return self::$fieldNames[$type];
+ }
+
+
+ public static function alias($alias, $column)
+ {
+ return str_replace(RolePeer::TABLE_NAME.'.', $alias.'.', $column);
+ }
+
+
+ public static function addSelectColumns(Criteria $criteria)
+ {
+
+ $criteria->addSelectColumn(RolePeer::ID);
+
+ $criteria->addSelectColumn(RolePeer::NAME);
+
+ $criteria->addSelectColumn(RolePeer::CREDENTIALS);
+
+ }
+
+ const COUNT = 'COUNT(role.ID)';
+ const COUNT_DISTINCT = 'COUNT(DISTINCT role.ID)';
+
+
+ public static function doCount(Criteria $criteria, $distinct = false, $con = null)
+ {
+ $criteria = clone $criteria;
+
+ $criteria->clearSelectColumns()->clearOrderByColumns();
+ if ($distinct || in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) {
+ $criteria->addSelectColumn(RolePeer::COUNT_DISTINCT);
+ } else {
+ $criteria->addSelectColumn(RolePeer::COUNT);
+ }
+
+ foreach($criteria->getGroupByColumns() as $column)
+ {
+ $criteria->addSelectColumn($column);
+ }
+
+ $rs = RolePeer::doSelectRS($criteria, $con);
+ if ($rs->next()) {
+ return $rs->getInt(1);
+ } else {
+ return 0;
+ }
+ }
+
+ public static function doSelectOne(Criteria $criteria, $con = null)
+ {
+ $critcopy = clone $criteria;
+ $critcopy->setLimit(1);
+ $objects = RolePeer::doSelect($critcopy, $con);
+ if ($objects) {
+ return $objects[0];
+ }
+ return null;
+ }
+
+ public static function doSelect(Criteria $criteria, $con = null)
+ {
+ return RolePeer::populateObjects(RolePeer::doSelectRS($criteria, $con));
+ }
+
+ public static function doSelectRS(Criteria $criteria, $con = null)
+ {
+ if ($con === null) {
+ $con = Propel::getConnection(self::DATABASE_NAME);
+ }
+
+ if (!$criteria->getSelectColumns()) {
+ $criteria = clone $criteria;
+ RolePeer::addSelectColumns($criteria);
+ }
+
+ $criteria->setDbName(self::DATABASE_NAME);
+
+ return BasePeer::doSelect($criteria, $con);
+ }
+
+ public static function populateObjects(ResultSet $rs)
+ {
+ $results = array();
+
+ $cls = RolePeer::getOMClass();
+ $cls = Propel::import($cls);
+ while($rs->next()) {
+
+ $obj = new $cls();
+ $obj->hydrate($rs);
+ $results[] = $obj;
+
+ }
+ return $results;
+ }
+
+ public static function getTableMap()
+ {
+ return Propel::getDatabaseMap(self::DATABASE_NAME)->getTable(self::TABLE_NAME);
+ }
+
+
+ public static function getOMClass()
+ {
+ return RolePeer::CLASS_DEFAULT;
+ }
+
+
+ public static function doInsert($values, $con = null)
+ {
+ if ($con === null) {
+ $con = Propel::getConnection(self::DATABASE_NAME);
+ }
+
+ if ($values instanceof Criteria) {
+ $criteria = clone $values; } else {
+ $criteria = $values->buildCriteria(); }
+
+ $criteria->remove(RolePeer::ID);
+
+ $criteria->setDbName(self::DATABASE_NAME);
+
+ try {
+ $con->begin();
+ $pk = BasePeer::doInsert($criteria, $con);
+ $con->commit();
+ } catch(PropelException $e) {
+ $con->rollback();
+ throw $e;
+ }
+
+ return $pk;
+ }
+
+
+ public static function doUpdate($values, $con = null)
+ {
+ if ($con === null) {
+ $con = Propel::getConnection(self::DATABASE_NAME);
+ }
+
+ $selectCriteria = new Criteria(self::DATABASE_NAME);
+
+ if ($values instanceof Criteria) {
+ $criteria = clone $values;
+ $comparison = $criteria->getComparison(RolePeer::ID);
+ $selectCriteria->add(RolePeer::ID, $criteria->remove(RolePeer::ID), $comparison);
+
+ } else { $criteria = $values->buildCriteria(); $selectCriteria = $values->buildPkeyCriteria(); }
+
+ $criteria->setDbName(self::DATABASE_NAME);
+
+ return BasePeer::doUpdate($selectCriteria, $criteria, $con);
+ }
+
+
+ public static function doDeleteAll($con = null)
+ {
+ if ($con === null) {
+ $con = Propel::getConnection(self::DATABASE_NAME);
+ }
+ $affectedRows = 0; try {
+ $con->begin();
+ $affectedRows += BasePeer::doDeleteAll(RolePeer::TABLE_NAME, $con);
+ $con->commit();
+ return $affectedRows;
+ } catch (PropelException $e) {
+ $con->rollback();
+ throw $e;
+ }
+ }
+
+
+ public static function doDelete($values, $con = null)
+ {
+ if ($con === null) {
+ $con = Propel::getConnection(RolePeer::DATABASE_NAME);
+ }
+
+ if ($values instanceof Criteria) {
+ $criteria = clone $values; } elseif ($values instanceof Role) {
+
+ $criteria = $values->buildPkeyCriteria();
+ } else {
+ $criteria = new Criteria(self::DATABASE_NAME);
+ $criteria->add(RolePeer::ID, (array) $values, Criteria::IN);
+ }
+
+ $criteria->setDbName(self::DATABASE_NAME);
+
+ $affectedRows = 0;
+ try {
+ $con->begin();
+
+ $affectedRows += BasePeer::doDelete($criteria, $con);
+ $con->commit();
+ return $affectedRows;
+ } catch (PropelException $e) {
+ $con->rollback();
+ throw $e;
+ }
+ }
+
+
+ public static function doValidate(Role $obj, $cols = null)
+ {
+ $columns = array();
+
+ if ($cols) {
+ $dbMap = Propel::getDatabaseMap(RolePeer::DATABASE_NAME);
+ $tableMap = $dbMap->getTable(RolePeer::TABLE_NAME);
+
+ if (! is_array($cols)) {
+ $cols = array($cols);
+ }
+
+ foreach($cols as $colName) {
+ if ($tableMap->containsColumn($colName)) {
+ $get = 'get' . $tableMap->getColumn($colName)->getPhpName();
+ $columns[$colName] = $obj->$get();
+ }
+ }
+ } else {
+
+ }
+
+ $res = BasePeer::doValidate(RolePeer::DATABASE_NAME, RolePeer::TABLE_NAME, $columns);
+ if ($res !== true) {
+ $request = sfContext::getInstance()->getRequest();
+ foreach ($res as $failed) {
+ $col = RolePeer::translateFieldname($failed->getColumn(), BasePeer::TYPE_COLNAME, BasePeer::TYPE_PHPNAME);
+ $request->setError($col, $failed->getMessage());
+ }
+ }
+
+ return $res;
+ }
+
+
+ public static function retrieveByPK($pk, $con = null)
+ {
+ if ($con === null) {
+ $con = Propel::getConnection(self::DATABASE_NAME);
+ }
+
+ $criteria = new Criteria(RolePeer::DATABASE_NAME);
+
+ $criteria->add(RolePeer::ID, $pk);
+
+
+ $v = RolePeer::doSelect($criteria, $con);
+
+ return !empty($v) > 0 ? $v[0] : null;
+ }
+
+
+ public static function retrieveByPKs($pks, $con = null)
+ {
+ if ($con === null) {
+ $con = Propel::getConnection(self::DATABASE_NAME);
+ }
+
+ $objs = null;
+ if (empty($pks)) {
+ $objs = array();
+ } else {
+ $criteria = new Criteria();
+ $criteria->add(RolePeer::ID, $pks, Criteria::IN);
+ $objs = RolePeer::doSelect($criteria, $con);
+ }
+ return $objs;
+ }
+
+}
+if (Propel::isInit()) {
+ try {
+ BaseRolePeer::getMapBuilder();
+ } catch (Exception $e) {
+ Propel::log('Could not initialize Peer: ' . $e->getMessage(), Propel::LOG_ERR);
+ }
+} else {
+ require_once 'lib/model/map/RoleMapBuilder.php';
+ Propel::registerMapBuilder('lib.model.map.RoleMapBuilder');
+}
diff --git a/lib/model/om/BaseUser.php b/lib/model/om/BaseUser.php
new file mode 100644
index 0000000..c9588be
--- /dev/null
+++ b/lib/model/om/BaseUser.php
@@ -0,0 +1,1261 @@
+<?php
+
+
+abstract class BaseUser extends BaseObject implements Persistent {
+
+
+
+ protected static $peer;
+
+
+
+ protected $id;
+
+
+
+ protected $parent_user_id = -1;
+
+
+
+ protected $nickname;
+
+
+
+ protected $first_name;
+
+
+
+ protected $last_name;
+
+
+
+ protected $email;
+
+
+
+ protected $sha1_password;
+
+
+
+ protected $salt;
+
+
+
+ protected $role_id;
+
+
+
+ protected $last_login;
+
+
+
+ protected $created_at;
+
+
+ protected $aUserRelatedByParentUserId;
+
+
+ protected $aRole;
+
+
+ protected $collUsersRelatedByParentUserId;
+
+
+ protected $lastUserRelatedByParentUserIdCriteria = null;
+
+
+ protected $collDomainPermissions;
+
+
+ protected $lastDomainPermissionCriteria = null;
+
+
+ protected $collDomains;
+
+
+ protected $lastDomainCriteria = null;
+
+
+ protected $collLogEntrys;
+
+
+ protected $lastLogEntryCriteria = null;
+
+
+ protected $alreadyInSave = false;
+
+
+ protected $alreadyInValidation = false;
+
+
+ public function getId()
+ {
+
+ return $this->id;
+ }
+
+
+ public function getParentUserId()
+ {
+
+ return $this->parent_user_id;
+ }
+
+
+ public function getNickname()
+ {
+
+ return $this->nickname;
+ }
+
+
+ public function getFirstName()
+ {
+
+ return $this->first_name;
+ }
+
+
+ public function getLastName()
+ {
+
+ return $this->last_name;
+ }
+
+
+ public function getEmail()
+ {
+
+ return $this->email;
+ }
+
+
+ public function getSha1Password()
+ {
+
+ return $this->sha1_password;
+ }
+
+
+ public function getSalt()
+ {
+
+ return $this->salt;
+ }
+
+
+ public function getRoleId()
+ {
+
+ return $this->role_id;
+ }
+
+
+ public function getLastLogin($format = 'Y-m-d H:i:s')
+ {
+
+ if ($this->last_login === null || $this->last_login === '') {
+ return null;
+ } elseif (!is_int($this->last_login)) {
+ $ts = strtotime($this->last_login);
+ if ($ts === -1 || $ts === false) { throw new PropelException("Unable to parse value of [last_login] as date/time value: " . var_export($this->last_login, true));
+ }
+ } else {
+ $ts = $this->last_login;
+ }
+ if ($format === null) {
+ return $ts;
+ } elseif (strpos($format, '%') !== false) {
+ return strftime($format, $ts);
+ } else {
+ return date($format, $ts);
+ }
+ }
+
+
+ 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 setId($v)
+ {
+
+ if ($v !== null && !is_int($v) && is_numeric($v)) {
+ $v = (int) $v;
+ }
+
+ if ($this->id !== $v) {
+ $this->id = $v;
+ $this->modifiedColumns[] = UserPeer::ID;
+ }
+
+ }
+
+ public function setParentUserId($v)
+ {
+
+ if ($v !== null && !is_int($v) && is_numeric($v)) {
+ $v = (int) $v;
+ }
+
+ if ($this->parent_user_id !== $v || $v === -1) {
+ $this->parent_user_id = $v;
+ $this->modifiedColumns[] = UserPeer::PARENT_USER_ID;
+ }
+
+ if ($this->aUserRelatedByParentUserId !== null && $this->aUserRelatedByParentUserId->getId() !== $v) {
+ $this->aUserRelatedByParentUserId = null;
+ }
+
+ }
+
+ public function setNickname($v)
+ {
+
+ if ($v !== null && !is_string($v)) {
+ $v = (string) $v;
+ }
+
+ if ($this->nickname !== $v) {
+ $this->nickname = $v;
+ $this->modifiedColumns[] = UserPeer::NICKNAME;
+ }
+
+ }
+
+ public function setFirstName($v)
+ {
+
+ if ($v !== null && !is_string($v)) {
+ $v = (string) $v;
+ }
+
+ if ($this->first_name !== $v) {
+ $this->first_name = $v;
+ $this->modifiedColumns[] = UserPeer::FIRST_NAME;
+ }
+
+ }
+
+ public function setLastName($v)
+ {
+
+ if ($v !== null && !is_string($v)) {
+ $v = (string) $v;
+ }
+
+ if ($this->last_name !== $v) {
+ $this->last_name = $v;
+ $this->modifiedColumns[] = UserPeer::LAST_NAME;
+ }
+
+ }
+
+ public function setEmail($v)
+ {
+
+ if ($v !== null && !is_string($v)) {
+ $v = (string) $v;
+ }
+
+ if ($this->email !== $v) {
+ $this->email = $v;
+ $this->modifiedColumns[] = UserPeer::EMAIL;
+ }
+
+ }
+
+ public function setSha1Password($v)
+ {
+
+ if ($v !== null && !is_string($v)) {
+ $v = (string) $v;
+ }
+
+ if ($this->sha1_password !== $v) {
+ $this->sha1_password = $v;
+ $this->modifiedColumns[] = UserPeer::SHA1_PASSWORD;
+ }
+
+ }
+
+ public function setSalt($v)
+ {
+
+ if ($v !== null && !is_string($v)) {
+ $v = (string) $v;
+ }
+
+ if ($this->salt !== $v) {
+ $this->salt = $v;
+ $this->modifiedColumns[] = UserPeer::SALT;
+ }
+
+ }
+
+ public function setRoleId($v)
+ {
+
+ if ($v !== null && !is_int($v) && is_numeric($v)) {
+ $v = (int) $v;
+ }
+
+ if ($this->role_id !== $v) {
+ $this->role_id = $v;
+ $this->modifiedColumns[] = UserPeer::ROLE_ID;
+ }
+
+ if ($this->aRole !== null && $this->aRole->getId() !== $v) {
+ $this->aRole = null;
+ }
+
+ }
+
+ public function setLastLogin($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 [last_login] from input: " . var_export($v, true));
+ }
+ } else {
+ $ts = $v;
+ }
+ if ($this->last_login !== $ts) {
+ $this->last_login = $ts;
+ $this->modifiedColumns[] = UserPeer::LAST_LOGIN;
+ }
+
+ }
+
+ 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[] = UserPeer::CREATED_AT;
+ }
+
+ }
+
+ public function hydrate(ResultSet $rs, $startcol = 1)
+ {
+ try {
+
+ $this->id = $rs->getInt($startcol + 0);
+
+ $this->parent_user_id = $rs->getInt($startcol + 1);
+
+ $this->nickname = $rs->getString($startcol + 2);
+
+ $this->first_name = $rs->getString($startcol + 3);
+
+ $this->last_name = $rs->getString($startcol + 4);
+
+ $this->email = $rs->getString($startcol + 5);
+
+ $this->sha1_password = $rs->getString($startcol + 6);
+
+ $this->salt = $rs->getString($startcol + 7);
+
+ $this->role_id = $rs->getInt($startcol + 8);
+
+ $this->last_login = $rs->getTimestamp($startcol + 9, null);
+
+ $this->created_at = $rs->getTimestamp($startcol + 10, null);
+
+ $this->resetModified();
+
+ $this->setNew(false);
+
+ return $startcol + 11;
+ } catch (Exception $e) {
+ throw new PropelException("Error populating User 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(UserPeer::DATABASE_NAME);
+ }
+
+ try {
+ $con->begin();
+ UserPeer::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(UserPeer::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(UserPeer::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->aUserRelatedByParentUserId !== null) {
+ if ($this->aUserRelatedByParentUserId->isModified()) {
+ $affectedRows += $this->aUserRelatedByParentUserId->save($con);
+ }
+ $this->setUserRelatedByParentUserId($this->aUserRelatedByParentUserId);
+ }
+
+ if ($this->aRole !== null) {
+ if ($this->aRole->isModified()) {
+ $affectedRows += $this->aRole->save($con);
+ }
+ $this->setRole($this->aRole);
+ }
+
+
+ if ($this->isModified()) {
+ if ($this->isNew()) {
+ $pk = UserPeer::doInsert($this, $con);
+ $affectedRows += 1;
+ $this->setId($pk);
+ $this->setNew(false);
+ } else {
+ $affectedRows += UserPeer::doUpdate($this, $con);
+ }
+ $this->resetModified(); }
+
+ if ($this->collUsersRelatedByParentUserId !== null) {
+ foreach($this->collUsersRelatedByParentUserId as $referrerFK) {
+ if (!$referrerFK->isDeleted()) {
+ $affectedRows += $referrerFK->save($con);
+ }
+ }
+ }
+
+ if ($this->collDomainPermissions !== null) {
+ foreach($this->collDomainPermissions as $referrerFK) {
+ if (!$referrerFK->isDeleted()) {
+ $affectedRows += $referrerFK->save($con);
+ }
+ }
+ }
+
+ if ($this->collDomains !== null) {
+ foreach($this->collDomains as $referrerFK) {
+ if (!$referrerFK->isDeleted()) {
+ $affectedRows += $referrerFK->save($con);
+ }
+ }
+ }
+
+ if ($this->collLogEntrys !== null) {
+ foreach($this->collLogEntrys as $referrerFK) {
+ if (!$referrerFK->isDeleted()) {
+ $affectedRows += $referrerFK->save($con);
+ }
+ }
+ }
+
+ $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->aUserRelatedByParentUserId !== null) {
+ if (!$this->aUserRelatedByParentUserId->validate($columns)) {
+ $failureMap = array_merge($failureMap, $this->aUserRelatedByParentUserId->getValidationFailures());
+ }
+ }
+
+ if ($this->aRole !== null) {
+ if (!$this->aRole->validate($columns)) {
+ $failureMap = array_merge($failureMap, $this->aRole->getValidationFailures());
+ }
+ }
+
+
+ if (($retval = UserPeer::doValidate($this, $columns)) !== true) {
+ $failureMap = array_merge($failureMap, $retval);
+ }
+
+
+ if ($this->collDomainPermissions !== null) {
+ foreach($this->collDomainPermissions as $referrerFK) {
+ if (!$referrerFK->validate($columns)) {
+ $failureMap = array_merge($failureMap, $referrerFK->getValidationFailures());
+ }
+ }
+ }
+
+ if ($this->collDomains !== null) {
+ foreach($this->collDomains as $referrerFK) {
+ if (!$referrerFK->validate($columns)) {
+ $failureMap = array_merge($failureMap, $referrerFK->getValidationFailures());
+ }
+ }
+ }
+
+ if ($this->collLogEntrys !== null) {
+ foreach($this->collLogEntrys as $referrerFK) {
+ if (!$referrerFK->validate($columns)) {
+ $failureMap = array_merge($failureMap, $referrerFK->getValidationFailures());
+ }
+ }
+ }
+
+
+ $this->alreadyInValidation = false;
+ }
+
+ return (!empty($failureMap) ? $failureMap : true);
+ }
+
+
+ public function getByName($name, $type = BasePeer::TYPE_PHPNAME)
+ {
+ $pos = UserPeer::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->getParentUserId();
+ break;
+ case 2:
+ return $this->getNickname();
+ break;
+ case 3:
+ return $this->getFirstName();
+ break;
+ case 4:
+ return $this->getLastName();
+ break;
+ case 5:
+ return $this->getEmail();
+ break;
+ case 6:
+ return $this->getSha1Password();
+ break;
+ case 7:
+ return $this->getSalt();
+ break;
+ case 8:
+ return $this->getRoleId();
+ break;
+ case 9:
+ return $this->getLastLogin();
+ break;
+ case 10:
+ return $this->getCreatedAt();
+ break;
+ default:
+ return null;
+ break;
+ } }
+
+
+ public function toArray($keyType = BasePeer::TYPE_PHPNAME)
+ {
+ $keys = UserPeer::getFieldNames($keyType);
+ $result = array(
+ $keys[0] => $this->getId(),
+ $keys[1] => $this->getParentUserId(),
+ $keys[2] => $this->getNickname(),
+ $keys[3] => $this->getFirstName(),
+ $keys[4] => $this->getLastName(),
+ $keys[5] => $this->getEmail(),
+ $keys[6] => $this->getSha1Password(),
+ $keys[7] => $this->getSalt(),
+ $keys[8] => $this->getRoleId(),
+ $keys[9] => $this->getLastLogin(),
+ $keys[10] => $this->getCreatedAt(),
+ );
+ return $result;
+ }
+
+
+ public function setByName($name, $value, $type = BasePeer::TYPE_PHPNAME)
+ {
+ $pos = UserPeer::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->setParentUserId($value);
+ break;
+ case 2:
+ $this->setNickname($value);
+ break;
+ case 3:
+ $this->setFirstName($value);
+ break;
+ case 4:
+ $this->setLastName($value);
+ break;
+ case 5:
+ $this->setEmail($value);
+ break;
+ case 6:
+ $this->setSha1Password($value);
+ break;
+ case 7:
+ $this->setSalt($value);
+ break;
+ case 8:
+ $this->setRoleId($value);
+ break;
+ case 9:
+ $this->setLastLogin($value);
+ break;
+ case 10:
+ $this->setCreatedAt($value);
+ break;
+ } }
+
+
+ public function fromArray($arr, $keyType = BasePeer::TYPE_PHPNAME)
+ {
+ $keys = UserPeer::getFieldNames($keyType);
+
+ if (array_key_exists($keys[0], $arr)) $this->setId($arr[$keys[0]]);
+ if (array_key_exists($keys[1], $arr)) $this->setParentUserId($arr[$keys[1]]);
+ if (array_key_exists($keys[2], $arr)) $this->setNickname($arr[$keys[2]]);
+ if (array_key_exists($keys[3], $arr)) $this->setFirstName($arr[$keys[3]]);
+ if (array_key_exists($keys[4], $arr)) $this->setLastName($arr[$keys[4]]);
+ if (array_key_exists($keys[5], $arr)) $this->setEmail($arr[$keys[5]]);
+ if (array_key_exists($keys[6], $arr)) $this->setSha1Password($arr[$keys[6]]);
+ if (array_key_exists($keys[7], $arr)) $this->setSalt($arr[$keys[7]]);
+ if (array_key_exists($keys[8], $arr)) $this->setRoleId($arr[$keys[8]]);
+ if (array_key_exists($keys[9], $arr)) $this->setLastLogin($arr[$keys[9]]);
+ if (array_key_exists($keys[10], $arr)) $this->setCreatedAt($arr[$keys[10]]);
+ }
+
+
+ public function buildCriteria()
+ {
+ $criteria = new Criteria(UserPeer::DATABASE_NAME);
+
+ if ($this->isColumnModified(UserPeer::ID)) $criteria->add(UserPeer::ID, $this->id);
+ if ($this->isColumnModified(UserPeer::PARENT_USER_ID)) $criteria->add(UserPeer::PARENT_USER_ID, $this->parent_user_id);
+ if ($this->isColumnModified(UserPeer::NICKNAME)) $criteria->add(UserPeer::NICKNAME, $this->nickname);
+ if ($this->isColumnModified(UserPeer::FIRST_NAME)) $criteria->add(UserPeer::FIRST_NAME, $this->first_name);
+ if ($this->isColumnModified(UserPeer::LAST_NAME)) $criteria->add(UserPeer::LAST_NAME, $this->last_name);
+ if ($this->isColumnModified(UserPeer::EMAIL)) $criteria->add(UserPeer::EMAIL, $this->email);
+ if ($this->isColumnModified(UserPeer::SHA1_PASSWORD)) $criteria->add(UserPeer::SHA1_PASSWORD, $this->sha1_password);
+ if ($this->isColumnModified(UserPeer::SALT)) $criteria->add(UserPeer::SALT, $this->salt);
+ if ($this->isColumnModified(UserPeer::ROLE_ID)) $criteria->add(UserPeer::ROLE_ID, $this->role_id);
+ if ($this->isColumnModified(UserPeer::LAST_LOGIN)) $criteria->add(UserPeer::LAST_LOGIN, $this->last_login);
+ if ($this->isColumnModified(UserPeer::CREATED_AT)) $criteria->add(UserPeer::CREATED_AT, $this->created_at);
+
+ return $criteria;
+ }
+
+
+ public function buildPkeyCriteria()
+ {
+ $criteria = new Criteria(UserPeer::DATABASE_NAME);
+
+ $criteria->add(UserPeer::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->setParentUserId($this->parent_user_id);
+
+ $copyObj->setNickname($this->nickname);
+
+ $copyObj->setFirstName($this->first_name);
+
+ $copyObj->setLastName($this->last_name);
+
+ $copyObj->setEmail($this->email);
+
+ $copyObj->setSha1Password($this->sha1_password);
+
+ $copyObj->setSalt($this->salt);
+
+ $copyObj->setRoleId($this->role_id);
+
+ $copyObj->setLastLogin($this->last_login);
+
+ $copyObj->setCreatedAt($this->created_at);
+
+
+ if ($deepCopy) {
+ $copyObj->setNew(false);
+
+ foreach($this->getUsersRelatedByParentUserId() as $relObj) {
+ if($this->getPrimaryKey() === $relObj->getPrimaryKey()) {
+ continue;
+ }
+
+ $copyObj->addUserRelatedByParentUserId($relObj->copy($deepCopy));
+ }
+
+ foreach($this->getDomainPermissions() as $relObj) {
+ $copyObj->addDomainPermission($relObj->copy($deepCopy));
+ }
+
+ foreach($this->getDomains() as $relObj) {
+ $copyObj->addDomain($relObj->copy($deepCopy));
+ }
+
+ foreach($this->getLogEntrys() as $relObj) {
+ $copyObj->addLogEntry($relObj->copy($deepCopy));
+ }
+
+ }
+
+ $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 UserPeer();
+ }
+ return self::$peer;
+ }
+
+
+ public function setUserRelatedByParentUserId($v)
+ {
+
+
+ if ($v === null) {
+ $this->setParentUserId('-1');
+ } else {
+ $this->setParentUserId($v->getId());
+ }
+
+
+ $this->aUserRelatedByParentUserId = $v;
+ }
+
+
+
+ public function getUserRelatedByParentUserId($con = null)
+ {
+ include_once 'lib/model/om/BaseUserPeer.php';
+
+ if ($this->aUserRelatedByParentUserId === null && ($this->parent_user_id !== null)) {
+
+ $this->aUserRelatedByParentUserId = UserPeer::retrieveByPK($this->parent_user_id, $con);
+
+
+ }
+ return $this->aUserRelatedByParentUserId;
+ }
+
+
+ public function setRole($v)
+ {
+
+
+ if ($v === null) {
+ $this->setRoleId(NULL);
+ } else {
+ $this->setRoleId($v->getId());
+ }
+
+
+ $this->aRole = $v;
+ }
+
+
+
+ public function getRole($con = null)
+ {
+ include_once 'lib/model/om/BaseRolePeer.php';
+
+ if ($this->aRole === null && ($this->role_id !== null)) {
+
+ $this->aRole = RolePeer::retrieveByPK($this->role_id, $con);
+
+
+ }
+ return $this->aRole;
+ }
+
+
+ public function initUsersRelatedByParentUserId()
+ {
+ if ($this->collUsersRelatedByParentUserId === null) {
+ $this->collUsersRelatedByParentUserId = array();
+ }
+ }
+
+
+ public function getUsersRelatedByParentUserId($criteria = null, $con = null)
+ {
+ include_once 'lib/model/om/BaseUserPeer.php';
+ if ($criteria === null) {
+ $criteria = new Criteria();
+ }
+ elseif ($criteria instanceof Criteria)
+ {
+ $criteria = clone $criteria;
+ }
+
+ if ($this->collUsersRelatedByParentUserId === null) {
+ if ($this->isNew()) {
+ $this->collUsersRelatedByParentUserId = array();
+ } else {
+
+ $criteria->add(UserPeer::PARENT_USER_ID, $this->getId());
+
+ UserPeer::addSelectColumns($criteria);
+ $this->collUsersRelatedByParentUserId = UserPeer::doSelect($criteria, $con);
+ }
+ } else {
+ if (!$this->isNew()) {
+
+
+ $criteria->add(UserPeer::PARENT_USER_ID, $this->getId());
+
+ UserPeer::addSelectColumns($criteria);
+ if (!isset($this->lastUserRelatedByParentUserIdCriteria) || !$this->lastUserRelatedByParentUserIdCriteria->equals($criteria)) {
+ $this->collUsersRelatedByParentUserId = UserPeer::doSelect($criteria, $con);
+ }
+ }
+ }
+ $this->lastUserRelatedByParentUserIdCriteria = $criteria;
+ return $this->collUsersRelatedByParentUserId;
+ }
+
+
+ public function countUsersRelatedByParentUserId($criteria = null, $distinct = false, $con = null)
+ {
+ include_once 'lib/model/om/BaseUserPeer.php';
+ if ($criteria === null) {
+ $criteria = new Criteria();
+ }
+ elseif ($criteria instanceof Criteria)
+ {
+ $criteria = clone $criteria;
+ }
+
+ $criteria->add(UserPeer::PARENT_USER_ID, $this->getId());
+
+ return UserPeer::doCount($criteria, $distinct, $con);
+ }
+
+
+ public function addUserRelatedByParentUserId(User $l)
+ {
+ $this->collUsersRelatedByParentUserId[] = $l;
+ $l->setUserRelatedByParentUserId($this);
+ }
+
+
+
+ public function getUsersRelatedByParentUserIdJoinRole($criteria = null, $con = null)
+ {
+ include_once 'lib/model/om/BaseUserPeer.php';
+ if ($criteria === null) {
+ $criteria = new Criteria();
+ }
+ elseif ($criteria instanceof Criteria)
+ {
+ $criteria = clone $criteria;
+ }
+
+ if ($this->collUsersRelatedByParentUserId === null) {
+ if ($this->isNew()) {
+ $this->collUsersRelatedByParentUserId = array();
+ } else {
+
+ $criteria->add(UserPeer::PARENT_USER_ID, $this->getId());
+
+ $this->collUsersRelatedByParentUserId = UserPeer::doSelectJoinRole($criteria, $con);
+ }
+ } else {
+
+ $criteria->add(UserPeer::PARENT_USER_ID, $this->getId());
+
+ if (!isset($this->lastUserRelatedByParentUserIdCriteria) || !$this->lastUserRelatedByParentUserIdCriteria->equals($criteria)) {
+ $this->collUsersRelatedByParentUserId = UserPeer::doSelectJoinRole($criteria, $con);
+ }
+ }
+ $this->lastUserRelatedByParentUserIdCriteria = $criteria;
+
+ return $this->collUsersRelatedByParentUserId;
+ }
+
+
+ public function initDomainPermissions()
+ {
+ if ($this->collDomainPermissions === null) {
+ $this->collDomainPermissions = array();
+ }
+ }
+
+
+ public function getDomainPermissions($criteria = null, $con = null)
+ {
+ include_once 'lib/model/om/BaseDomainPermissionPeer.php';
+ if ($criteria === null) {
+ $criteria = new Criteria();
+ }
+ elseif ($criteria instanceof Criteria)
+ {
+ $criteria = clone $criteria;
+ }
+
+ if ($this->collDomainPermissions === null) {
+ if ($this->isNew()) {
+ $this->collDomainPermissions = array();
+ } else {
+
+ $criteria->add(DomainPermissionPeer::USER_ID, $this->getId());
+
+ DomainPermissionPeer::addSelectColumns($criteria);
+ $this->collDomainPermissions = DomainPermissionPeer::doSelect($criteria, $con);
+ }
+ } else {
+ if (!$this->isNew()) {
+
+
+ $criteria->add(DomainPermissionPeer::USER_ID, $this->getId());
+
+ DomainPermissionPeer::addSelectColumns($criteria);
+ if (!isset($this->lastDomainPermissionCriteria) || !$this->lastDomainPermissionCriteria->equals($criteria)) {
+ $this->collDomainPermissions = DomainPermissionPeer::doSelect($criteria, $con);
+ }
+ }
+ }
+ $this->lastDomainPermissionCriteria = $criteria;
+ return $this->collDomainPermissions;
+ }
+
+
+ public function countDomainPermissions($criteria = null, $distinct = false, $con = null)
+ {
+ include_once 'lib/model/om/BaseDomainPermissionPeer.php';
+ if ($criteria === null) {
+ $criteria = new Criteria();
+ }
+ elseif ($criteria instanceof Criteria)
+ {
+ $criteria = clone $criteria;
+ }
+
+ $criteria->add(DomainPermissionPeer::USER_ID, $this->getId());
+
+ return DomainPermissionPeer::doCount($criteria, $distinct, $con);
+ }
+
+
+ public function addDomainPermission(DomainPermission $l)
+ {
+ $this->collDomainPermissions[] = $l;
+ $l->setUser($this);
+ }
+
+
+
+ public function getDomainPermissionsJoinDomain($criteria = null, $con = null)
+ {
+ include_once 'lib/model/om/BaseDomainPermissionPeer.php';
+ if ($criteria === null) {
+ $criteria = new Criteria();
+ }
+ elseif ($criteria instanceof Criteria)
+ {
+ $criteria = clone $criteria;
+ }
+
+ if ($this->collDomainPermissions === null) {
+ if ($this->isNew()) {
+ $this->collDomainPermissions = array();
+ } else {
+
+ $criteria->add(DomainPermissionPeer::USER_ID, $this->getId());
+
+ $this->collDomainPermissions = DomainPermissionPeer::doSelectJoinDomain($criteria, $con);
+ }
+ } else {
+
+ $criteria->add(DomainPermissionPeer::USER_ID, $this->getId());
+
+ if (!isset($this->lastDomainPermissionCriteria) || !$this->lastDomainPermissionCriteria->equals($criteria)) {
+ $this->collDomainPermissions = DomainPermissionPeer::doSelectJoinDomain($criteria, $con);
+ }
+ }
+ $this->lastDomainPermissionCriteria = $criteria;
+
+ return $this->collDomainPermissions;
+ }
+
+
+ public function initDomains()
+ {
+ if ($this->collDomains === null) {
+ $this->collDomains = array();
+ }
+ }
+
+
+ public function getDomains($criteria = null, $con = null)
+ {
+ include_once 'lib/model/om/BaseDomainPeer.php';
+ if ($criteria === null) {
+ $criteria = new Criteria();
+ }
+ elseif ($criteria instanceof Criteria)
+ {
+ $criteria = clone $criteria;
+ }
+
+ if ($this->collDomains === null) {
+ if ($this->isNew()) {
+ $this->collDomains = array();
+ } else {
+
+ $criteria->add(DomainPeer::CREATOR_ID, $this->getId());
+
+ DomainPeer::addSelectColumns($criteria);
+ $this->collDomains = DomainPeer::doSelect($criteria, $con);
+ }
+ } else {
+ if (!$this->isNew()) {
+
+
+ $criteria->add(DomainPeer::CREATOR_ID, $this->getId());
+
+ DomainPeer::addSelectColumns($criteria);
+ if (!isset($this->lastDomainCriteria) || !$this->lastDomainCriteria->equals($criteria)) {
+ $this->collDomains = DomainPeer::doSelect($criteria, $con);
+ }
+ }
+ }
+ $this->lastDomainCriteria = $criteria;
+ return $this->collDomains;
+ }
+
+
+ public function countDomains($criteria = null, $distinct = false, $con = null)
+ {
+ include_once 'lib/model/om/BaseDomainPeer.php';
+ if ($criteria === null) {
+ $criteria = new Criteria();
+ }
+ elseif ($criteria instanceof Criteria)
+ {
+ $criteria = clone $criteria;
+ }
+
+ $criteria->add(DomainPeer::CREATOR_ID, $this->getId());
+
+ return DomainPeer::doCount($criteria, $distinct, $con);
+ }
+
+
+ public function addDomain(Domain $l)
+ {
+ $this->collDomains[] = $l;
+ $l->setUser($this);
+ }
+
+
+ public function initLogEntrys()
+ {
+ if ($this->collLogEntrys === null) {
+ $this->collLogEntrys = array();
+ }
+ }
+
+
+ public function getLogEntrys($criteria = null, $con = null)
+ {
+ include_once 'lib/model/om/BaseLogEntryPeer.php';
+ if ($criteria === null) {
+ $criteria = new Criteria();
+ }
+ elseif ($criteria instanceof Criteria)
+ {
+ $criteria = clone $criteria;
+ }
+
+ if ($this->collLogEntrys === null) {
+ if ($this->isNew()) {
+ $this->collLogEntrys = array();
+ } else {
+
+ $criteria->add(LogEntryPeer::USER_ID, $this->getId());
+
+ LogEntryPeer::addSelectColumns($criteria);
+ $this->collLogEntrys = LogEntryPeer::doSelect($criteria, $con);
+ }
+ } else {
+ if (!$this->isNew()) {
+
+
+ $criteria->add(LogEntryPeer::USER_ID, $this->getId());
+
+ LogEntryPeer::addSelectColumns($criteria);
+ if (!isset($this->lastLogEntryCriteria) || !$this->lastLogEntryCriteria->equals($criteria)) {
+ $this->collLogEntrys = LogEntryPeer::doSelect($criteria, $con);
+ }
+ }
+ }
+ $this->lastLogEntryCriteria = $criteria;
+ return $this->collLogEntrys;
+ }
+
+
+ public function countLogEntrys($criteria = null, $distinct = false, $con = null)
+ {
+ include_once 'lib/model/om/BaseLogEntryPeer.php';
+ if ($criteria === null) {
+ $criteria = new Criteria();
+ }
+ elseif ($criteria instanceof Criteria)
+ {
+ $criteria = clone $criteria;
+ }
+
+ $criteria->add(LogEntryPeer::USER_ID, $this->getId());
+
+ return LogEntryPeer::doCount($criteria, $distinct, $con);
+ }
+
+
+ public function addLogEntry(LogEntry $l)
+ {
+ $this->collLogEntrys[] = $l;
+ $l->setUser($this);
+ }
+
+} \ No newline at end of file
diff --git a/lib/model/om/BaseUserPeer.php b/lib/model/om/BaseUserPeer.php
new file mode 100644
index 0000000..605ff27
--- /dev/null
+++ b/lib/model/om/BaseUserPeer.php
@@ -0,0 +1,758 @@
+<?php
+
+
+abstract class BaseUserPeer {
+
+
+ const DATABASE_NAME = 'propel';
+
+
+ const TABLE_NAME = 'user';
+
+
+ const CLASS_DEFAULT = 'lib.model.User';
+
+
+ const NUM_COLUMNS = 11;
+
+
+ const NUM_LAZY_LOAD_COLUMNS = 0;
+
+
+
+ const ID = 'user.ID';
+
+
+ const PARENT_USER_ID = 'user.PARENT_USER_ID';
+
+
+ const NICKNAME = 'user.NICKNAME';
+
+
+ const FIRST_NAME = 'user.FIRST_NAME';
+
+
+ const LAST_NAME = 'user.LAST_NAME';
+
+
+ const EMAIL = 'user.EMAIL';
+
+
+ const SHA1_PASSWORD = 'user.SHA1_PASSWORD';
+
+
+ const SALT = 'user.SALT';
+
+
+ const ROLE_ID = 'user.ROLE_ID';
+
+
+ const LAST_LOGIN = 'user.LAST_LOGIN';
+
+
+ const CREATED_AT = 'user.CREATED_AT';
+
+
+ private static $phpNameMap = null;
+
+
+
+ private static $fieldNames = array (
+ BasePeer::TYPE_PHPNAME => array ('Id', 'ParentUserId', 'Nickname', 'FirstName', 'LastName', 'Email', 'Sha1Password', 'Salt', 'RoleId', 'LastLogin', 'CreatedAt', ),
+ BasePeer::TYPE_COLNAME => array (UserPeer::ID, UserPeer::PARENT_USER_ID, UserPeer::NICKNAME, UserPeer::FIRST_NAME, UserPeer::LAST_NAME, UserPeer::EMAIL, UserPeer::SHA1_PASSWORD, UserPeer::SALT, UserPeer::ROLE_ID, UserPeer::LAST_LOGIN, UserPeer::CREATED_AT, ),
+ BasePeer::TYPE_FIELDNAME => array ('id', 'parent_user_id', 'nickname', 'first_name', 'last_name', 'email', 'sha1_password', 'salt', 'role_id', 'last_login', 'created_at', ),
+ BasePeer::TYPE_NUM => array (0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, )
+ );
+
+
+ private static $fieldKeys = array (
+ BasePeer::TYPE_PHPNAME => array ('Id' => 0, 'ParentUserId' => 1, 'Nickname' => 2, 'FirstName' => 3, 'LastName' => 4, 'Email' => 5, 'Sha1Password' => 6, 'Salt' => 7, 'RoleId' => 8, 'LastLogin' => 9, 'CreatedAt' => 10, ),
+ BasePeer::TYPE_COLNAME => array (UserPeer::ID => 0, UserPeer::PARENT_USER_ID => 1, UserPeer::NICKNAME => 2, UserPeer::FIRST_NAME => 3, UserPeer::LAST_NAME => 4, UserPeer::EMAIL => 5, UserPeer::SHA1_PASSWORD => 6, UserPeer::SALT => 7, UserPeer::ROLE_ID => 8, UserPeer::LAST_LOGIN => 9, UserPeer::CREATED_AT => 10, ),
+ BasePeer::TYPE_FIELDNAME => array ('id' => 0, 'parent_user_id' => 1, 'nickname' => 2, 'first_name' => 3, 'last_name' => 4, 'email' => 5, 'sha1_password' => 6, 'salt' => 7, 'role_id' => 8, 'last_login' => 9, 'created_at' => 10, ),
+ BasePeer::TYPE_NUM => array (0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, )
+ );
+
+
+ public static function getMapBuilder()
+ {
+ include_once 'lib/model/map/UserMapBuilder.php';
+ return BasePeer::getMapBuilder('lib.model.map.UserMapBuilder');
+ }
+
+ public static function getPhpNameMap()
+ {
+ if (self::$phpNameMap === null) {
+ $map = UserPeer::getTableMap();
+ $columns = $map->getColumns();
+ $nameMap = array();
+ foreach ($columns as $column) {
+ $nameMap[$column->getPhpName()] = $column->getColumnName();
+ }
+ self::$phpNameMap = $nameMap;
+ }
+ return self::$phpNameMap;
+ }
+
+ static public function translateFieldName($name, $fromType, $toType)
+ {
+ $toNames = self::getFieldNames($toType);
+ $key = isset(self::$fieldKeys[$fromType][$name]) ? self::$fieldKeys[$fromType][$name] : null;
+ if ($key === null) {
+ throw new PropelException("'$name' could not be found in the field names of type '$fromType'. These are: " . print_r(self::$fieldKeys[$fromType], true));
+ }
+ return $toNames[$key];
+ }
+
+
+
+ static public function getFieldNames($type = BasePeer::TYPE_PHPNAME)
+ {
+ if (!array_key_exists($type, self::$fieldNames)) {
+ throw new PropelException('Method getFieldNames() expects the parameter $type to be one of the class constants TYPE_PHPNAME, TYPE_COLNAME, TYPE_FIELDNAME, TYPE_NUM. ' . $type . ' was given.');
+ }
+ return self::$fieldNames[$type];
+ }
+
+
+ public static function alias($alias, $column)
+ {
+ return str_replace(UserPeer::TABLE_NAME.'.', $alias.'.', $column);
+ }
+
+
+ public static function addSelectColumns(Criteria $criteria)
+ {
+
+ $criteria->addSelectColumn(UserPeer::ID);
+
+ $criteria->addSelectColumn(UserPeer::PARENT_USER_ID);
+
+ $criteria->addSelectColumn(UserPeer::NICKNAME);
+
+ $criteria->addSelectColumn(UserPeer::FIRST_NAME);
+
+ $criteria->addSelectColumn(UserPeer::LAST_NAME);
+
+ $criteria->addSelectColumn(UserPeer::EMAIL);
+
+ $criteria->addSelectColumn(UserPeer::SHA1_PASSWORD);
+
+ $criteria->addSelectColumn(UserPeer::SALT);
+
+ $criteria->addSelectColumn(UserPeer::ROLE_ID);
+
+ $criteria->addSelectColumn(UserPeer::LAST_LOGIN);
+
+ $criteria->addSelectColumn(UserPeer::CREATED_AT);
+
+ }
+
+ const COUNT = 'COUNT(user.ID)';
+ const COUNT_DISTINCT = 'COUNT(DISTINCT user.ID)';
+
+
+ public static function doCount(Criteria $criteria, $distinct = false, $con = null)
+ {
+ $criteria = clone $criteria;
+
+ $criteria->clearSelectColumns()->clearOrderByColumns();
+ if ($distinct || in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) {
+ $criteria->addSelectColumn(UserPeer::COUNT_DISTINCT);
+ } else {
+ $criteria->addSelectColumn(UserPeer::COUNT);
+ }
+
+ foreach($criteria->getGroupByColumns() as $column)
+ {
+ $criteria->addSelectColumn($column);
+ }
+
+ $rs = UserPeer::doSelectRS($criteria, $con);
+ if ($rs->next()) {
+ return $rs->getInt(1);
+ } else {
+ return 0;
+ }
+ }
+
+ public static function doSelectOne(Criteria $criteria, $con = null)
+ {
+ $critcopy = clone $criteria;
+ $critcopy->setLimit(1);
+ $objects = UserPeer::doSelect($critcopy, $con);
+ if ($objects) {
+ return $objects[0];
+ }
+ return null;
+ }
+
+ public static function doSelect(Criteria $criteria, $con = null)
+ {
+ return UserPeer::populateObjects(UserPeer::doSelectRS($criteria, $con));
+ }
+
+ public static function doSelectRS(Criteria $criteria, $con = null)
+ {
+ if ($con === null) {
+ $con = Propel::getConnection(self::DATABASE_NAME);
+ }
+
+ if (!$criteria->getSelectColumns()) {
+ $criteria = clone $criteria;
+ UserPeer::addSelectColumns($criteria);
+ }
+
+ $criteria->setDbName(self::DATABASE_NAME);
+
+ return BasePeer::doSelect($criteria, $con);
+ }
+
+ public static function populateObjects(ResultSet $rs)
+ {
+ $results = array();
+
+ $cls = UserPeer::getOMClass();
+ $cls = Propel::import($cls);
+ while($rs->next()) {
+
+ $obj = new $cls();
+ $obj->hydrate($rs);
+ $results[] = $obj;
+
+ }
+ return $results;
+ }
+
+
+ public static function doCountJoinRole(Criteria $criteria, $distinct = false, $con = null)
+ {
+ $criteria = clone $criteria;
+
+ $criteria->clearSelectColumns()->clearOrderByColumns();
+ if ($distinct || in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) {
+ $criteria->addSelectColumn(UserPeer::COUNT_DISTINCT);
+ } else {
+ $criteria->addSelectColumn(UserPeer::COUNT);
+ }
+
+ foreach($criteria->getGroupByColumns() as $column)
+ {
+ $criteria->addSelectColumn($column);
+ }
+
+ $criteria->addJoin(UserPeer::ROLE_ID, RolePeer::ID);
+
+ $rs = UserPeer::doSelectRS($criteria, $con);
+ if ($rs->next()) {
+ return $rs->getInt(1);
+ } else {
+ return 0;
+ }
+ }
+
+
+
+ public static function doSelectJoinRole(Criteria $c, $con = null)
+ {
+ $c = clone $c;
+
+ if ($c->getDbName() == Propel::getDefaultDB()) {
+ $c->setDbName(self::DATABASE_NAME);
+ }
+
+ UserPeer::addSelectColumns($c);
+ $startcol = (UserPeer::NUM_COLUMNS - UserPeer::NUM_LAZY_LOAD_COLUMNS) + 1;
+ RolePeer::addSelectColumns($c);
+
+ $c->addJoin(UserPeer::ROLE_ID, RolePeer::ID);
+ $rs = BasePeer::doSelect($c, $con);
+ $results = array();
+
+ while($rs->next()) {
+
+ $omClass = UserPeer::getOMClass();
+
+ $cls = Propel::import($omClass);
+ $obj1 = new $cls();
+ $obj1->hydrate($rs);
+
+ $omClass = RolePeer::getOMClass();
+
+ $cls = Propel::import($omClass);
+ $obj2 = new $cls();
+ $obj2->hydrate($rs, $startcol);
+
+ $newObject = true;
+ foreach($results as $temp_obj1) {
+ $temp_obj2 = $temp_obj1->getRole(); if ($temp_obj2->getPrimaryKey() === $obj2->getPrimaryKey()) {
+ $newObject = false;
+ $temp_obj2->addUser($obj1); break;
+ }
+ }
+ if ($newObject) {
+ $obj2->initUsers();
+ $obj2->addUser($obj1); }
+ $results[] = $obj1;
+ }
+ return $results;
+ }
+
+
+
+ public static function doCountJoinAll(Criteria $criteria, $distinct = false, $con = null)
+ {
+ $criteria = clone $criteria;
+
+ $criteria->clearSelectColumns()->clearOrderByColumns();
+ if ($distinct || in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) {
+ $criteria->addSelectColumn(UserPeer::COUNT_DISTINCT);
+ } else {
+ $criteria->addSelectColumn(UserPeer::COUNT);
+ }
+
+ foreach($criteria->getGroupByColumns() as $column)
+ {
+ $criteria->addSelectColumn($column);
+ }
+
+ $criteria->addJoin(UserPeer::ROLE_ID, RolePeer::ID);
+
+ $rs = UserPeer::doSelectRS($criteria, $con);
+ if ($rs->next()) {
+ return $rs->getInt(1);
+ } else {
+ return 0;
+ }
+ }
+
+
+
+ public static function doSelectJoinAll(Criteria $c, $con = null)
+ {
+ $c = clone $c;
+
+ if ($c->getDbName() == Propel::getDefaultDB()) {
+ $c->setDbName(self::DATABASE_NAME);
+ }
+
+ UserPeer::addSelectColumns($c);
+ $startcol2 = (UserPeer::NUM_COLUMNS - UserPeer::NUM_LAZY_LOAD_COLUMNS) + 1;
+
+ RolePeer::addSelectColumns($c);
+ $startcol3 = $startcol2 + RolePeer::NUM_COLUMNS;
+
+ $c->addJoin(UserPeer::ROLE_ID, RolePeer::ID);
+
+ $rs = BasePeer::doSelect($c, $con);
+ $results = array();
+
+ while($rs->next()) {
+
+ $omClass = UserPeer::getOMClass();
+
+
+ $cls = Propel::import($omClass);
+ $obj1 = new $cls();
+ $obj1->hydrate($rs);
+
+
+
+ $omClass = RolePeer::getOMClass();
+
+
+ $cls = Propel::import($omClass);
+ $obj2 = new $cls();
+ $obj2->hydrate($rs, $startcol2);
+
+ $newObject = true;
+ for ($j=0, $resCount=count($results); $j < $resCount; $j++) {
+ $temp_obj1 = $results[$j];
+ $temp_obj2 = $temp_obj1->getRole(); if ($temp_obj2->getPrimaryKey() === $obj2->getPrimaryKey()) {
+ $newObject = false;
+ $temp_obj2->addUser($obj1); break;
+ }
+ }
+
+ if ($newObject) {
+ $obj2->initUsers();
+ $obj2->addUser($obj1);
+ }
+
+ $results[] = $obj1;
+ }
+ return $results;
+ }
+
+
+
+ public static function doCountJoinAllExceptUserRelatedByParentUserId(Criteria $criteria, $distinct = false, $con = null)
+ {
+ $criteria = clone $criteria;
+
+ $criteria->clearSelectColumns()->clearOrderByColumns();
+ if ($distinct || in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) {
+ $criteria->addSelectColumn(UserPeer::COUNT_DISTINCT);
+ } else {
+ $criteria->addSelectColumn(UserPeer::COUNT);
+ }
+
+ foreach($criteria->getGroupByColumns() as $column)
+ {
+ $criteria->addSelectColumn($column);
+ }
+
+ $criteria->addJoin(UserPeer::ROLE_ID, RolePeer::ID);
+
+ $rs = UserPeer::doSelectRS($criteria, $con);
+ if ($rs->next()) {
+ return $rs->getInt(1);
+ } else {
+ return 0;
+ }
+ }
+
+
+
+ public static function doCountJoinAllExceptRole(Criteria $criteria, $distinct = false, $con = null)
+ {
+ $criteria = clone $criteria;
+
+ $criteria->clearSelectColumns()->clearOrderByColumns();
+ if ($distinct || in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) {
+ $criteria->addSelectColumn(UserPeer::COUNT_DISTINCT);
+ } else {
+ $criteria->addSelectColumn(UserPeer::COUNT);
+ }
+
+ foreach($criteria->getGroupByColumns() as $column)
+ {
+ $criteria->addSelectColumn($column);
+ }
+
+ $rs = UserPeer::doSelectRS($criteria, $con);
+ if ($rs->next()) {
+ return $rs->getInt(1);
+ } else {
+ return 0;
+ }
+ }
+
+
+
+ public static function doSelectJoinAllExceptUserRelatedByParentUserId(Criteria $c, $con = null)
+ {
+ $c = clone $c;
+
+ if ($c->getDbName() == Propel::getDefaultDB()) {
+ $c->setDbName(self::DATABASE_NAME);
+ }
+
+ UserPeer::addSelectColumns($c);
+ $startcol2 = (UserPeer::NUM_COLUMNS - UserPeer::NUM_LAZY_LOAD_COLUMNS) + 1;
+
+ RolePeer::addSelectColumns($c);
+ $startcol3 = $startcol2 + RolePeer::NUM_COLUMNS;
+
+ $c->addJoin(UserPeer::ROLE_ID, RolePeer::ID);
+
+
+ $rs = BasePeer::doSelect($c, $con);
+ $results = array();
+
+ while($rs->next()) {
+
+ $omClass = UserPeer::getOMClass();
+
+ $cls = Propel::import($omClass);
+ $obj1 = new $cls();
+ $obj1->hydrate($rs);
+
+ $omClass = RolePeer::getOMClass();
+
+
+ $cls = Propel::import($omClass);
+ $obj2 = new $cls();
+ $obj2->hydrate($rs, $startcol2);
+
+ $newObject = true;
+ for ($j=0, $resCount=count($results); $j < $resCount; $j++) {
+ $temp_obj1 = $results[$j];
+ $temp_obj2 = $temp_obj1->getRole(); if ($temp_obj2->getPrimaryKey() === $obj2->getPrimaryKey()) {
+ $newObject = false;
+ $temp_obj2->addUser($obj1);
+ break;
+ }
+ }
+
+ if ($newObject) {
+ $obj2->initUsers();
+ $obj2->addUser($obj1);
+ }
+
+ $results[] = $obj1;
+ }
+ return $results;
+ }
+
+
+
+ public static function doSelectJoinAllExceptRole(Criteria $c, $con = null)
+ {
+ $c = clone $c;
+
+ if ($c->getDbName() == Propel::getDefaultDB()) {
+ $c->setDbName(self::DATABASE_NAME);
+ }
+
+ UserPeer::addSelectColumns($c);
+ $startcol2 = (UserPeer::NUM_COLUMNS - UserPeer::NUM_LAZY_LOAD_COLUMNS) + 1;
+
+
+ $rs = BasePeer::doSelect($c, $con);
+ $results = array();
+
+ while($rs->next()) {
+
+ $omClass = UserPeer::getOMClass();
+
+ $cls = Propel::import($omClass);
+ $obj1 = new $cls();
+ $obj1->hydrate($rs);
+
+ $results[] = $obj1;
+ }
+ return $results;
+ }
+
+
+ public static function getTableMap()
+ {
+ return Propel::getDatabaseMap(self::DATABASE_NAME)->getTable(self::TABLE_NAME);
+ }
+
+
+ public static function getOMClass()
+ {
+ return UserPeer::CLASS_DEFAULT;
+ }
+
+
+ public static function doInsert($values, $con = null)
+ {
+ if ($con === null) {
+ $con = Propel::getConnection(self::DATABASE_NAME);
+ }
+
+ if ($values instanceof Criteria) {
+ $criteria = clone $values; } else {
+ $criteria = $values->buildCriteria(); }
+
+ $criteria->remove(UserPeer::ID);
+
+ $criteria->setDbName(self::DATABASE_NAME);
+
+ try {
+ $con->begin();
+ $pk = BasePeer::doInsert($criteria, $con);
+ $con->commit();
+ } catch(PropelException $e) {
+ $con->rollback();
+ throw $e;
+ }
+
+ return $pk;
+ }
+
+
+ public static function doUpdate($values, $con = null)
+ {
+ if ($con === null) {
+ $con = Propel::getConnection(self::DATABASE_NAME);
+ }
+
+ $selectCriteria = new Criteria(self::DATABASE_NAME);
+
+ if ($values instanceof Criteria) {
+ $criteria = clone $values;
+ $comparison = $criteria->getComparison(UserPeer::ID);
+ $selectCriteria->add(UserPeer::ID, $criteria->remove(UserPeer::ID), $comparison);
+
+ } else { $criteria = $values->buildCriteria(); $selectCriteria = $values->buildPkeyCriteria(); }
+
+ $criteria->setDbName(self::DATABASE_NAME);
+
+ return BasePeer::doUpdate($selectCriteria, $criteria, $con);
+ }
+
+
+ public static function doDeleteAll($con = null)
+ {
+ if ($con === null) {
+ $con = Propel::getConnection(self::DATABASE_NAME);
+ }
+ $affectedRows = 0; try {
+ $con->begin();
+ $affectedRows += UserPeer::doOnDeleteCascade(new Criteria(), $con);
+ UserPeer::doOnDeleteSetNull(new Criteria(), $con);
+ $affectedRows += BasePeer::doDeleteAll(UserPeer::TABLE_NAME, $con);
+ $con->commit();
+ return $affectedRows;
+ } catch (PropelException $e) {
+ $con->rollback();
+ throw $e;
+ }
+ }
+
+
+ public static function doDelete($values, $con = null)
+ {
+ if ($con === null) {
+ $con = Propel::getConnection(UserPeer::DATABASE_NAME);
+ }
+
+ if ($values instanceof Criteria) {
+ $criteria = clone $values; } elseif ($values instanceof User) {
+
+ $criteria = $values->buildPkeyCriteria();
+ } else {
+ $criteria = new Criteria(self::DATABASE_NAME);
+ $criteria->add(UserPeer::ID, (array) $values, Criteria::IN);
+ }
+
+ $criteria->setDbName(self::DATABASE_NAME);
+
+ $affectedRows = 0;
+ try {
+ $con->begin();
+ $affectedRows += UserPeer::doOnDeleteCascade($criteria, $con);UserPeer::doOnDeleteSetNull($criteria, $con);
+ $affectedRows += BasePeer::doDelete($criteria, $con);
+ $con->commit();
+ return $affectedRows;
+ } catch (PropelException $e) {
+ $con->rollback();
+ throw $e;
+ }
+ }
+
+
+ protected static function doOnDeleteCascade(Criteria $criteria, Connection $con)
+ {
+ $affectedRows = 0;
+
+ $objects = UserPeer::doSelect($criteria, $con);
+ foreach($objects as $obj) {
+
+
+ include_once 'lib/model/DomainPermission.php';
+
+ $c = new Criteria();
+
+ $c->add(DomainPermissionPeer::USER_ID, $obj->getId());
+ $affectedRows += DomainPermissionPeer::doDelete($c, $con);
+ }
+ return $affectedRows;
+ }
+
+
+ protected static function doOnDeleteSetNull(Criteria $criteria, Connection $con)
+ {
+
+ $objects = UserPeer::doSelect($criteria, $con);
+ foreach($objects as $obj) {
+
+ $selectCriteria = new Criteria(UserPeer::DATABASE_NAME);
+ $updateValues = new Criteria(UserPeer::DATABASE_NAME);
+ $selectCriteria->add(DomainPeer::CREATOR_ID, $obj->getId());
+ $updateValues->add(DomainPeer::CREATOR_ID, null);
+
+ BasePeer::doUpdate($selectCriteria, $updateValues, $con);
+ $selectCriteria = new Criteria(UserPeer::DATABASE_NAME);
+ $updateValues = new Criteria(UserPeer::DATABASE_NAME);
+ $selectCriteria->add(LogEntryPeer::USER_ID, $obj->getId());
+ $updateValues->add(LogEntryPeer::USER_ID, null);
+
+ BasePeer::doUpdate($selectCriteria, $updateValues, $con);
+ }
+ }
+
+
+ public static function doValidate(User $obj, $cols = null)
+ {
+ $columns = array();
+
+ if ($cols) {
+ $dbMap = Propel::getDatabaseMap(UserPeer::DATABASE_NAME);
+ $tableMap = $dbMap->getTable(UserPeer::TABLE_NAME);
+
+ if (! is_array($cols)) {
+ $cols = array($cols);
+ }
+
+ foreach($cols as $colName) {
+ if ($tableMap->containsColumn($colName)) {
+ $get = 'get' . $tableMap->getColumn($colName)->getPhpName();
+ $columns[$colName] = $obj->$get();
+ }
+ }
+ } else {
+
+ }
+
+ $res = BasePeer::doValidate(UserPeer::DATABASE_NAME, UserPeer::TABLE_NAME, $columns);
+ if ($res !== true) {
+ $request = sfContext::getInstance()->getRequest();
+ foreach ($res as $failed) {
+ $col = UserPeer::translateFieldname($failed->getColumn(), BasePeer::TYPE_COLNAME, BasePeer::TYPE_PHPNAME);
+ $request->setError($col, $failed->getMessage());
+ }
+ }
+
+ return $res;
+ }
+
+
+ public static function retrieveByPK($pk, $con = null)
+ {
+ if ($con === null) {
+ $con = Propel::getConnection(self::DATABASE_NAME);
+ }
+
+ $criteria = new Criteria(UserPeer::DATABASE_NAME);
+
+ $criteria->add(UserPeer::ID, $pk);
+
+
+ $v = UserPeer::doSelect($criteria, $con);
+
+ return !empty($v) > 0 ? $v[0] : null;
+ }
+
+
+ public static function retrieveByPKs($pks, $con = null)
+ {
+ if ($con === null) {
+ $con = Propel::getConnection(self::DATABASE_NAME);
+ }
+
+ $objs = null;
+ if (empty($pks)) {
+ $objs = array();
+ } else {
+ $criteria = new Criteria();
+ $criteria->add(UserPeer::ID, $pks, Criteria::IN);
+ $objs = UserPeer::doSelect($criteria, $con);
+ }
+ return $objs;
+ }
+
+}
+if (Propel::isInit()) {
+ try {
+ BaseUserPeer::getMapBuilder();
+ } catch (Exception $e) {
+ Propel::log('Could not initialize Peer: ' . $e->getMessage(), Propel::LOG_ERR);
+ }
+} else {
+ require_once 'lib/model/map/UserMapBuilder.php';
+ Propel::registerMapBuilder('lib.model.map.UserMapBuilder');
+}