Overview

Namespaces

  • PHP
  • Thelia
    • Action
    • Controller
    • Core
      • Bundle
      • Event
      • EventListener
      • Template
    • Exception
    • Log
      • Destination
    • Model
      • map
      • om
    • Routing
      • Matcher
    • Tools

Classes

  • BaseAccessory
  • BaseAccessoryPeer
  • BaseAccessoryQuery
  • BaseAddress
  • BaseAddressPeer
  • BaseAddressQuery
  • BaseAdmin
  • BaseAdminGroup
  • BaseAdminGroupPeer
  • BaseAdminGroupQuery
  • BaseAdminLog
  • BaseAdminLogPeer
  • BaseAdminLogQuery
  • BaseAdminPeer
  • BaseAdminQuery
  • BaseArea
  • BaseAreaPeer
  • BaseAreaQuery
  • BaseAttribute
  • BaseAttributeAv
  • BaseAttributeAvDesc
  • BaseAttributeAvDescPeer
  • BaseAttributeAvDescQuery
  • BaseAttributeAvI18n
  • BaseAttributeAvI18nPeer
  • BaseAttributeAvI18nQuery
  • BaseAttributeAvPeer
  • BaseAttributeAvQuery
  • BaseAttributeCategory
  • BaseAttributeCategoryPeer
  • BaseAttributeCategoryQuery
  • BaseAttributeCombination
  • BaseAttributeCombinationPeer
  • BaseAttributeCombinationQuery
  • BaseAttributeDesc
  • BaseAttributeDescPeer
  • BaseAttributeDescQuery
  • BaseAttributeI18n
  • BaseAttributeI18nPeer
  • BaseAttributeI18nQuery
  • BaseAttributePeer
  • BaseAttributeQuery
  • BaseCategory
  • BaseCategoryDesc
  • BaseCategoryDescPeer
  • BaseCategoryDescQuery
  • BaseCategoryI18n
  • BaseCategoryI18nPeer
  • BaseCategoryI18nQuery
  • BaseCategoryPeer
  • BaseCategoryQuery
  • BaseCategoryVersion
  • BaseCategoryVersionPeer
  • BaseCategoryVersionQuery
  • BaseCombination
  • BaseCombinationPeer
  • BaseCombinationQuery
  • BaseConfig
  • BaseConfigDesc
  • BaseConfigDescPeer
  • BaseConfigDescQuery
  • BaseConfigI18n
  • BaseConfigI18nPeer
  • BaseConfigI18nQuery
  • BaseConfigPeer
  • BaseConfigQuery
  • BaseContent
  • BaseContentAssoc
  • BaseContentAssocPeer
  • BaseContentAssocQuery
  • BaseContentDesc
  • BaseContentDescPeer
  • BaseContentDescQuery
  • BaseContentFolder
  • BaseContentFolderPeer
  • BaseContentFolderQuery
  • BaseContentI18n
  • BaseContentI18nPeer
  • BaseContentI18nQuery
  • BaseContentPeer
  • BaseContentQuery
  • BaseContentVersion
  • BaseContentVersionPeer
  • BaseContentVersionQuery
  • BaseCountry
  • BaseCountryDesc
  • BaseCountryDescPeer
  • BaseCountryDescQuery
  • BaseCountryI18n
  • BaseCountryI18nPeer
  • BaseCountryI18nQuery
  • BaseCountryPeer
  • BaseCountryQuery
  • BaseCoupon
  • BaseCouponOrder
  • BaseCouponOrderPeer
  • BaseCouponOrderQuery
  • BaseCouponPeer
  • BaseCouponQuery
  • BaseCouponRule
  • BaseCouponRulePeer
  • BaseCouponRuleQuery
  • BaseCurrency
  • BaseCurrencyPeer
  • BaseCurrencyQuery
  • BaseCustomer
  • BaseCustomerPeer
  • BaseCustomerQuery
  • BaseCustomerTitle
  • BaseCustomerTitleDesc
  • BaseCustomerTitleDescPeer
  • BaseCustomerTitleDescQuery
  • BaseCustomerTitleI18n
  • BaseCustomerTitleI18nPeer
  • BaseCustomerTitleI18nQuery
  • BaseCustomerTitlePeer
  • BaseCustomerTitleQuery
  • BaseDelivzone
  • BaseDelivzonePeer
  • BaseDelivzoneQuery
  • BaseDocument
  • BaseDocumentDesc
  • BaseDocumentDescPeer
  • BaseDocumentDescQuery
  • BaseDocumentI18n
  • BaseDocumentI18nPeer
  • BaseDocumentI18nQuery
  • BaseDocumentPeer
  • BaseDocumentQuery
  • BaseFeature
  • BaseFeatureAv
  • BaseFeatureAvDesc
  • BaseFeatureAvDescPeer
  • BaseFeatureAvDescQuery
  • BaseFeatureAvI18n
  • BaseFeatureAvI18nPeer
  • BaseFeatureAvI18nQuery
  • BaseFeatureAvPeer
  • BaseFeatureAvQuery
  • BaseFeatureCategory
  • BaseFeatureCategoryPeer
  • BaseFeatureCategoryQuery
  • BaseFeatureDesc
  • BaseFeatureDescPeer
  • BaseFeatureDescQuery
  • BaseFeatureI18n
  • BaseFeatureI18nPeer
  • BaseFeatureI18nQuery
  • BaseFeaturePeer
  • BaseFeatureProd
  • BaseFeatureProdPeer
  • BaseFeatureProdQuery
  • BaseFeatureQuery
  • BaseFolder
  • BaseFolderDesc
  • BaseFolderDescPeer
  • BaseFolderDescQuery
  • BaseFolderI18n
  • BaseFolderI18nPeer
  • BaseFolderI18nQuery
  • BaseFolderPeer
  • BaseFolderQuery
  • BaseFolderVersion
  • BaseFolderVersionPeer
  • BaseFolderVersionQuery
  • BaseGroup
  • BaseGroupDesc
  • BaseGroupDescPeer
  • BaseGroupDescQuery
  • BaseGroupI18n
  • BaseGroupI18nPeer
  • BaseGroupI18nQuery
  • BaseGroupModule
  • BaseGroupModulePeer
  • BaseGroupModuleQuery
  • BaseGroupPeer
  • BaseGroupQuery
  • BaseGroupResource
  • BaseGroupResourcePeer
  • BaseGroupResourceQuery
  • BaseImage
  • BaseImageDesc
  • BaseImageDescPeer
  • BaseImageDescQuery
  • BaseImageI18n
  • BaseImageI18nPeer
  • BaseImageI18nQuery
  • BaseImagePeer
  • BaseImageQuery
  • BaseLang
  • BaseLangPeer
  • BaseLangQuery
  • BaseMessage
  • BaseMessageDesc
  • BaseMessageDescPeer
  • BaseMessageDescQuery
  • BaseMessageI18n
  • BaseMessageI18nPeer
  • BaseMessageI18nQuery
  • BaseMessagePeer
  • BaseMessageQuery
  • BaseMessageVersion
  • BaseMessageVersionPeer
  • BaseMessageVersionQuery
  • BaseModuleDesc
  • BaseModuleDescPeer
  • BaseModuleDescQuery
  • BaseModuleI18n
  • BaseModuleI18nPeer
  • BaseModuleI18nQuery
  • BaseModulePeer
  • BaseOrder
  • BaseOrderAddress
  • BaseOrderAddressPeer
  • BaseOrderAddressQuery
  • BaseOrderFeature
  • BaseOrderFeaturePeer
  • BaseOrderFeatureQuery
  • BaseOrderPeer
  • BaseOrderProduct
  • BaseOrderProductPeer
  • BaseOrderProductQuery
  • BaseOrderQuery
  • BaseOrderStatus
  • BaseOrderStatusDesc
  • BaseOrderStatusDescPeer
  • BaseOrderStatusDescQuery
  • BaseOrderStatusI18n
  • BaseOrderStatusI18nPeer
  • BaseOrderStatusI18nQuery
  • BaseOrderStatusPeer
  • BaseOrderStatusQuery
  • BaseProduct
  • BaseProductCategory
  • BaseProductCategoryPeer
  • BaseProductCategoryQuery
  • BaseProductDesc
  • BaseProductDescPeer
  • BaseProductDescQuery
  • BaseProductI18n
  • BaseProductI18nPeer
  • BaseProductI18nQuery
  • BaseProductPeer
  • BaseProductQuery
  • BaseProductVersion
  • BaseProductVersionPeer
  • BaseProductVersionQuery
  • BaseResource
  • BaseResourceDesc
  • BaseResourceDescPeer
  • BaseResourceDescQuery
  • BaseResourceI18n
  • BaseResourceI18nPeer
  • BaseResourceI18nQuery
  • BaseResourcePeer
  • BaseResourceQuery
  • BaseRewriting
  • BaseRewritingPeer
  • BaseRewritingQuery
  • BaseStock
  • BaseStockPeer
  • BaseStockQuery
  • BaseTax
  • BaseTaxDesc
  • BaseTaxDescPeer
  • BaseTaxDescQuery
  • BaseTaxI18n
  • BaseTaxI18nPeer
  • BaseTaxI18nQuery
  • BaseTaxPeer
  • BaseTaxQuery
  • BaseTaxRule
  • BaseTaxRuleCountry
  • BaseTaxRuleCountryPeer
  • BaseTaxRuleCountryQuery
  • BaseTaxRuleDesc
  • BaseTaxRuleDescPeer
  • BaseTaxRuleDescQuery
  • BaseTaxRuleI18n
  • BaseTaxRuleI18nPeer
  • BaseTaxRuleI18nQuery
  • BaseTaxRulePeer
  • BaseTaxRuleQuery
  • Overview
  • Namespace
  • Class
  • Tree
   1: <?php
   2: 
   3: namespace Thelia\Model\om;
   4: 
   5: use \BaseObject;
   6: use \BasePeer;
   7: use \Criteria;
   8: use \DateTime;
   9: use \Exception;
  10: use \PDO;
  11: use \Persistent;
  12: use \Propel;
  13: use \PropelDateTime;
  14: use \PropelException;
  15: use \PropelPDO;
  16: use Thelia\Model\Admin;
  17: use Thelia\Model\AdminGroup;
  18: use Thelia\Model\AdminGroupPeer;
  19: use Thelia\Model\AdminGroupQuery;
  20: use Thelia\Model\AdminQuery;
  21: use Thelia\Model\Group;
  22: use Thelia\Model\GroupQuery;
  23: 
  24: /**
  25:  * Base class that represents a row from the 'admin_group' table.
  26:  *
  27:  *
  28:  *
  29:  * @package    propel.generator.Thelia.Model.om
  30:  */
  31: abstract class BaseAdminGroup extends BaseObject implements Persistent
  32: {
  33:     /**
  34:      * Peer class name
  35:      */
  36:     const PEER = 'Thelia\\Model\\AdminGroupPeer';
  37: 
  38:     /**
  39:      * The Peer class.
  40:      * Instance provides a convenient way of calling static methods on a class
  41:      * that calling code may not be able to identify.
  42:      * @var        AdminGroupPeer
  43:      */
  44:     protected static $peer;
  45: 
  46:     /**
  47:      * The flag var to prevent infinit loop in deep copy
  48:      * @var       boolean
  49:      */
  50:     protected $startCopy = false;
  51: 
  52:     /**
  53:      * The value for the id field.
  54:      * @var        int
  55:      */
  56:     protected $id;
  57: 
  58:     /**
  59:      * The value for the group_id field.
  60:      * @var        int
  61:      */
  62:     protected $group_id;
  63: 
  64:     /**
  65:      * The value for the admin_id field.
  66:      * @var        int
  67:      */
  68:     protected $admin_id;
  69: 
  70:     /**
  71:      * The value for the created_at field.
  72:      * @var        string
  73:      */
  74:     protected $created_at;
  75: 
  76:     /**
  77:      * The value for the updated_at field.
  78:      * @var        string
  79:      */
  80:     protected $updated_at;
  81: 
  82:     /**
  83:      * @var        Group
  84:      */
  85:     protected $aGroup;
  86: 
  87:     /**
  88:      * @var        Admin
  89:      */
  90:     protected $aAdmin;
  91: 
  92:     /**
  93:      * Flag to prevent endless save loop, if this object is referenced
  94:      * by another object which falls in this transaction.
  95:      * @var        boolean
  96:      */
  97:     protected $alreadyInSave = false;
  98: 
  99:     /**
 100:      * Flag to prevent endless validation loop, if this object is referenced
 101:      * by another object which falls in this transaction.
 102:      * @var        boolean
 103:      */
 104:     protected $alreadyInValidation = false;
 105: 
 106:     /**
 107:      * Get the [id] column value.
 108:      *
 109:      * @return int
 110:      */
 111:     public function getId()
 112:     {
 113:         return $this->id;
 114:     }
 115: 
 116:     /**
 117:      * Get the [group_id] column value.
 118:      *
 119:      * @return int
 120:      */
 121:     public function getGroupId()
 122:     {
 123:         return $this->group_id;
 124:     }
 125: 
 126:     /**
 127:      * Get the [admin_id] column value.
 128:      *
 129:      * @return int
 130:      */
 131:     public function getAdminId()
 132:     {
 133:         return $this->admin_id;
 134:     }
 135: 
 136:     /**
 137:      * Get the [optionally formatted] temporal [created_at] column value.
 138:      *
 139:      *
 140:      * @param string $format The date/time format string (either date()-style or strftime()-style).
 141:      *               If format is null, then the raw DateTime object will be returned.
 142:      * @return mixed Formatted date/time value as string or DateTime object (if format is null), null if column is null, and 0 if column value is 0000-00-00 00:00:00
 143:      * @throws PropelException - if unable to parse/validate the date/time value.
 144:      */
 145:     public function getCreatedAt($format = 'Y-m-d H:i:s')
 146:     {
 147:         if ($this->created_at === null) {
 148:             return null;
 149:         }
 150: 
 151:         if ($this->created_at === '0000-00-00 00:00:00') {
 152:             // while technically this is not a default value of null,
 153:             // this seems to be closest in meaning.
 154:             return null;
 155:         } else {
 156:             try {
 157:                 $dt = new DateTime($this->created_at);
 158:             } catch (Exception $x) {
 159:                 throw new PropelException("Internally stored date/time/timestamp value could not be converted to DateTime: " . var_export($this->created_at, true), $x);
 160:             }
 161:         }
 162: 
 163:         if ($format === null) {
 164:             // Because propel.useDateTimeClass is true, we return a DateTime object.
 165:             return $dt;
 166:         } elseif (strpos($format, '%') !== false) {
 167:             return strftime($format, $dt->format('U'));
 168:         } else {
 169:             return $dt->format($format);
 170:         }
 171:     }
 172: 
 173:     /**
 174:      * Get the [optionally formatted] temporal [updated_at] column value.
 175:      *
 176:      *
 177:      * @param string $format The date/time format string (either date()-style or strftime()-style).
 178:      *               If format is null, then the raw DateTime object will be returned.
 179:      * @return mixed Formatted date/time value as string or DateTime object (if format is null), null if column is null, and 0 if column value is 0000-00-00 00:00:00
 180:      * @throws PropelException - if unable to parse/validate the date/time value.
 181:      */
 182:     public function getUpdatedAt($format = 'Y-m-d H:i:s')
 183:     {
 184:         if ($this->updated_at === null) {
 185:             return null;
 186:         }
 187: 
 188:         if ($this->updated_at === '0000-00-00 00:00:00') {
 189:             // while technically this is not a default value of null,
 190:             // this seems to be closest in meaning.
 191:             return null;
 192:         } else {
 193:             try {
 194:                 $dt = new DateTime($this->updated_at);
 195:             } catch (Exception $x) {
 196:                 throw new PropelException("Internally stored date/time/timestamp value could not be converted to DateTime: " . var_export($this->updated_at, true), $x);
 197:             }
 198:         }
 199: 
 200:         if ($format === null) {
 201:             // Because propel.useDateTimeClass is true, we return a DateTime object.
 202:             return $dt;
 203:         } elseif (strpos($format, '%') !== false) {
 204:             return strftime($format, $dt->format('U'));
 205:         } else {
 206:             return $dt->format($format);
 207:         }
 208:     }
 209: 
 210:     /**
 211:      * Set the value of [id] column.
 212:      *
 213:      * @param int $v new value
 214:      * @return AdminGroup The current object (for fluent API support)
 215:      */
 216:     public function setId($v)
 217:     {
 218:         if ($v !== null) {
 219:             $v = (int) $v;
 220:         }
 221: 
 222:         if ($this->id !== $v) {
 223:             $this->id = $v;
 224:             $this->modifiedColumns[] = AdminGroupPeer::ID;
 225:         }
 226: 
 227: 
 228:         return $this;
 229:     } // setId()
 230: 
 231:     /**
 232:      * Set the value of [group_id] column.
 233:      *
 234:      * @param int $v new value
 235:      * @return AdminGroup The current object (for fluent API support)
 236:      */
 237:     public function setGroupId($v)
 238:     {
 239:         if ($v !== null) {
 240:             $v = (int) $v;
 241:         }
 242: 
 243:         if ($this->group_id !== $v) {
 244:             $this->group_id = $v;
 245:             $this->modifiedColumns[] = AdminGroupPeer::GROUP_ID;
 246:         }
 247: 
 248:         if ($this->aGroup !== null && $this->aGroup->getId() !== $v) {
 249:             $this->aGroup = null;
 250:         }
 251: 
 252: 
 253:         return $this;
 254:     } // setGroupId()
 255: 
 256:     /**
 257:      * Set the value of [admin_id] column.
 258:      *
 259:      * @param int $v new value
 260:      * @return AdminGroup The current object (for fluent API support)
 261:      */
 262:     public function setAdminId($v)
 263:     {
 264:         if ($v !== null) {
 265:             $v = (int) $v;
 266:         }
 267: 
 268:         if ($this->admin_id !== $v) {
 269:             $this->admin_id = $v;
 270:             $this->modifiedColumns[] = AdminGroupPeer::ADMIN_ID;
 271:         }
 272: 
 273:         if ($this->aAdmin !== null && $this->aAdmin->getId() !== $v) {
 274:             $this->aAdmin = null;
 275:         }
 276: 
 277: 
 278:         return $this;
 279:     } // setAdminId()
 280: 
 281:     /**
 282:      * Sets the value of [created_at] column to a normalized version of the date/time value specified.
 283:      *
 284:      * @param mixed $v string, integer (timestamp), or DateTime value.
 285:      *               Empty strings are treated as null.
 286:      * @return AdminGroup The current object (for fluent API support)
 287:      */
 288:     public function setCreatedAt($v)
 289:     {
 290:         $dt = PropelDateTime::newInstance($v, null, 'DateTime');
 291:         if ($this->created_at !== null || $dt !== null) {
 292:             $currentDateAsString = ($this->created_at !== null && $tmpDt = new DateTime($this->created_at)) ? $tmpDt->format('Y-m-d H:i:s') : null;
 293:             $newDateAsString = $dt ? $dt->format('Y-m-d H:i:s') : null;
 294:             if ($currentDateAsString !== $newDateAsString) {
 295:                 $this->created_at = $newDateAsString;
 296:                 $this->modifiedColumns[] = AdminGroupPeer::CREATED_AT;
 297:             }
 298:         } // if either are not null
 299: 
 300: 
 301:         return $this;
 302:     } // setCreatedAt()
 303: 
 304:     /**
 305:      * Sets the value of [updated_at] column to a normalized version of the date/time value specified.
 306:      *
 307:      * @param mixed $v string, integer (timestamp), or DateTime value.
 308:      *               Empty strings are treated as null.
 309:      * @return AdminGroup The current object (for fluent API support)
 310:      */
 311:     public function setUpdatedAt($v)
 312:     {
 313:         $dt = PropelDateTime::newInstance($v, null, 'DateTime');
 314:         if ($this->updated_at !== null || $dt !== null) {
 315:             $currentDateAsString = ($this->updated_at !== null && $tmpDt = new DateTime($this->updated_at)) ? $tmpDt->format('Y-m-d H:i:s') : null;
 316:             $newDateAsString = $dt ? $dt->format('Y-m-d H:i:s') : null;
 317:             if ($currentDateAsString !== $newDateAsString) {
 318:                 $this->updated_at = $newDateAsString;
 319:                 $this->modifiedColumns[] = AdminGroupPeer::UPDATED_AT;
 320:             }
 321:         } // if either are not null
 322: 
 323: 
 324:         return $this;
 325:     } // setUpdatedAt()
 326: 
 327:     /**
 328:      * Indicates whether the columns in this object are only set to default values.
 329:      *
 330:      * This method can be used in conjunction with isModified() to indicate whether an object is both
 331:      * modified _and_ has some values set which are non-default.
 332:      *
 333:      * @return boolean Whether the columns in this object are only been set with default values.
 334:      */
 335:     public function hasOnlyDefaultValues()
 336:     {
 337:         // otherwise, everything was equal, so return true
 338:         return true;
 339:     } // hasOnlyDefaultValues()
 340: 
 341:     /**
 342:      * Hydrates (populates) the object variables with values from the database resultset.
 343:      *
 344:      * An offset (0-based "start column") is specified so that objects can be hydrated
 345:      * with a subset of the columns in the resultset rows.  This is needed, for example,
 346:      * for results of JOIN queries where the resultset row includes columns from two or
 347:      * more tables.
 348:      *
 349:      * @param array $row The row returned by PDOStatement->fetch(PDO::FETCH_NUM)
 350:      * @param int $startcol 0-based offset column which indicates which restultset column to start with.
 351:      * @param boolean $rehydrate Whether this object is being re-hydrated from the database.
 352:      * @return int             next starting column
 353:      * @throws PropelException - Any caught Exception will be rewrapped as a PropelException.
 354:      */
 355:     public function hydrate($row, $startcol = 0, $rehydrate = false)
 356:     {
 357:         try {
 358: 
 359:             $this->id = ($row[$startcol + 0] !== null) ? (int) $row[$startcol + 0] : null;
 360:             $this->group_id = ($row[$startcol + 1] !== null) ? (int) $row[$startcol + 1] : null;
 361:             $this->admin_id = ($row[$startcol + 2] !== null) ? (int) $row[$startcol + 2] : null;
 362:             $this->created_at = ($row[$startcol + 3] !== null) ? (string) $row[$startcol + 3] : null;
 363:             $this->updated_at = ($row[$startcol + 4] !== null) ? (string) $row[$startcol + 4] : null;
 364:             $this->resetModified();
 365: 
 366:             $this->setNew(false);
 367: 
 368:             if ($rehydrate) {
 369:                 $this->ensureConsistency();
 370:             }
 371: 
 372:             return $startcol + 5; // 5 = AdminGroupPeer::NUM_HYDRATE_COLUMNS.
 373: 
 374:         } catch (Exception $e) {
 375:             throw new PropelException("Error populating AdminGroup object", $e);
 376:         }
 377:     }
 378: 
 379:     /**
 380:      * Checks and repairs the internal consistency of the object.
 381:      *
 382:      * This method is executed after an already-instantiated object is re-hydrated
 383:      * from the database.  It exists to check any foreign keys to make sure that
 384:      * the objects related to the current object are correct based on foreign key.
 385:      *
 386:      * You can override this method in the stub class, but you should always invoke
 387:      * the base method from the overridden method (i.e. parent::ensureConsistency()),
 388:      * in case your model changes.
 389:      *
 390:      * @throws PropelException
 391:      */
 392:     public function ensureConsistency()
 393:     {
 394: 
 395:         if ($this->aGroup !== null && $this->group_id !== $this->aGroup->getId()) {
 396:             $this->aGroup = null;
 397:         }
 398:         if ($this->aAdmin !== null && $this->admin_id !== $this->aAdmin->getId()) {
 399:             $this->aAdmin = null;
 400:         }
 401:     } // ensureConsistency
 402: 
 403:     /**
 404:      * Reloads this object from datastore based on primary key and (optionally) resets all associated objects.
 405:      *
 406:      * This will only work if the object has been saved and has a valid primary key set.
 407:      *
 408:      * @param boolean $deep (optional) Whether to also de-associated any related objects.
 409:      * @param PropelPDO $con (optional) The PropelPDO connection to use.
 410:      * @return void
 411:      * @throws PropelException - if this object is deleted, unsaved or doesn't have pk match in db
 412:      */
 413:     public function reload($deep = false, PropelPDO $con = null)
 414:     {
 415:         if ($this->isDeleted()) {
 416:             throw new PropelException("Cannot reload a deleted object.");
 417:         }
 418: 
 419:         if ($this->isNew()) {
 420:             throw new PropelException("Cannot reload an unsaved object.");
 421:         }
 422: 
 423:         if ($con === null) {
 424:             $con = Propel::getConnection(AdminGroupPeer::DATABASE_NAME, Propel::CONNECTION_READ);
 425:         }
 426: 
 427:         // We don't need to alter the object instance pool; we're just modifying this instance
 428:         // already in the pool.
 429: 
 430:         $stmt = AdminGroupPeer::doSelectStmt($this->buildPkeyCriteria(), $con);
 431:         $row = $stmt->fetch(PDO::FETCH_NUM);
 432:         $stmt->closeCursor();
 433:         if (!$row) {
 434:             throw new PropelException('Cannot find matching row in the database to reload object values.');
 435:         }
 436:         $this->hydrate($row, 0, true); // rehydrate
 437: 
 438:         if ($deep) {  // also de-associate any related objects?
 439: 
 440:             $this->aGroup = null;
 441:             $this->aAdmin = null;
 442:         } // if (deep)
 443:     }
 444: 
 445:     /**
 446:      * Removes this object from datastore and sets delete attribute.
 447:      *
 448:      * @param PropelPDO $con
 449:      * @return void
 450:      * @throws PropelException
 451:      * @throws Exception
 452:      * @see        BaseObject::setDeleted()
 453:      * @see        BaseObject::isDeleted()
 454:      */
 455:     public function delete(PropelPDO $con = null)
 456:     {
 457:         if ($this->isDeleted()) {
 458:             throw new PropelException("This object has already been deleted.");
 459:         }
 460: 
 461:         if ($con === null) {
 462:             $con = Propel::getConnection(AdminGroupPeer::DATABASE_NAME, Propel::CONNECTION_WRITE);
 463:         }
 464: 
 465:         $con->beginTransaction();
 466:         try {
 467:             $deleteQuery = AdminGroupQuery::create()
 468:                 ->filterByPrimaryKey($this->getPrimaryKey());
 469:             $ret = $this->preDelete($con);
 470:             if ($ret) {
 471:                 $deleteQuery->delete($con);
 472:                 $this->postDelete($con);
 473:                 $con->commit();
 474:                 $this->setDeleted(true);
 475:             } else {
 476:                 $con->commit();
 477:             }
 478:         } catch (Exception $e) {
 479:             $con->rollBack();
 480:             throw $e;
 481:         }
 482:     }
 483: 
 484:     /**
 485:      * Persists this object to the database.
 486:      *
 487:      * If the object is new, it inserts it; otherwise an update is performed.
 488:      * All modified related objects will also be persisted in the doSave()
 489:      * method.  This method wraps all precipitate database operations in a
 490:      * single transaction.
 491:      *
 492:      * @param PropelPDO $con
 493:      * @return int             The number of rows affected by this insert/update and any referring fk objects' save() operations.
 494:      * @throws PropelException
 495:      * @throws Exception
 496:      * @see        doSave()
 497:      */
 498:     public function save(PropelPDO $con = null)
 499:     {
 500:         if ($this->isDeleted()) {
 501:             throw new PropelException("You cannot save an object that has been deleted.");
 502:         }
 503: 
 504:         if ($con === null) {
 505:             $con = Propel::getConnection(AdminGroupPeer::DATABASE_NAME, Propel::CONNECTION_WRITE);
 506:         }
 507: 
 508:         $con->beginTransaction();
 509:         $isInsert = $this->isNew();
 510:         try {
 511:             $ret = $this->preSave($con);
 512:             if ($isInsert) {
 513:                 $ret = $ret && $this->preInsert($con);
 514:                 // timestampable behavior
 515:                 if (!$this->isColumnModified(AdminGroupPeer::CREATED_AT)) {
 516:                     $this->setCreatedAt(time());
 517:                 }
 518:                 if (!$this->isColumnModified(AdminGroupPeer::UPDATED_AT)) {
 519:                     $this->setUpdatedAt(time());
 520:                 }
 521:             } else {
 522:                 $ret = $ret && $this->preUpdate($con);
 523:                 // timestampable behavior
 524:                 if ($this->isModified() && !$this->isColumnModified(AdminGroupPeer::UPDATED_AT)) {
 525:                     $this->setUpdatedAt(time());
 526:                 }
 527:             }
 528:             if ($ret) {
 529:                 $affectedRows = $this->doSave($con);
 530:                 if ($isInsert) {
 531:                     $this->postInsert($con);
 532:                 } else {
 533:                     $this->postUpdate($con);
 534:                 }
 535:                 $this->postSave($con);
 536:                 AdminGroupPeer::addInstanceToPool($this);
 537:             } else {
 538:                 $affectedRows = 0;
 539:             }
 540:             $con->commit();
 541: 
 542:             return $affectedRows;
 543:         } catch (Exception $e) {
 544:             $con->rollBack();
 545:             throw $e;
 546:         }
 547:     }
 548: 
 549:     /**
 550:      * Performs the work of inserting or updating the row in the database.
 551:      *
 552:      * If the object is new, it inserts it; otherwise an update is performed.
 553:      * All related objects are also updated in this method.
 554:      *
 555:      * @param PropelPDO $con
 556:      * @return int             The number of rows affected by this insert/update and any referring fk objects' save() operations.
 557:      * @throws PropelException
 558:      * @see        save()
 559:      */
 560:     protected function doSave(PropelPDO $con)
 561:     {
 562:         $affectedRows = 0; // initialize var to track total num of affected rows
 563:         if (!$this->alreadyInSave) {
 564:             $this->alreadyInSave = true;
 565: 
 566:             // We call the save method on the following object(s) if they
 567:             // were passed to this object by their coresponding set
 568:             // method.  This object relates to these object(s) by a
 569:             // foreign key reference.
 570: 
 571:             if ($this->aGroup !== null) {
 572:                 if ($this->aGroup->isModified() || $this->aGroup->isNew()) {
 573:                     $affectedRows += $this->aGroup->save($con);
 574:                 }
 575:                 $this->setGroup($this->aGroup);
 576:             }
 577: 
 578:             if ($this->aAdmin !== null) {
 579:                 if ($this->aAdmin->isModified() || $this->aAdmin->isNew()) {
 580:                     $affectedRows += $this->aAdmin->save($con);
 581:                 }
 582:                 $this->setAdmin($this->aAdmin);
 583:             }
 584: 
 585:             if ($this->isNew() || $this->isModified()) {
 586:                 // persist changes
 587:                 if ($this->isNew()) {
 588:                     $this->doInsert($con);
 589:                 } else {
 590:                     $this->doUpdate($con);
 591:                 }
 592:                 $affectedRows += 1;
 593:                 $this->resetModified();
 594:             }
 595: 
 596:             $this->alreadyInSave = false;
 597: 
 598:         }
 599: 
 600:         return $affectedRows;
 601:     } // doSave()
 602: 
 603:     /**
 604:      * Insert the row in the database.
 605:      *
 606:      * @param PropelPDO $con
 607:      *
 608:      * @throws PropelException
 609:      * @see        doSave()
 610:      */
 611:     protected function doInsert(PropelPDO $con)
 612:     {
 613:         $modifiedColumns = array();
 614:         $index = 0;
 615: 
 616:         $this->modifiedColumns[] = AdminGroupPeer::ID;
 617:         if (null !== $this->id) {
 618:             throw new PropelException('Cannot insert a value for auto-increment primary key (' . AdminGroupPeer::ID . ')');
 619:         }
 620: 
 621:          // check the columns in natural order for more readable SQL queries
 622:         if ($this->isColumnModified(AdminGroupPeer::ID)) {
 623:             $modifiedColumns[':p' . $index++]  = '`ID`';
 624:         }
 625:         if ($this->isColumnModified(AdminGroupPeer::GROUP_ID)) {
 626:             $modifiedColumns[':p' . $index++]  = '`GROUP_ID`';
 627:         }
 628:         if ($this->isColumnModified(AdminGroupPeer::ADMIN_ID)) {
 629:             $modifiedColumns[':p' . $index++]  = '`ADMIN_ID`';
 630:         }
 631:         if ($this->isColumnModified(AdminGroupPeer::CREATED_AT)) {
 632:             $modifiedColumns[':p' . $index++]  = '`CREATED_AT`';
 633:         }
 634:         if ($this->isColumnModified(AdminGroupPeer::UPDATED_AT)) {
 635:             $modifiedColumns[':p' . $index++]  = '`UPDATED_AT`';
 636:         }
 637: 
 638:         $sql = sprintf(
 639:             'INSERT INTO `admin_group` (%s) VALUES (%s)',
 640:             implode(', ', $modifiedColumns),
 641:             implode(', ', array_keys($modifiedColumns))
 642:         );
 643: 
 644:         try {
 645:             $stmt = $con->prepare($sql);
 646:             foreach ($modifiedColumns as $identifier => $columnName) {
 647:                 switch ($columnName) {
 648:                     case '`ID`':
 649:                         $stmt->bindValue($identifier, $this->id, PDO::PARAM_INT);
 650:                         break;
 651:                     case '`GROUP_ID`':
 652:                         $stmt->bindValue($identifier, $this->group_id, PDO::PARAM_INT);
 653:                         break;
 654:                     case '`ADMIN_ID`':
 655:                         $stmt->bindValue($identifier, $this->admin_id, PDO::PARAM_INT);
 656:                         break;
 657:                     case '`CREATED_AT`':
 658:                         $stmt->bindValue($identifier, $this->created_at, PDO::PARAM_STR);
 659:                         break;
 660:                     case '`UPDATED_AT`':
 661:                         $stmt->bindValue($identifier, $this->updated_at, PDO::PARAM_STR);
 662:                         break;
 663:                 }
 664:             }
 665:             $stmt->execute();
 666:         } catch (Exception $e) {
 667:             Propel::log($e->getMessage(), Propel::LOG_ERR);
 668:             throw new PropelException(sprintf('Unable to execute INSERT statement [%s]', $sql), $e);
 669:         }
 670: 
 671:         try {
 672:             $pk = $con->lastInsertId();
 673:         } catch (Exception $e) {
 674:             throw new PropelException('Unable to get autoincrement id.', $e);
 675:         }
 676:         $this->setId($pk);
 677: 
 678:         $this->setNew(false);
 679:     }
 680: 
 681:     /**
 682:      * Update the row in the database.
 683:      *
 684:      * @param PropelPDO $con
 685:      *
 686:      * @see        doSave()
 687:      */
 688:     protected function doUpdate(PropelPDO $con)
 689:     {
 690:         $selectCriteria = $this->buildPkeyCriteria();
 691:         $valuesCriteria = $this->buildCriteria();
 692:         BasePeer::doUpdate($selectCriteria, $valuesCriteria, $con);
 693:     }
 694: 
 695:     /**
 696:      * Array of ValidationFailed objects.
 697:      * @var        array ValidationFailed[]
 698:      */
 699:     protected $validationFailures = array();
 700: 
 701:     /**
 702:      * Gets any ValidationFailed objects that resulted from last call to validate().
 703:      *
 704:      *
 705:      * @return array ValidationFailed[]
 706:      * @see        validate()
 707:      */
 708:     public function getValidationFailures()
 709:     {
 710:         return $this->validationFailures;
 711:     }
 712: 
 713:     /**
 714:      * Validates the objects modified field values and all objects related to this table.
 715:      *
 716:      * If $columns is either a column name or an array of column names
 717:      * only those columns are validated.
 718:      *
 719:      * @param mixed $columns Column name or an array of column names.
 720:      * @return boolean Whether all columns pass validation.
 721:      * @see        doValidate()
 722:      * @see        getValidationFailures()
 723:      */
 724:     public function validate($columns = null)
 725:     {
 726:         $res = $this->doValidate($columns);
 727:         if ($res === true) {
 728:             $this->validationFailures = array();
 729: 
 730:             return true;
 731:         } else {
 732:             $this->validationFailures = $res;
 733: 
 734:             return false;
 735:         }
 736:     }
 737: 
 738:     /**
 739:      * This function performs the validation work for complex object models.
 740:      *
 741:      * In addition to checking the current object, all related objects will
 742:      * also be validated.  If all pass then <code>true</code> is returned; otherwise
 743:      * an aggreagated array of ValidationFailed objects will be returned.
 744:      *
 745:      * @param array $columns Array of column names to validate.
 746:      * @return mixed <code>true</code> if all validations pass; array of <code>ValidationFailed</code> objets otherwise.
 747:      */
 748:     protected function doValidate($columns = null)
 749:     {
 750:         if (!$this->alreadyInValidation) {
 751:             $this->alreadyInValidation = true;
 752:             $retval = null;
 753: 
 754:             $failureMap = array();
 755: 
 756: 
 757:             // We call the validate method on the following object(s) if they
 758:             // were passed to this object by their coresponding set
 759:             // method.  This object relates to these object(s) by a
 760:             // foreign key reference.
 761: 
 762:             if ($this->aGroup !== null) {
 763:                 if (!$this->aGroup->validate($columns)) {
 764:                     $failureMap = array_merge($failureMap, $this->aGroup->getValidationFailures());
 765:                 }
 766:             }
 767: 
 768:             if ($this->aAdmin !== null) {
 769:                 if (!$this->aAdmin->validate($columns)) {
 770:                     $failureMap = array_merge($failureMap, $this->aAdmin->getValidationFailures());
 771:                 }
 772:             }
 773: 
 774: 
 775:             if (($retval = AdminGroupPeer::doValidate($this, $columns)) !== true) {
 776:                 $failureMap = array_merge($failureMap, $retval);
 777:             }
 778: 
 779: 
 780: 
 781:             $this->alreadyInValidation = false;
 782:         }
 783: 
 784:         return (!empty($failureMap) ? $failureMap : true);
 785:     }
 786: 
 787:     /**
 788:      * Retrieves a field from the object by name passed in as a string.
 789:      *
 790:      * @param string $name name
 791:      * @param string $type The type of fieldname the $name is of:
 792:      *               one of the class type constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME
 793:      *               BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM.
 794:      *               Defaults to BasePeer::TYPE_PHPNAME
 795:      * @return mixed Value of field.
 796:      */
 797:     public function getByName($name, $type = BasePeer::TYPE_PHPNAME)
 798:     {
 799:         $pos = AdminGroupPeer::translateFieldName($name, $type, BasePeer::TYPE_NUM);
 800:         $field = $this->getByPosition($pos);
 801: 
 802:         return $field;
 803:     }
 804: 
 805:     /**
 806:      * Retrieves a field from the object by Position as specified in the xml schema.
 807:      * Zero-based.
 808:      *
 809:      * @param int $pos position in xml schema
 810:      * @return mixed Value of field at $pos
 811:      */
 812:     public function getByPosition($pos)
 813:     {
 814:         switch ($pos) {
 815:             case 0:
 816:                 return $this->getId();
 817:                 break;
 818:             case 1:
 819:                 return $this->getGroupId();
 820:                 break;
 821:             case 2:
 822:                 return $this->getAdminId();
 823:                 break;
 824:             case 3:
 825:                 return $this->getCreatedAt();
 826:                 break;
 827:             case 4:
 828:                 return $this->getUpdatedAt();
 829:                 break;
 830:             default:
 831:                 return null;
 832:                 break;
 833:         } // switch()
 834:     }
 835: 
 836:     /**
 837:      * Exports the object as an array.
 838:      *
 839:      * You can specify the key type of the array by passing one of the class
 840:      * type constants.
 841:      *
 842:      * @param     string  $keyType (optional) One of the class type constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME,
 843:      *                    BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM.
 844:      *                    Defaults to BasePeer::TYPE_PHPNAME.
 845:      * @param     boolean $includeLazyLoadColumns (optional) Whether to include lazy loaded columns. Defaults to true.
 846:      * @param     array $alreadyDumpedObjects List of objects to skip to avoid recursion
 847:      * @param     boolean $includeForeignObjects (optional) Whether to include hydrated related objects. Default to FALSE.
 848:      *
 849:      * @return array an associative array containing the field names (as keys) and field values
 850:      */
 851:     public function toArray($keyType = BasePeer::TYPE_PHPNAME, $includeLazyLoadColumns = true, $alreadyDumpedObjects = array(), $includeForeignObjects = false)
 852:     {
 853:         if (isset($alreadyDumpedObjects['AdminGroup'][$this->getPrimaryKey()])) {
 854:             return '*RECURSION*';
 855:         }
 856:         $alreadyDumpedObjects['AdminGroup'][$this->getPrimaryKey()] = true;
 857:         $keys = AdminGroupPeer::getFieldNames($keyType);
 858:         $result = array(
 859:             $keys[0] => $this->getId(),
 860:             $keys[1] => $this->getGroupId(),
 861:             $keys[2] => $this->getAdminId(),
 862:             $keys[3] => $this->getCreatedAt(),
 863:             $keys[4] => $this->getUpdatedAt(),
 864:         );
 865:         if ($includeForeignObjects) {
 866:             if (null !== $this->aGroup) {
 867:                 $result['Group'] = $this->aGroup->toArray($keyType, $includeLazyLoadColumns,  $alreadyDumpedObjects, true);
 868:             }
 869:             if (null !== $this->aAdmin) {
 870:                 $result['Admin'] = $this->aAdmin->toArray($keyType, $includeLazyLoadColumns,  $alreadyDumpedObjects, true);
 871:             }
 872:         }
 873: 
 874:         return $result;
 875:     }
 876: 
 877:     /**
 878:      * Sets a field from the object by name passed in as a string.
 879:      *
 880:      * @param string $name peer name
 881:      * @param mixed $value field value
 882:      * @param string $type The type of fieldname the $name is of:
 883:      *                     one of the class type constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME
 884:      *                     BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM.
 885:      *                     Defaults to BasePeer::TYPE_PHPNAME
 886:      * @return void
 887:      */
 888:     public function setByName($name, $value, $type = BasePeer::TYPE_PHPNAME)
 889:     {
 890:         $pos = AdminGroupPeer::translateFieldName($name, $type, BasePeer::TYPE_NUM);
 891: 
 892:         $this->setByPosition($pos, $value);
 893:     }
 894: 
 895:     /**
 896:      * Sets a field from the object by Position as specified in the xml schema.
 897:      * Zero-based.
 898:      *
 899:      * @param int $pos position in xml schema
 900:      * @param mixed $value field value
 901:      * @return void
 902:      */
 903:     public function setByPosition($pos, $value)
 904:     {
 905:         switch ($pos) {
 906:             case 0:
 907:                 $this->setId($value);
 908:                 break;
 909:             case 1:
 910:                 $this->setGroupId($value);
 911:                 break;
 912:             case 2:
 913:                 $this->setAdminId($value);
 914:                 break;
 915:             case 3:
 916:                 $this->setCreatedAt($value);
 917:                 break;
 918:             case 4:
 919:                 $this->setUpdatedAt($value);
 920:                 break;
 921:         } // switch()
 922:     }
 923: 
 924:     /**
 925:      * Populates the object using an array.
 926:      *
 927:      * This is particularly useful when populating an object from one of the
 928:      * request arrays (e.g. $_POST).  This method goes through the column
 929:      * names, checking to see whether a matching key exists in populated
 930:      * array. If so the setByName() method is called for that column.
 931:      *
 932:      * You can specify the key type of the array by additionally passing one
 933:      * of the class type constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME,
 934:      * BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM.
 935:      * The default key type is the column's BasePeer::TYPE_PHPNAME
 936:      *
 937:      * @param array  $arr     An array to populate the object from.
 938:      * @param string $keyType The type of keys the array uses.
 939:      * @return void
 940:      */
 941:     public function fromArray($arr, $keyType = BasePeer::TYPE_PHPNAME)
 942:     {
 943:         $keys = AdminGroupPeer::getFieldNames($keyType);
 944: 
 945:         if (array_key_exists($keys[0], $arr)) $this->setId($arr[$keys[0]]);
 946:         if (array_key_exists($keys[1], $arr)) $this->setGroupId($arr[$keys[1]]);
 947:         if (array_key_exists($keys[2], $arr)) $this->setAdminId($arr[$keys[2]]);
 948:         if (array_key_exists($keys[3], $arr)) $this->setCreatedAt($arr[$keys[3]]);
 949:         if (array_key_exists($keys[4], $arr)) $this->setUpdatedAt($arr[$keys[4]]);
 950:     }
 951: 
 952:     /**
 953:      * Build a Criteria object containing the values of all modified columns in this object.
 954:      *
 955:      * @return Criteria The Criteria object containing all modified values.
 956:      */
 957:     public function buildCriteria()
 958:     {
 959:         $criteria = new Criteria(AdminGroupPeer::DATABASE_NAME);
 960: 
 961:         if ($this->isColumnModified(AdminGroupPeer::ID)) $criteria->add(AdminGroupPeer::ID, $this->id);
 962:         if ($this->isColumnModified(AdminGroupPeer::GROUP_ID)) $criteria->add(AdminGroupPeer::GROUP_ID, $this->group_id);
 963:         if ($this->isColumnModified(AdminGroupPeer::ADMIN_ID)) $criteria->add(AdminGroupPeer::ADMIN_ID, $this->admin_id);
 964:         if ($this->isColumnModified(AdminGroupPeer::CREATED_AT)) $criteria->add(AdminGroupPeer::CREATED_AT, $this->created_at);
 965:         if ($this->isColumnModified(AdminGroupPeer::UPDATED_AT)) $criteria->add(AdminGroupPeer::UPDATED_AT, $this->updated_at);
 966: 
 967:         return $criteria;
 968:     }
 969: 
 970:     /**
 971:      * Builds a Criteria object containing the primary key for this object.
 972:      *
 973:      * Unlike buildCriteria() this method includes the primary key values regardless
 974:      * of whether or not they have been modified.
 975:      *
 976:      * @return Criteria The Criteria object containing value(s) for primary key(s).
 977:      */
 978:     public function buildPkeyCriteria()
 979:     {
 980:         $criteria = new Criteria(AdminGroupPeer::DATABASE_NAME);
 981:         $criteria->add(AdminGroupPeer::ID, $this->id);
 982: 
 983:         return $criteria;
 984:     }
 985: 
 986:     /**
 987:      * Returns the primary key for this object (row).
 988:      * @return int
 989:      */
 990:     public function getPrimaryKey()
 991:     {
 992:         return $this->getId();
 993:     }
 994: 
 995:     /**
 996:      * Generic method to set the primary key (id column).
 997:      *
 998:      * @param  int $key Primary key.
 999:      * @return void
1000:      */
1001:     public function setPrimaryKey($key)
1002:     {
1003:         $this->setId($key);
1004:     }
1005: 
1006:     /**
1007:      * Returns true if the primary key for this object is null.
1008:      * @return boolean
1009:      */
1010:     public function isPrimaryKeyNull()
1011:     {
1012: 
1013:         return null === $this->getId();
1014:     }
1015: 
1016:     /**
1017:      * Sets contents of passed object to values from current object.
1018:      *
1019:      * If desired, this method can also make copies of all associated (fkey referrers)
1020:      * objects.
1021:      *
1022:      * @param object $copyObj An object of AdminGroup (or compatible) type.
1023:      * @param boolean $deepCopy Whether to also copy all rows that refer (by fkey) to the current row.
1024:      * @param boolean $makeNew Whether to reset autoincrement PKs and make the object new.
1025:      * @throws PropelException
1026:      */
1027:     public function copyInto($copyObj, $deepCopy = false, $makeNew = true)
1028:     {
1029:         $copyObj->setGroupId($this->getGroupId());
1030:         $copyObj->setAdminId($this->getAdminId());
1031:         $copyObj->setCreatedAt($this->getCreatedAt());
1032:         $copyObj->setUpdatedAt($this->getUpdatedAt());
1033: 
1034:         if ($deepCopy && !$this->startCopy) {
1035:             // important: temporarily setNew(false) because this affects the behavior of
1036:             // the getter/setter methods for fkey referrer objects.
1037:             $copyObj->setNew(false);
1038:             // store object hash to prevent cycle
1039:             $this->startCopy = true;
1040: 
1041:             //unflag object copy
1042:             $this->startCopy = false;
1043:         } // if ($deepCopy)
1044: 
1045:         if ($makeNew) {
1046:             $copyObj->setNew(true);
1047:             $copyObj->setId(NULL); // this is a auto-increment column, so set to default value
1048:         }
1049:     }
1050: 
1051:     /**
1052:      * Makes a copy of this object that will be inserted as a new row in table when saved.
1053:      * It creates a new object filling in the simple attributes, but skipping any primary
1054:      * keys that are defined for the table.
1055:      *
1056:      * If desired, this method can also make copies of all associated (fkey referrers)
1057:      * objects.
1058:      *
1059:      * @param boolean $deepCopy Whether to also copy all rows that refer (by fkey) to the current row.
1060:      * @return AdminGroup Clone of current object.
1061:      * @throws PropelException
1062:      */
1063:     public function copy($deepCopy = false)
1064:     {
1065:         // we use get_class(), because this might be a subclass
1066:         $clazz = get_class($this);
1067:         $copyObj = new $clazz();
1068:         $this->copyInto($copyObj, $deepCopy);
1069: 
1070:         return $copyObj;
1071:     }
1072: 
1073:     /**
1074:      * Returns a peer instance associated with this om.
1075:      *
1076:      * Since Peer classes are not to have any instance attributes, this method returns the
1077:      * same instance for all member of this class. The method could therefore
1078:      * be static, but this would prevent one from overriding the behavior.
1079:      *
1080:      * @return AdminGroupPeer
1081:      */
1082:     public function getPeer()
1083:     {
1084:         if (self::$peer === null) {
1085:             self::$peer = new AdminGroupPeer();
1086:         }
1087: 
1088:         return self::$peer;
1089:     }
1090: 
1091:     /**
1092:      * Declares an association between this object and a Group object.
1093:      *
1094:      * @param             Group $v
1095:      * @return AdminGroup The current object (for fluent API support)
1096:      * @throws PropelException
1097:      */
1098:     public function setGroup(Group $v = null)
1099:     {
1100:         if ($v === null) {
1101:             $this->setGroupId(NULL);
1102:         } else {
1103:             $this->setGroupId($v->getId());
1104:         }
1105: 
1106:         $this->aGroup = $v;
1107: 
1108:         // Add binding for other direction of this n:n relationship.
1109:         // If this object has already been added to the Group object, it will not be re-added.
1110:         if ($v !== null) {
1111:             $v->addAdminGroup($this);
1112:         }
1113: 
1114: 
1115:         return $this;
1116:     }
1117: 
1118: 
1119:     /**
1120:      * Get the associated Group object
1121:      *
1122:      * @param PropelPDO $con Optional Connection object.
1123:      * @return Group The associated Group object.
1124:      * @throws PropelException
1125:      */
1126:     public function getGroup(PropelPDO $con = null)
1127:     {
1128:         if ($this->aGroup === null && ($this->group_id !== null)) {
1129:             $this->aGroup = GroupQuery::create()->findPk($this->group_id, $con);
1130:             /* The following can be used additionally to
1131:                 guarantee the related object contains a reference
1132:                 to this object.  This level of coupling may, however, be
1133:                 undesirable since it could result in an only partially populated collection
1134:                 in the referenced object.
1135:                 $this->aGroup->addAdminGroups($this);
1136:              */
1137:         }
1138: 
1139:         return $this->aGroup;
1140:     }
1141: 
1142:     /**
1143:      * Declares an association between this object and a Admin object.
1144:      *
1145:      * @param             Admin $v
1146:      * @return AdminGroup The current object (for fluent API support)
1147:      * @throws PropelException
1148:      */
1149:     public function setAdmin(Admin $v = null)
1150:     {
1151:         if ($v === null) {
1152:             $this->setAdminId(NULL);
1153:         } else {
1154:             $this->setAdminId($v->getId());
1155:         }
1156: 
1157:         $this->aAdmin = $v;
1158: 
1159:         // Add binding for other direction of this n:n relationship.
1160:         // If this object has already been added to the Admin object, it will not be re-added.
1161:         if ($v !== null) {
1162:             $v->addAdminGroup($this);
1163:         }
1164: 
1165: 
1166:         return $this;
1167:     }
1168: 
1169: 
1170:     /**
1171:      * Get the associated Admin object
1172:      *
1173:      * @param PropelPDO $con Optional Connection object.
1174:      * @return Admin The associated Admin object.
1175:      * @throws PropelException
1176:      */
1177:     public function getAdmin(PropelPDO $con = null)
1178:     {
1179:         if ($this->aAdmin === null && ($this->admin_id !== null)) {
1180:             $this->aAdmin = AdminQuery::create()->findPk($this->admin_id, $con);
1181:             /* The following can be used additionally to
1182:                 guarantee the related object contains a reference
1183:                 to this object.  This level of coupling may, however, be
1184:                 undesirable since it could result in an only partially populated collection
1185:                 in the referenced object.
1186:                 $this->aAdmin->addAdminGroups($this);
1187:              */
1188:         }
1189: 
1190:         return $this->aAdmin;
1191:     }
1192: 
1193:     /**
1194:      * Clears the current object and sets all attributes to their default values
1195:      */
1196:     public function clear()
1197:     {
1198:         $this->id = null;
1199:         $this->group_id = null;
1200:         $this->admin_id = null;
1201:         $this->created_at = null;
1202:         $this->updated_at = null;
1203:         $this->alreadyInSave = false;
1204:         $this->alreadyInValidation = false;
1205:         $this->clearAllReferences();
1206:         $this->resetModified();
1207:         $this->setNew(true);
1208:         $this->setDeleted(false);
1209:     }
1210: 
1211:     /**
1212:      * Resets all references to other model objects or collections of model objects.
1213:      *
1214:      * This method is a user-space workaround for PHP's inability to garbage collect
1215:      * objects with circular references (even in PHP 5.3). This is currently necessary
1216:      * when using Propel in certain daemon or large-volumne/high-memory operations.
1217:      *
1218:      * @param boolean $deep Whether to also clear the references on all referrer objects.
1219:      */
1220:     public function clearAllReferences($deep = false)
1221:     {
1222:         if ($deep) {
1223:         } // if ($deep)
1224: 
1225:         $this->aGroup = null;
1226:         $this->aAdmin = null;
1227:     }
1228: 
1229:     /**
1230:      * return the string representation of this object
1231:      *
1232:      * @return string
1233:      */
1234:     public function __toString()
1235:     {
1236:         return (string) $this->exportTo(AdminGroupPeer::DEFAULT_STRING_FORMAT);
1237:     }
1238: 
1239:     /**
1240:      * return true is the object is in saving state
1241:      *
1242:      * @return boolean
1243:      */
1244:     public function isAlreadyInSave()
1245:     {
1246:         return $this->alreadyInSave;
1247:     }
1248: 
1249:     // timestampable behavior
1250: 
1251:     /**
1252:      * Mark the current object so that the update date doesn't get updated during next save
1253:      *
1254:      * @return     AdminGroup The current object (for fluent API support)
1255:      */
1256:     public function keepUpdateDateUnchanged()
1257:     {
1258:         $this->modifiedColumns[] = AdminGroupPeer::UPDATED_AT;
1259: 
1260:         return $this;
1261:     }
1262: 
1263: }
1264: 
thelia API documentation generated by ApiGen 2.8.0