Overview

Namespaces

  • Thelia
    • Action
    • Config
    • Controller
    • Core
      • Bundle
      • DependencyInjection
        • Compiler
        • Loader
      • Event
      • EventListener
      • Template
        • BaseParam
    • Exception
    • Log
      • Destination
    • Model
      • map
      • om
    • Routing
      • Matcher
    • Tools
    • Tpex
      • BaseParam
      • Element
        • Loop
        • TestLoop
      • Event
      • Exception
      • Filter
      • Tokenizer

Classes

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