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 \PropelCollection;
  14: use \PropelDateTime;
  15: use \PropelException;
  16: use \PropelObjectCollection;
  17: use \PropelPDO;
  18: use Thelia\Model\Content;
  19: use Thelia\Model\ContentAssoc;
  20: use Thelia\Model\ContentAssocQuery;
  21: use Thelia\Model\ContentFolder;
  22: use Thelia\Model\ContentFolderQuery;
  23: use Thelia\Model\ContentI18n;
  24: use Thelia\Model\ContentI18nQuery;
  25: use Thelia\Model\ContentPeer;
  26: use Thelia\Model\ContentQuery;
  27: use Thelia\Model\ContentVersion;
  28: use Thelia\Model\ContentVersionPeer;
  29: use Thelia\Model\ContentVersionQuery;
  30: use Thelia\Model\Document;
  31: use Thelia\Model\DocumentQuery;
  32: use Thelia\Model\Image;
  33: use Thelia\Model\ImageQuery;
  34: use Thelia\Model\Rewriting;
  35: use Thelia\Model\RewritingQuery;
  36: 
  37: /**
  38:  * Base class that represents a row from the 'content' table.
  39:  *
  40:  *
  41:  *
  42:  * @package    propel.generator.Thelia.Model.om
  43:  */
  44: abstract class BaseContent extends BaseObject implements Persistent
  45: {
  46:     /**
  47:      * Peer class name
  48:      */
  49:     const PEER = 'Thelia\\Model\\ContentPeer';
  50: 
  51:     /**
  52:      * The Peer class.
  53:      * Instance provides a convenient way of calling static methods on a class
  54:      * that calling code may not be able to identify.
  55:      * @var        ContentPeer
  56:      */
  57:     protected static $peer;
  58: 
  59:     /**
  60:      * The flag var to prevent infinit loop in deep copy
  61:      * @var       boolean
  62:      */
  63:     protected $startCopy = false;
  64: 
  65:     /**
  66:      * The value for the id field.
  67:      * @var        int
  68:      */
  69:     protected $id;
  70: 
  71:     /**
  72:      * The value for the visible field.
  73:      * @var        int
  74:      */
  75:     protected $visible;
  76: 
  77:     /**
  78:      * The value for the position field.
  79:      * @var        int
  80:      */
  81:     protected $position;
  82: 
  83:     /**
  84:      * The value for the created_at field.
  85:      * @var        string
  86:      */
  87:     protected $created_at;
  88: 
  89:     /**
  90:      * The value for the updated_at field.
  91:      * @var        string
  92:      */
  93:     protected $updated_at;
  94: 
  95:     /**
  96:      * The value for the version field.
  97:      * Note: this column has a database default value of: 0
  98:      * @var        int
  99:      */
 100:     protected $version;
 101: 
 102:     /**
 103:      * The value for the version_created_at field.
 104:      * @var        string
 105:      */
 106:     protected $version_created_at;
 107: 
 108:     /**
 109:      * The value for the version_created_by field.
 110:      * @var        string
 111:      */
 112:     protected $version_created_by;
 113: 
 114:     /**
 115:      * @var        PropelObjectCollection|ContentAssoc[] Collection to store aggregation of ContentAssoc objects.
 116:      */
 117:     protected $collContentAssocs;
 118:     protected $collContentAssocsPartial;
 119: 
 120:     /**
 121:      * @var        PropelObjectCollection|Image[] Collection to store aggregation of Image objects.
 122:      */
 123:     protected $collImages;
 124:     protected $collImagesPartial;
 125: 
 126:     /**
 127:      * @var        PropelObjectCollection|Document[] Collection to store aggregation of Document objects.
 128:      */
 129:     protected $collDocuments;
 130:     protected $collDocumentsPartial;
 131: 
 132:     /**
 133:      * @var        PropelObjectCollection|Rewriting[] Collection to store aggregation of Rewriting objects.
 134:      */
 135:     protected $collRewritings;
 136:     protected $collRewritingsPartial;
 137: 
 138:     /**
 139:      * @var        PropelObjectCollection|ContentFolder[] Collection to store aggregation of ContentFolder objects.
 140:      */
 141:     protected $collContentFolders;
 142:     protected $collContentFoldersPartial;
 143: 
 144:     /**
 145:      * @var        PropelObjectCollection|ContentI18n[] Collection to store aggregation of ContentI18n objects.
 146:      */
 147:     protected $collContentI18ns;
 148:     protected $collContentI18nsPartial;
 149: 
 150:     /**
 151:      * @var        PropelObjectCollection|ContentVersion[] Collection to store aggregation of ContentVersion objects.
 152:      */
 153:     protected $collContentVersions;
 154:     protected $collContentVersionsPartial;
 155: 
 156:     /**
 157:      * Flag to prevent endless save loop, if this object is referenced
 158:      * by another object which falls in this transaction.
 159:      * @var        boolean
 160:      */
 161:     protected $alreadyInSave = false;
 162: 
 163:     /**
 164:      * Flag to prevent endless validation loop, if this object is referenced
 165:      * by another object which falls in this transaction.
 166:      * @var        boolean
 167:      */
 168:     protected $alreadyInValidation = false;
 169: 
 170:     // i18n behavior
 171: 
 172:     /**
 173:      * Current locale
 174:      * @var        string
 175:      */
 176:     protected $currentLocale = 'en_EN';
 177: 
 178:     /**
 179:      * Current translation objects
 180:      * @var        array[ContentI18n]
 181:      */
 182:     protected $currentTranslations;
 183: 
 184:     // versionable behavior
 185: 
 186: 
 187:     /**
 188:      * @var bool
 189:      */
 190:     protected $enforceVersion = false;
 191: 
 192:     /**
 193:      * An array of objects scheduled for deletion.
 194:      * @var     PropelObjectCollection
 195:      */
 196:     protected $contentAssocsScheduledForDeletion = null;
 197: 
 198:     /**
 199:      * An array of objects scheduled for deletion.
 200:      * @var     PropelObjectCollection
 201:      */
 202:     protected $imagesScheduledForDeletion = null;
 203: 
 204:     /**
 205:      * An array of objects scheduled for deletion.
 206:      * @var     PropelObjectCollection
 207:      */
 208:     protected $documentsScheduledForDeletion = null;
 209: 
 210:     /**
 211:      * An array of objects scheduled for deletion.
 212:      * @var     PropelObjectCollection
 213:      */
 214:     protected $rewritingsScheduledForDeletion = null;
 215: 
 216:     /**
 217:      * An array of objects scheduled for deletion.
 218:      * @var     PropelObjectCollection
 219:      */
 220:     protected $contentFoldersScheduledForDeletion = null;
 221: 
 222:     /**
 223:      * An array of objects scheduled for deletion.
 224:      * @var     PropelObjectCollection
 225:      */
 226:     protected $contentI18nsScheduledForDeletion = null;
 227: 
 228:     /**
 229:      * An array of objects scheduled for deletion.
 230:      * @var     PropelObjectCollection
 231:      */
 232:     protected $contentVersionsScheduledForDeletion = null;
 233: 
 234:     /**
 235:      * Applies default values to this object.
 236:      * This method should be called from the object's constructor (or
 237:      * equivalent initialization method).
 238:      * @see        __construct()
 239:      */
 240:     public function applyDefaultValues()
 241:     {
 242:         $this->version = 0;
 243:     }
 244: 
 245:     /**
 246:      * Initializes internal state of BaseContent object.
 247:      * @see        applyDefaults()
 248:      */
 249:     public function __construct()
 250:     {
 251:         parent::__construct();
 252:         $this->applyDefaultValues();
 253:     }
 254: 
 255:     /**
 256:      * Get the [id] column value.
 257:      *
 258:      * @return int
 259:      */
 260:     public function getId()
 261:     {
 262:         return $this->id;
 263:     }
 264: 
 265:     /**
 266:      * Get the [visible] column value.
 267:      *
 268:      * @return int
 269:      */
 270:     public function getVisible()
 271:     {
 272:         return $this->visible;
 273:     }
 274: 
 275:     /**
 276:      * Get the [position] column value.
 277:      *
 278:      * @return int
 279:      */
 280:     public function getPosition()
 281:     {
 282:         return $this->position;
 283:     }
 284: 
 285:     /**
 286:      * Get the [optionally formatted] temporal [created_at] column value.
 287:      *
 288:      *
 289:      * @param string $format The date/time format string (either date()-style or strftime()-style).
 290:      *               If format is null, then the raw DateTime object will be returned.
 291:      * @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
 292:      * @throws PropelException - if unable to parse/validate the date/time value.
 293:      */
 294:     public function getCreatedAt($format = 'Y-m-d H:i:s')
 295:     {
 296:         if ($this->created_at === null) {
 297:             return null;
 298:         }
 299: 
 300:         if ($this->created_at === '0000-00-00 00:00:00') {
 301:             // while technically this is not a default value of null,
 302:             // this seems to be closest in meaning.
 303:             return null;
 304:         } else {
 305:             try {
 306:                 $dt = new DateTime($this->created_at);
 307:             } catch (Exception $x) {
 308:                 throw new PropelException("Internally stored date/time/timestamp value could not be converted to DateTime: " . var_export($this->created_at, true), $x);
 309:             }
 310:         }
 311: 
 312:         if ($format === null) {
 313:             // Because propel.useDateTimeClass is true, we return a DateTime object.
 314:             return $dt;
 315:         } elseif (strpos($format, '%') !== false) {
 316:             return strftime($format, $dt->format('U'));
 317:         } else {
 318:             return $dt->format($format);
 319:         }
 320:     }
 321: 
 322:     /**
 323:      * Get the [optionally formatted] temporal [updated_at] column value.
 324:      *
 325:      *
 326:      * @param string $format The date/time format string (either date()-style or strftime()-style).
 327:      *               If format is null, then the raw DateTime object will be returned.
 328:      * @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
 329:      * @throws PropelException - if unable to parse/validate the date/time value.
 330:      */
 331:     public function getUpdatedAt($format = 'Y-m-d H:i:s')
 332:     {
 333:         if ($this->updated_at === null) {
 334:             return null;
 335:         }
 336: 
 337:         if ($this->updated_at === '0000-00-00 00:00:00') {
 338:             // while technically this is not a default value of null,
 339:             // this seems to be closest in meaning.
 340:             return null;
 341:         } else {
 342:             try {
 343:                 $dt = new DateTime($this->updated_at);
 344:             } catch (Exception $x) {
 345:                 throw new PropelException("Internally stored date/time/timestamp value could not be converted to DateTime: " . var_export($this->updated_at, true), $x);
 346:             }
 347:         }
 348: 
 349:         if ($format === null) {
 350:             // Because propel.useDateTimeClass is true, we return a DateTime object.
 351:             return $dt;
 352:         } elseif (strpos($format, '%') !== false) {
 353:             return strftime($format, $dt->format('U'));
 354:         } else {
 355:             return $dt->format($format);
 356:         }
 357:     }
 358: 
 359:     /**
 360:      * Get the [version] column value.
 361:      *
 362:      * @return int
 363:      */
 364:     public function getVersion()
 365:     {
 366:         return $this->version;
 367:     }
 368: 
 369:     /**
 370:      * Get the [optionally formatted] temporal [version_created_at] column value.
 371:      *
 372:      *
 373:      * @param string $format The date/time format string (either date()-style or strftime()-style).
 374:      *               If format is null, then the raw DateTime object will be returned.
 375:      * @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
 376:      * @throws PropelException - if unable to parse/validate the date/time value.
 377:      */
 378:     public function getVersionCreatedAt($format = 'Y-m-d H:i:s')
 379:     {
 380:         if ($this->version_created_at === null) {
 381:             return null;
 382:         }
 383: 
 384:         if ($this->version_created_at === '0000-00-00 00:00:00') {
 385:             // while technically this is not a default value of null,
 386:             // this seems to be closest in meaning.
 387:             return null;
 388:         } else {
 389:             try {
 390:                 $dt = new DateTime($this->version_created_at);
 391:             } catch (Exception $x) {
 392:                 throw new PropelException("Internally stored date/time/timestamp value could not be converted to DateTime: " . var_export($this->version_created_at, true), $x);
 393:             }
 394:         }
 395: 
 396:         if ($format === null) {
 397:             // Because propel.useDateTimeClass is true, we return a DateTime object.
 398:             return $dt;
 399:         } elseif (strpos($format, '%') !== false) {
 400:             return strftime($format, $dt->format('U'));
 401:         } else {
 402:             return $dt->format($format);
 403:         }
 404:     }
 405: 
 406:     /**
 407:      * Get the [version_created_by] column value.
 408:      *
 409:      * @return string
 410:      */
 411:     public function getVersionCreatedBy()
 412:     {
 413:         return $this->version_created_by;
 414:     }
 415: 
 416:     /**
 417:      * Set the value of [id] column.
 418:      *
 419:      * @param int $v new value
 420:      * @return Content The current object (for fluent API support)
 421:      */
 422:     public function setId($v)
 423:     {
 424:         if ($v !== null) {
 425:             $v = (int) $v;
 426:         }
 427: 
 428:         if ($this->id !== $v) {
 429:             $this->id = $v;
 430:             $this->modifiedColumns[] = ContentPeer::ID;
 431:         }
 432: 
 433: 
 434:         return $this;
 435:     } // setId()
 436: 
 437:     /**
 438:      * Set the value of [visible] column.
 439:      *
 440:      * @param int $v new value
 441:      * @return Content The current object (for fluent API support)
 442:      */
 443:     public function setVisible($v)
 444:     {
 445:         if ($v !== null) {
 446:             $v = (int) $v;
 447:         }
 448: 
 449:         if ($this->visible !== $v) {
 450:             $this->visible = $v;
 451:             $this->modifiedColumns[] = ContentPeer::VISIBLE;
 452:         }
 453: 
 454: 
 455:         return $this;
 456:     } // setVisible()
 457: 
 458:     /**
 459:      * Set the value of [position] column.
 460:      *
 461:      * @param int $v new value
 462:      * @return Content The current object (for fluent API support)
 463:      */
 464:     public function setPosition($v)
 465:     {
 466:         if ($v !== null) {
 467:             $v = (int) $v;
 468:         }
 469: 
 470:         if ($this->position !== $v) {
 471:             $this->position = $v;
 472:             $this->modifiedColumns[] = ContentPeer::POSITION;
 473:         }
 474: 
 475: 
 476:         return $this;
 477:     } // setPosition()
 478: 
 479:     /**
 480:      * Sets the value of [created_at] column to a normalized version of the date/time value specified.
 481:      *
 482:      * @param mixed $v string, integer (timestamp), or DateTime value.
 483:      *               Empty strings are treated as null.
 484:      * @return Content The current object (for fluent API support)
 485:      */
 486:     public function setCreatedAt($v)
 487:     {
 488:         $dt = PropelDateTime::newInstance($v, null, 'DateTime');
 489:         if ($this->created_at !== null || $dt !== null) {
 490:             $currentDateAsString = ($this->created_at !== null && $tmpDt = new DateTime($this->created_at)) ? $tmpDt->format('Y-m-d H:i:s') : null;
 491:             $newDateAsString = $dt ? $dt->format('Y-m-d H:i:s') : null;
 492:             if ($currentDateAsString !== $newDateAsString) {
 493:                 $this->created_at = $newDateAsString;
 494:                 $this->modifiedColumns[] = ContentPeer::CREATED_AT;
 495:             }
 496:         } // if either are not null
 497: 
 498: 
 499:         return $this;
 500:     } // setCreatedAt()
 501: 
 502:     /**
 503:      * Sets the value of [updated_at] column to a normalized version of the date/time value specified.
 504:      *
 505:      * @param mixed $v string, integer (timestamp), or DateTime value.
 506:      *               Empty strings are treated as null.
 507:      * @return Content The current object (for fluent API support)
 508:      */
 509:     public function setUpdatedAt($v)
 510:     {
 511:         $dt = PropelDateTime::newInstance($v, null, 'DateTime');
 512:         if ($this->updated_at !== null || $dt !== null) {
 513:             $currentDateAsString = ($this->updated_at !== null && $tmpDt = new DateTime($this->updated_at)) ? $tmpDt->format('Y-m-d H:i:s') : null;
 514:             $newDateAsString = $dt ? $dt->format('Y-m-d H:i:s') : null;
 515:             if ($currentDateAsString !== $newDateAsString) {
 516:                 $this->updated_at = $newDateAsString;
 517:                 $this->modifiedColumns[] = ContentPeer::UPDATED_AT;
 518:             }
 519:         } // if either are not null
 520: 
 521: 
 522:         return $this;
 523:     } // setUpdatedAt()
 524: 
 525:     /**
 526:      * Set the value of [version] column.
 527:      *
 528:      * @param int $v new value
 529:      * @return Content The current object (for fluent API support)
 530:      */
 531:     public function setVersion($v)
 532:     {
 533:         if ($v !== null) {
 534:             $v = (int) $v;
 535:         }
 536: 
 537:         if ($this->version !== $v) {
 538:             $this->version = $v;
 539:             $this->modifiedColumns[] = ContentPeer::VERSION;
 540:         }
 541: 
 542: 
 543:         return $this;
 544:     } // setVersion()
 545: 
 546:     /**
 547:      * Sets the value of [version_created_at] column to a normalized version of the date/time value specified.
 548:      *
 549:      * @param mixed $v string, integer (timestamp), or DateTime value.
 550:      *               Empty strings are treated as null.
 551:      * @return Content The current object (for fluent API support)
 552:      */
 553:     public function setVersionCreatedAt($v)
 554:     {
 555:         $dt = PropelDateTime::newInstance($v, null, 'DateTime');
 556:         if ($this->version_created_at !== null || $dt !== null) {
 557:             $currentDateAsString = ($this->version_created_at !== null && $tmpDt = new DateTime($this->version_created_at)) ? $tmpDt->format('Y-m-d H:i:s') : null;
 558:             $newDateAsString = $dt ? $dt->format('Y-m-d H:i:s') : null;
 559:             if ($currentDateAsString !== $newDateAsString) {
 560:                 $this->version_created_at = $newDateAsString;
 561:                 $this->modifiedColumns[] = ContentPeer::VERSION_CREATED_AT;
 562:             }
 563:         } // if either are not null
 564: 
 565: 
 566:         return $this;
 567:     } // setVersionCreatedAt()
 568: 
 569:     /**
 570:      * Set the value of [version_created_by] column.
 571:      *
 572:      * @param string $v new value
 573:      * @return Content The current object (for fluent API support)
 574:      */
 575:     public function setVersionCreatedBy($v)
 576:     {
 577:         if ($v !== null) {
 578:             $v = (string) $v;
 579:         }
 580: 
 581:         if ($this->version_created_by !== $v) {
 582:             $this->version_created_by = $v;
 583:             $this->modifiedColumns[] = ContentPeer::VERSION_CREATED_BY;
 584:         }
 585: 
 586: 
 587:         return $this;
 588:     } // setVersionCreatedBy()
 589: 
 590:     /**
 591:      * Indicates whether the columns in this object are only set to default values.
 592:      *
 593:      * This method can be used in conjunction with isModified() to indicate whether an object is both
 594:      * modified _and_ has some values set which are non-default.
 595:      *
 596:      * @return boolean Whether the columns in this object are only been set with default values.
 597:      */
 598:     public function hasOnlyDefaultValues()
 599:     {
 600:             if ($this->version !== 0) {
 601:                 return false;
 602:             }
 603: 
 604:         // otherwise, everything was equal, so return true
 605:         return true;
 606:     } // hasOnlyDefaultValues()
 607: 
 608:     /**
 609:      * Hydrates (populates) the object variables with values from the database resultset.
 610:      *
 611:      * An offset (0-based "start column") is specified so that objects can be hydrated
 612:      * with a subset of the columns in the resultset rows.  This is needed, for example,
 613:      * for results of JOIN queries where the resultset row includes columns from two or
 614:      * more tables.
 615:      *
 616:      * @param array $row The row returned by PDOStatement->fetch(PDO::FETCH_NUM)
 617:      * @param int $startcol 0-based offset column which indicates which restultset column to start with.
 618:      * @param boolean $rehydrate Whether this object is being re-hydrated from the database.
 619:      * @return int             next starting column
 620:      * @throws PropelException - Any caught Exception will be rewrapped as a PropelException.
 621:      */
 622:     public function hydrate($row, $startcol = 0, $rehydrate = false)
 623:     {
 624:         try {
 625: 
 626:             $this->id = ($row[$startcol + 0] !== null) ? (int) $row[$startcol + 0] : null;
 627:             $this->visible = ($row[$startcol + 1] !== null) ? (int) $row[$startcol + 1] : null;
 628:             $this->position = ($row[$startcol + 2] !== null) ? (int) $row[$startcol + 2] : null;
 629:             $this->created_at = ($row[$startcol + 3] !== null) ? (string) $row[$startcol + 3] : null;
 630:             $this->updated_at = ($row[$startcol + 4] !== null) ? (string) $row[$startcol + 4] : null;
 631:             $this->version = ($row[$startcol + 5] !== null) ? (int) $row[$startcol + 5] : null;
 632:             $this->version_created_at = ($row[$startcol + 6] !== null) ? (string) $row[$startcol + 6] : null;
 633:             $this->version_created_by = ($row[$startcol + 7] !== null) ? (string) $row[$startcol + 7] : null;
 634:             $this->resetModified();
 635: 
 636:             $this->setNew(false);
 637: 
 638:             if ($rehydrate) {
 639:                 $this->ensureConsistency();
 640:             }
 641: 
 642:             return $startcol + 8; // 8 = ContentPeer::NUM_HYDRATE_COLUMNS.
 643: 
 644:         } catch (Exception $e) {
 645:             throw new PropelException("Error populating Content object", $e);
 646:         }
 647:     }
 648: 
 649:     /**
 650:      * Checks and repairs the internal consistency of the object.
 651:      *
 652:      * This method is executed after an already-instantiated object is re-hydrated
 653:      * from the database.  It exists to check any foreign keys to make sure that
 654:      * the objects related to the current object are correct based on foreign key.
 655:      *
 656:      * You can override this method in the stub class, but you should always invoke
 657:      * the base method from the overridden method (i.e. parent::ensureConsistency()),
 658:      * in case your model changes.
 659:      *
 660:      * @throws PropelException
 661:      */
 662:     public function ensureConsistency()
 663:     {
 664: 
 665:     } // ensureConsistency
 666: 
 667:     /**
 668:      * Reloads this object from datastore based on primary key and (optionally) resets all associated objects.
 669:      *
 670:      * This will only work if the object has been saved and has a valid primary key set.
 671:      *
 672:      * @param boolean $deep (optional) Whether to also de-associated any related objects.
 673:      * @param PropelPDO $con (optional) The PropelPDO connection to use.
 674:      * @return void
 675:      * @throws PropelException - if this object is deleted, unsaved or doesn't have pk match in db
 676:      */
 677:     public function reload($deep = false, PropelPDO $con = null)
 678:     {
 679:         if ($this->isDeleted()) {
 680:             throw new PropelException("Cannot reload a deleted object.");
 681:         }
 682: 
 683:         if ($this->isNew()) {
 684:             throw new PropelException("Cannot reload an unsaved object.");
 685:         }
 686: 
 687:         if ($con === null) {
 688:             $con = Propel::getConnection(ContentPeer::DATABASE_NAME, Propel::CONNECTION_READ);
 689:         }
 690: 
 691:         // We don't need to alter the object instance pool; we're just modifying this instance
 692:         // already in the pool.
 693: 
 694:         $stmt = ContentPeer::doSelectStmt($this->buildPkeyCriteria(), $con);
 695:         $row = $stmt->fetch(PDO::FETCH_NUM);
 696:         $stmt->closeCursor();
 697:         if (!$row) {
 698:             throw new PropelException('Cannot find matching row in the database to reload object values.');
 699:         }
 700:         $this->hydrate($row, 0, true); // rehydrate
 701: 
 702:         if ($deep) {  // also de-associate any related objects?
 703: 
 704:             $this->collContentAssocs = null;
 705: 
 706:             $this->collImages = null;
 707: 
 708:             $this->collDocuments = null;
 709: 
 710:             $this->collRewritings = null;
 711: 
 712:             $this->collContentFolders = null;
 713: 
 714:             $this->collContentI18ns = null;
 715: 
 716:             $this->collContentVersions = null;
 717: 
 718:         } // if (deep)
 719:     }
 720: 
 721:     /**
 722:      * Removes this object from datastore and sets delete attribute.
 723:      *
 724:      * @param PropelPDO $con
 725:      * @return void
 726:      * @throws PropelException
 727:      * @throws Exception
 728:      * @see        BaseObject::setDeleted()
 729:      * @see        BaseObject::isDeleted()
 730:      */
 731:     public function delete(PropelPDO $con = null)
 732:     {
 733:         if ($this->isDeleted()) {
 734:             throw new PropelException("This object has already been deleted.");
 735:         }
 736: 
 737:         if ($con === null) {
 738:             $con = Propel::getConnection(ContentPeer::DATABASE_NAME, Propel::CONNECTION_WRITE);
 739:         }
 740: 
 741:         $con->beginTransaction();
 742:         try {
 743:             $deleteQuery = ContentQuery::create()
 744:                 ->filterByPrimaryKey($this->getPrimaryKey());
 745:             $ret = $this->preDelete($con);
 746:             if ($ret) {
 747:                 $deleteQuery->delete($con);
 748:                 $this->postDelete($con);
 749:                 $con->commit();
 750:                 $this->setDeleted(true);
 751:             } else {
 752:                 $con->commit();
 753:             }
 754:         } catch (Exception $e) {
 755:             $con->rollBack();
 756:             throw $e;
 757:         }
 758:     }
 759: 
 760:     /**
 761:      * Persists this object to the database.
 762:      *
 763:      * If the object is new, it inserts it; otherwise an update is performed.
 764:      * All modified related objects will also be persisted in the doSave()
 765:      * method.  This method wraps all precipitate database operations in a
 766:      * single transaction.
 767:      *
 768:      * @param PropelPDO $con
 769:      * @return int             The number of rows affected by this insert/update and any referring fk objects' save() operations.
 770:      * @throws PropelException
 771:      * @throws Exception
 772:      * @see        doSave()
 773:      */
 774:     public function save(PropelPDO $con = null)
 775:     {
 776:         if ($this->isDeleted()) {
 777:             throw new PropelException("You cannot save an object that has been deleted.");
 778:         }
 779: 
 780:         if ($con === null) {
 781:             $con = Propel::getConnection(ContentPeer::DATABASE_NAME, Propel::CONNECTION_WRITE);
 782:         }
 783: 
 784:         $con->beginTransaction();
 785:         $isInsert = $this->isNew();
 786:         try {
 787:             $ret = $this->preSave($con);
 788:             // versionable behavior
 789:             if ($this->isVersioningNecessary()) {
 790:                 $this->setVersion($this->isNew() ? 1 : $this->getLastVersionNumber($con) + 1);
 791:                 if (!$this->isColumnModified(ContentPeer::VERSION_CREATED_AT)) {
 792:                     $this->setVersionCreatedAt(time());
 793:                 }
 794:                 $createVersion = true; // for postSave hook
 795:             }
 796:             if ($isInsert) {
 797:                 $ret = $ret && $this->preInsert($con);
 798:                 // timestampable behavior
 799:                 if (!$this->isColumnModified(ContentPeer::CREATED_AT)) {
 800:                     $this->setCreatedAt(time());
 801:                 }
 802:                 if (!$this->isColumnModified(ContentPeer::UPDATED_AT)) {
 803:                     $this->setUpdatedAt(time());
 804:                 }
 805:             } else {
 806:                 $ret = $ret && $this->preUpdate($con);
 807:                 // timestampable behavior
 808:                 if ($this->isModified() && !$this->isColumnModified(ContentPeer::UPDATED_AT)) {
 809:                     $this->setUpdatedAt(time());
 810:                 }
 811:             }
 812:             if ($ret) {
 813:                 $affectedRows = $this->doSave($con);
 814:                 if ($isInsert) {
 815:                     $this->postInsert($con);
 816:                 } else {
 817:                     $this->postUpdate($con);
 818:                 }
 819:                 $this->postSave($con);
 820:                 // versionable behavior
 821:                 if (isset($createVersion)) {
 822:                     $this->addVersion($con);
 823:                 }
 824:                 ContentPeer::addInstanceToPool($this);
 825:             } else {
 826:                 $affectedRows = 0;
 827:             }
 828:             $con->commit();
 829: 
 830:             return $affectedRows;
 831:         } catch (Exception $e) {
 832:             $con->rollBack();
 833:             throw $e;
 834:         }
 835:     }
 836: 
 837:     /**
 838:      * Performs the work of inserting or updating the row in the database.
 839:      *
 840:      * If the object is new, it inserts it; otherwise an update is performed.
 841:      * All related objects are also updated in this method.
 842:      *
 843:      * @param PropelPDO $con
 844:      * @return int             The number of rows affected by this insert/update and any referring fk objects' save() operations.
 845:      * @throws PropelException
 846:      * @see        save()
 847:      */
 848:     protected function doSave(PropelPDO $con)
 849:     {
 850:         $affectedRows = 0; // initialize var to track total num of affected rows
 851:         if (!$this->alreadyInSave) {
 852:             $this->alreadyInSave = true;
 853: 
 854:             if ($this->isNew() || $this->isModified()) {
 855:                 // persist changes
 856:                 if ($this->isNew()) {
 857:                     $this->doInsert($con);
 858:                 } else {
 859:                     $this->doUpdate($con);
 860:                 }
 861:                 $affectedRows += 1;
 862:                 $this->resetModified();
 863:             }
 864: 
 865:             if ($this->contentAssocsScheduledForDeletion !== null) {
 866:                 if (!$this->contentAssocsScheduledForDeletion->isEmpty()) {
 867:                     foreach ($this->contentAssocsScheduledForDeletion as $contentAssoc) {
 868:                         // need to save related object because we set the relation to null
 869:                         $contentAssoc->save($con);
 870:                     }
 871:                     $this->contentAssocsScheduledForDeletion = null;
 872:                 }
 873:             }
 874: 
 875:             if ($this->collContentAssocs !== null) {
 876:                 foreach ($this->collContentAssocs as $referrerFK) {
 877:                     if (!$referrerFK->isDeleted()) {
 878:                         $affectedRows += $referrerFK->save($con);
 879:                     }
 880:                 }
 881:             }
 882: 
 883:             if ($this->imagesScheduledForDeletion !== null) {
 884:                 if (!$this->imagesScheduledForDeletion->isEmpty()) {
 885:                     foreach ($this->imagesScheduledForDeletion as $image) {
 886:                         // need to save related object because we set the relation to null
 887:                         $image->save($con);
 888:                     }
 889:                     $this->imagesScheduledForDeletion = null;
 890:                 }
 891:             }
 892: 
 893:             if ($this->collImages !== null) {
 894:                 foreach ($this->collImages as $referrerFK) {
 895:                     if (!$referrerFK->isDeleted()) {
 896:                         $affectedRows += $referrerFK->save($con);
 897:                     }
 898:                 }
 899:             }
 900: 
 901:             if ($this->documentsScheduledForDeletion !== null) {
 902:                 if (!$this->documentsScheduledForDeletion->isEmpty()) {
 903:                     foreach ($this->documentsScheduledForDeletion as $document) {
 904:                         // need to save related object because we set the relation to null
 905:                         $document->save($con);
 906:                     }
 907:                     $this->documentsScheduledForDeletion = null;
 908:                 }
 909:             }
 910: 
 911:             if ($this->collDocuments !== null) {
 912:                 foreach ($this->collDocuments as $referrerFK) {
 913:                     if (!$referrerFK->isDeleted()) {
 914:                         $affectedRows += $referrerFK->save($con);
 915:                     }
 916:                 }
 917:             }
 918: 
 919:             if ($this->rewritingsScheduledForDeletion !== null) {
 920:                 if (!$this->rewritingsScheduledForDeletion->isEmpty()) {
 921:                     foreach ($this->rewritingsScheduledForDeletion as $rewriting) {
 922:                         // need to save related object because we set the relation to null
 923:                         $rewriting->save($con);
 924:                     }
 925:                     $this->rewritingsScheduledForDeletion = null;
 926:                 }
 927:             }
 928: 
 929:             if ($this->collRewritings !== null) {
 930:                 foreach ($this->collRewritings as $referrerFK) {
 931:                     if (!$referrerFK->isDeleted()) {
 932:                         $affectedRows += $referrerFK->save($con);
 933:                     }
 934:                 }
 935:             }
 936: 
 937:             if ($this->contentFoldersScheduledForDeletion !== null) {
 938:                 if (!$this->contentFoldersScheduledForDeletion->isEmpty()) {
 939:                     ContentFolderQuery::create()
 940:                         ->filterByPrimaryKeys($this->contentFoldersScheduledForDeletion->getPrimaryKeys(false))
 941:                         ->delete($con);
 942:                     $this->contentFoldersScheduledForDeletion = null;
 943:                 }
 944:             }
 945: 
 946:             if ($this->collContentFolders !== null) {
 947:                 foreach ($this->collContentFolders as $referrerFK) {
 948:                     if (!$referrerFK->isDeleted()) {
 949:                         $affectedRows += $referrerFK->save($con);
 950:                     }
 951:                 }
 952:             }
 953: 
 954:             if ($this->contentI18nsScheduledForDeletion !== null) {
 955:                 if (!$this->contentI18nsScheduledForDeletion->isEmpty()) {
 956:                     ContentI18nQuery::create()
 957:                         ->filterByPrimaryKeys($this->contentI18nsScheduledForDeletion->getPrimaryKeys(false))
 958:                         ->delete($con);
 959:                     $this->contentI18nsScheduledForDeletion = null;
 960:                 }
 961:             }
 962: 
 963:             if ($this->collContentI18ns !== null) {
 964:                 foreach ($this->collContentI18ns as $referrerFK) {
 965:                     if (!$referrerFK->isDeleted()) {
 966:                         $affectedRows += $referrerFK->save($con);
 967:                     }
 968:                 }
 969:             }
 970: 
 971:             if ($this->contentVersionsScheduledForDeletion !== null) {
 972:                 if (!$this->contentVersionsScheduledForDeletion->isEmpty()) {
 973:                     ContentVersionQuery::create()
 974:                         ->filterByPrimaryKeys($this->contentVersionsScheduledForDeletion->getPrimaryKeys(false))
 975:                         ->delete($con);
 976:                     $this->contentVersionsScheduledForDeletion = null;
 977:                 }
 978:             }
 979: 
 980:             if ($this->collContentVersions !== null) {
 981:                 foreach ($this->collContentVersions as $referrerFK) {
 982:                     if (!$referrerFK->isDeleted()) {
 983:                         $affectedRows += $referrerFK->save($con);
 984:                     }
 985:                 }
 986:             }
 987: 
 988:             $this->alreadyInSave = false;
 989: 
 990:         }
 991: 
 992:         return $affectedRows;
 993:     } // doSave()
 994: 
 995:     /**
 996:      * Insert the row in the database.
 997:      *
 998:      * @param PropelPDO $con
 999:      *
1000:      * @throws PropelException
1001:      * @see        doSave()
1002:      */
1003:     protected function doInsert(PropelPDO $con)
1004:     {
1005:         $modifiedColumns = array();
1006:         $index = 0;
1007: 
1008:         $this->modifiedColumns[] = ContentPeer::ID;
1009:         if (null !== $this->id) {
1010:             throw new PropelException('Cannot insert a value for auto-increment primary key (' . ContentPeer::ID . ')');
1011:         }
1012: 
1013:          // check the columns in natural order for more readable SQL queries
1014:         if ($this->isColumnModified(ContentPeer::ID)) {
1015:             $modifiedColumns[':p' . $index++]  = '`ID`';
1016:         }
1017:         if ($this->isColumnModified(ContentPeer::VISIBLE)) {
1018:             $modifiedColumns[':p' . $index++]  = '`VISIBLE`';
1019:         }
1020:         if ($this->isColumnModified(ContentPeer::POSITION)) {
1021:             $modifiedColumns[':p' . $index++]  = '`POSITION`';
1022:         }
1023:         if ($this->isColumnModified(ContentPeer::CREATED_AT)) {
1024:             $modifiedColumns[':p' . $index++]  = '`CREATED_AT`';
1025:         }
1026:         if ($this->isColumnModified(ContentPeer::UPDATED_AT)) {
1027:             $modifiedColumns[':p' . $index++]  = '`UPDATED_AT`';
1028:         }
1029:         if ($this->isColumnModified(ContentPeer::VERSION)) {
1030:             $modifiedColumns[':p' . $index++]  = '`VERSION`';
1031:         }
1032:         if ($this->isColumnModified(ContentPeer::VERSION_CREATED_AT)) {
1033:             $modifiedColumns[':p' . $index++]  = '`VERSION_CREATED_AT`';
1034:         }
1035:         if ($this->isColumnModified(ContentPeer::VERSION_CREATED_BY)) {
1036:             $modifiedColumns[':p' . $index++]  = '`VERSION_CREATED_BY`';
1037:         }
1038: 
1039:         $sql = sprintf(
1040:             'INSERT INTO `content` (%s) VALUES (%s)',
1041:             implode(', ', $modifiedColumns),
1042:             implode(', ', array_keys($modifiedColumns))
1043:         );
1044: 
1045:         try {
1046:             $stmt = $con->prepare($sql);
1047:             foreach ($modifiedColumns as $identifier => $columnName) {
1048:                 switch ($columnName) {
1049:                     case '`ID`':
1050:                         $stmt->bindValue($identifier, $this->id, PDO::PARAM_INT);
1051:                         break;
1052:                     case '`VISIBLE`':
1053:                         $stmt->bindValue($identifier, $this->visible, PDO::PARAM_INT);
1054:                         break;
1055:                     case '`POSITION`':
1056:                         $stmt->bindValue($identifier, $this->position, PDO::PARAM_INT);
1057:                         break;
1058:                     case '`CREATED_AT`':
1059:                         $stmt->bindValue($identifier, $this->created_at, PDO::PARAM_STR);
1060:                         break;
1061:                     case '`UPDATED_AT`':
1062:                         $stmt->bindValue($identifier, $this->updated_at, PDO::PARAM_STR);
1063:                         break;
1064:                     case '`VERSION`':
1065:                         $stmt->bindValue($identifier, $this->version, PDO::PARAM_INT);
1066:                         break;
1067:                     case '`VERSION_CREATED_AT`':
1068:                         $stmt->bindValue($identifier, $this->version_created_at, PDO::PARAM_STR);
1069:                         break;
1070:                     case '`VERSION_CREATED_BY`':
1071:                         $stmt->bindValue($identifier, $this->version_created_by, PDO::PARAM_STR);
1072:                         break;
1073:                 }
1074:             }
1075:             $stmt->execute();
1076:         } catch (Exception $e) {
1077:             Propel::log($e->getMessage(), Propel::LOG_ERR);
1078:             throw new PropelException(sprintf('Unable to execute INSERT statement [%s]', $sql), $e);
1079:         }
1080: 
1081:         try {
1082:             $pk = $con->lastInsertId();
1083:         } catch (Exception $e) {
1084:             throw new PropelException('Unable to get autoincrement id.', $e);
1085:         }
1086:         $this->setId($pk);
1087: 
1088:         $this->setNew(false);
1089:     }
1090: 
1091:     /**
1092:      * Update the row in the database.
1093:      *
1094:      * @param PropelPDO $con
1095:      *
1096:      * @see        doSave()
1097:      */
1098:     protected function doUpdate(PropelPDO $con)
1099:     {
1100:         $selectCriteria = $this->buildPkeyCriteria();
1101:         $valuesCriteria = $this->buildCriteria();
1102:         BasePeer::doUpdate($selectCriteria, $valuesCriteria, $con);
1103:     }
1104: 
1105:     /**
1106:      * Array of ValidationFailed objects.
1107:      * @var        array ValidationFailed[]
1108:      */
1109:     protected $validationFailures = array();
1110: 
1111:     /**
1112:      * Gets any ValidationFailed objects that resulted from last call to validate().
1113:      *
1114:      *
1115:      * @return array ValidationFailed[]
1116:      * @see        validate()
1117:      */
1118:     public function getValidationFailures()
1119:     {
1120:         return $this->validationFailures;
1121:     }
1122: 
1123:     /**
1124:      * Validates the objects modified field values and all objects related to this table.
1125:      *
1126:      * If $columns is either a column name or an array of column names
1127:      * only those columns are validated.
1128:      *
1129:      * @param mixed $columns Column name or an array of column names.
1130:      * @return boolean Whether all columns pass validation.
1131:      * @see        doValidate()
1132:      * @see        getValidationFailures()
1133:      */
1134:     public function validate($columns = null)
1135:     {
1136:         $res = $this->doValidate($columns);
1137:         if ($res === true) {
1138:             $this->validationFailures = array();
1139: 
1140:             return true;
1141:         } else {
1142:             $this->validationFailures = $res;
1143: 
1144:             return false;
1145:         }
1146:     }
1147: 
1148:     /**
1149:      * This function performs the validation work for complex object models.
1150:      *
1151:      * In addition to checking the current object, all related objects will
1152:      * also be validated.  If all pass then <code>true</code> is returned; otherwise
1153:      * an aggreagated array of ValidationFailed objects will be returned.
1154:      *
1155:      * @param array $columns Array of column names to validate.
1156:      * @return mixed <code>true</code> if all validations pass; array of <code>ValidationFailed</code> objets otherwise.
1157:      */
1158:     protected function doValidate($columns = null)
1159:     {
1160:         if (!$this->alreadyInValidation) {
1161:             $this->alreadyInValidation = true;
1162:             $retval = null;
1163: 
1164:             $failureMap = array();
1165: 
1166: 
1167:             if (($retval = ContentPeer::doValidate($this, $columns)) !== true) {
1168:                 $failureMap = array_merge($failureMap, $retval);
1169:             }
1170: 
1171: 
1172:                 if ($this->collContentAssocs !== null) {
1173:                     foreach ($this->collContentAssocs as $referrerFK) {
1174:                         if (!$referrerFK->validate($columns)) {
1175:                             $failureMap = array_merge($failureMap, $referrerFK->getValidationFailures());
1176:                         }
1177:                     }
1178:                 }
1179: 
1180:                 if ($this->collImages !== null) {
1181:                     foreach ($this->collImages as $referrerFK) {
1182:                         if (!$referrerFK->validate($columns)) {
1183:                             $failureMap = array_merge($failureMap, $referrerFK->getValidationFailures());
1184:                         }
1185:                     }
1186:                 }
1187: 
1188:                 if ($this->collDocuments !== null) {
1189:                     foreach ($this->collDocuments as $referrerFK) {
1190:                         if (!$referrerFK->validate($columns)) {
1191:                             $failureMap = array_merge($failureMap, $referrerFK->getValidationFailures());
1192:                         }
1193:                     }
1194:                 }
1195: 
1196:                 if ($this->collRewritings !== null) {
1197:                     foreach ($this->collRewritings as $referrerFK) {
1198:                         if (!$referrerFK->validate($columns)) {
1199:                             $failureMap = array_merge($failureMap, $referrerFK->getValidationFailures());
1200:                         }
1201:                     }
1202:                 }
1203: 
1204:                 if ($this->collContentFolders !== null) {
1205:                     foreach ($this->collContentFolders as $referrerFK) {
1206:                         if (!$referrerFK->validate($columns)) {
1207:                             $failureMap = array_merge($failureMap, $referrerFK->getValidationFailures());
1208:                         }
1209:                     }
1210:                 }
1211: 
1212:                 if ($this->collContentI18ns !== null) {
1213:                     foreach ($this->collContentI18ns as $referrerFK) {
1214:                         if (!$referrerFK->validate($columns)) {
1215:                             $failureMap = array_merge($failureMap, $referrerFK->getValidationFailures());
1216:                         }
1217:                     }
1218:                 }
1219: 
1220:                 if ($this->collContentVersions !== null) {
1221:                     foreach ($this->collContentVersions as $referrerFK) {
1222:                         if (!$referrerFK->validate($columns)) {
1223:                             $failureMap = array_merge($failureMap, $referrerFK->getValidationFailures());
1224:                         }
1225:                     }
1226:                 }
1227: 
1228: 
1229:             $this->alreadyInValidation = false;
1230:         }
1231: 
1232:         return (!empty($failureMap) ? $failureMap : true);
1233:     }
1234: 
1235:     /**
1236:      * Retrieves a field from the object by name passed in as a string.
1237:      *
1238:      * @param string $name name
1239:      * @param string $type The type of fieldname the $name is of:
1240:      *               one of the class type constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME
1241:      *               BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM.
1242:      *               Defaults to BasePeer::TYPE_PHPNAME
1243:      * @return mixed Value of field.
1244:      */
1245:     public function getByName($name, $type = BasePeer::TYPE_PHPNAME)
1246:     {
1247:         $pos = ContentPeer::translateFieldName($name, $type, BasePeer::TYPE_NUM);
1248:         $field = $this->getByPosition($pos);
1249: 
1250:         return $field;
1251:     }
1252: 
1253:     /**
1254:      * Retrieves a field from the object by Position as specified in the xml schema.
1255:      * Zero-based.
1256:      *
1257:      * @param int $pos position in xml schema
1258:      * @return mixed Value of field at $pos
1259:      */
1260:     public function getByPosition($pos)
1261:     {
1262:         switch ($pos) {
1263:             case 0:
1264:                 return $this->getId();
1265:                 break;
1266:             case 1:
1267:                 return $this->getVisible();
1268:                 break;
1269:             case 2:
1270:                 return $this->getPosition();
1271:                 break;
1272:             case 3:
1273:                 return $this->getCreatedAt();
1274:                 break;
1275:             case 4:
1276:                 return $this->getUpdatedAt();
1277:                 break;
1278:             case 5:
1279:                 return $this->getVersion();
1280:                 break;
1281:             case 6:
1282:                 return $this->getVersionCreatedAt();
1283:                 break;
1284:             case 7:
1285:                 return $this->getVersionCreatedBy();
1286:                 break;
1287:             default:
1288:                 return null;
1289:                 break;
1290:         } // switch()
1291:     }
1292: 
1293:     /**
1294:      * Exports the object as an array.
1295:      *
1296:      * You can specify the key type of the array by passing one of the class
1297:      * type constants.
1298:      *
1299:      * @param     string  $keyType (optional) One of the class type constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME,
1300:      *                    BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM.
1301:      *                    Defaults to BasePeer::TYPE_PHPNAME.
1302:      * @param     boolean $includeLazyLoadColumns (optional) Whether to include lazy loaded columns. Defaults to true.
1303:      * @param     array $alreadyDumpedObjects List of objects to skip to avoid recursion
1304:      * @param     boolean $includeForeignObjects (optional) Whether to include hydrated related objects. Default to FALSE.
1305:      *
1306:      * @return array an associative array containing the field names (as keys) and field values
1307:      */
1308:     public function toArray($keyType = BasePeer::TYPE_PHPNAME, $includeLazyLoadColumns = true, $alreadyDumpedObjects = array(), $includeForeignObjects = false)
1309:     {
1310:         if (isset($alreadyDumpedObjects['Content'][$this->getPrimaryKey()])) {
1311:             return '*RECURSION*';
1312:         }
1313:         $alreadyDumpedObjects['Content'][$this->getPrimaryKey()] = true;
1314:         $keys = ContentPeer::getFieldNames($keyType);
1315:         $result = array(
1316:             $keys[0] => $this->getId(),
1317:             $keys[1] => $this->getVisible(),
1318:             $keys[2] => $this->getPosition(),
1319:             $keys[3] => $this->getCreatedAt(),
1320:             $keys[4] => $this->getUpdatedAt(),
1321:             $keys[5] => $this->getVersion(),
1322:             $keys[6] => $this->getVersionCreatedAt(),
1323:             $keys[7] => $this->getVersionCreatedBy(),
1324:         );
1325:         if ($includeForeignObjects) {
1326:             if (null !== $this->collContentAssocs) {
1327:                 $result['ContentAssocs'] = $this->collContentAssocs->toArray(null, true, $keyType, $includeLazyLoadColumns, $alreadyDumpedObjects);
1328:             }
1329:             if (null !== $this->collImages) {
1330:                 $result['Images'] = $this->collImages->toArray(null, true, $keyType, $includeLazyLoadColumns, $alreadyDumpedObjects);
1331:             }
1332:             if (null !== $this->collDocuments) {
1333:                 $result['Documents'] = $this->collDocuments->toArray(null, true, $keyType, $includeLazyLoadColumns, $alreadyDumpedObjects);
1334:             }
1335:             if (null !== $this->collRewritings) {
1336:                 $result['Rewritings'] = $this->collRewritings->toArray(null, true, $keyType, $includeLazyLoadColumns, $alreadyDumpedObjects);
1337:             }
1338:             if (null !== $this->collContentFolders) {
1339:                 $result['ContentFolders'] = $this->collContentFolders->toArray(null, true, $keyType, $includeLazyLoadColumns, $alreadyDumpedObjects);
1340:             }
1341:             if (null !== $this->collContentI18ns) {
1342:                 $result['ContentI18ns'] = $this->collContentI18ns->toArray(null, true, $keyType, $includeLazyLoadColumns, $alreadyDumpedObjects);
1343:             }
1344:             if (null !== $this->collContentVersions) {
1345:                 $result['ContentVersions'] = $this->collContentVersions->toArray(null, true, $keyType, $includeLazyLoadColumns, $alreadyDumpedObjects);
1346:             }
1347:         }
1348: 
1349:         return $result;
1350:     }
1351: 
1352:     /**
1353:      * Sets a field from the object by name passed in as a string.
1354:      *
1355:      * @param string $name peer name
1356:      * @param mixed $value field value
1357:      * @param string $type The type of fieldname the $name is of:
1358:      *                     one of the class type constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME
1359:      *                     BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM.
1360:      *                     Defaults to BasePeer::TYPE_PHPNAME
1361:      * @return void
1362:      */
1363:     public function setByName($name, $value, $type = BasePeer::TYPE_PHPNAME)
1364:     {
1365:         $pos = ContentPeer::translateFieldName($name, $type, BasePeer::TYPE_NUM);
1366: 
1367:         $this->setByPosition($pos, $value);
1368:     }
1369: 
1370:     /**
1371:      * Sets a field from the object by Position as specified in the xml schema.
1372:      * Zero-based.
1373:      *
1374:      * @param int $pos position in xml schema
1375:      * @param mixed $value field value
1376:      * @return void
1377:      */
1378:     public function setByPosition($pos, $value)
1379:     {
1380:         switch ($pos) {
1381:             case 0:
1382:                 $this->setId($value);
1383:                 break;
1384:             case 1:
1385:                 $this->setVisible($value);
1386:                 break;
1387:             case 2:
1388:                 $this->setPosition($value);
1389:                 break;
1390:             case 3:
1391:                 $this->setCreatedAt($value);
1392:                 break;
1393:             case 4:
1394:                 $this->setUpdatedAt($value);
1395:                 break;
1396:             case 5:
1397:                 $this->setVersion($value);
1398:                 break;
1399:             case 6:
1400:                 $this->setVersionCreatedAt($value);
1401:                 break;
1402:             case 7:
1403:                 $this->setVersionCreatedBy($value);
1404:                 break;
1405:         } // switch()
1406:     }
1407: 
1408:     /**
1409:      * Populates the object using an array.
1410:      *
1411:      * This is particularly useful when populating an object from one of the
1412:      * request arrays (e.g. $_POST).  This method goes through the column
1413:      * names, checking to see whether a matching key exists in populated
1414:      * array. If so the setByName() method is called for that column.
1415:      *
1416:      * You can specify the key type of the array by additionally passing one
1417:      * of the class type constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME,
1418:      * BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM.
1419:      * The default key type is the column's BasePeer::TYPE_PHPNAME
1420:      *
1421:      * @param array  $arr     An array to populate the object from.
1422:      * @param string $keyType The type of keys the array uses.
1423:      * @return void
1424:      */
1425:     public function fromArray($arr, $keyType = BasePeer::TYPE_PHPNAME)
1426:     {
1427:         $keys = ContentPeer::getFieldNames($keyType);
1428: 
1429:         if (array_key_exists($keys[0], $arr)) $this->setId($arr[$keys[0]]);
1430:         if (array_key_exists($keys[1], $arr)) $this->setVisible($arr[$keys[1]]);
1431:         if (array_key_exists($keys[2], $arr)) $this->setPosition($arr[$keys[2]]);
1432:         if (array_key_exists($keys[3], $arr)) $this->setCreatedAt($arr[$keys[3]]);
1433:         if (array_key_exists($keys[4], $arr)) $this->setUpdatedAt($arr[$keys[4]]);
1434:         if (array_key_exists($keys[5], $arr)) $this->setVersion($arr[$keys[5]]);
1435:         if (array_key_exists($keys[6], $arr)) $this->setVersionCreatedAt($arr[$keys[6]]);
1436:         if (array_key_exists($keys[7], $arr)) $this->setVersionCreatedBy($arr[$keys[7]]);
1437:     }
1438: 
1439:     /**
1440:      * Build a Criteria object containing the values of all modified columns in this object.
1441:      *
1442:      * @return Criteria The Criteria object containing all modified values.
1443:      */
1444:     public function buildCriteria()
1445:     {
1446:         $criteria = new Criteria(ContentPeer::DATABASE_NAME);
1447: 
1448:         if ($this->isColumnModified(ContentPeer::ID)) $criteria->add(ContentPeer::ID, $this->id);
1449:         if ($this->isColumnModified(ContentPeer::VISIBLE)) $criteria->add(ContentPeer::VISIBLE, $this->visible);
1450:         if ($this->isColumnModified(ContentPeer::POSITION)) $criteria->add(ContentPeer::POSITION, $this->position);
1451:         if ($this->isColumnModified(ContentPeer::CREATED_AT)) $criteria->add(ContentPeer::CREATED_AT, $this->created_at);
1452:         if ($this->isColumnModified(ContentPeer::UPDATED_AT)) $criteria->add(ContentPeer::UPDATED_AT, $this->updated_at);
1453:         if ($this->isColumnModified(ContentPeer::VERSION)) $criteria->add(ContentPeer::VERSION, $this->version);
1454:         if ($this->isColumnModified(ContentPeer::VERSION_CREATED_AT)) $criteria->add(ContentPeer::VERSION_CREATED_AT, $this->version_created_at);
1455:         if ($this->isColumnModified(ContentPeer::VERSION_CREATED_BY)) $criteria->add(ContentPeer::VERSION_CREATED_BY, $this->version_created_by);
1456: 
1457:         return $criteria;
1458:     }
1459: 
1460:     /**
1461:      * Builds a Criteria object containing the primary key for this object.
1462:      *
1463:      * Unlike buildCriteria() this method includes the primary key values regardless
1464:      * of whether or not they have been modified.
1465:      *
1466:      * @return Criteria The Criteria object containing value(s) for primary key(s).
1467:      */
1468:     public function buildPkeyCriteria()
1469:     {
1470:         $criteria = new Criteria(ContentPeer::DATABASE_NAME);
1471:         $criteria->add(ContentPeer::ID, $this->id);
1472: 
1473:         return $criteria;
1474:     }
1475: 
1476:     /**
1477:      * Returns the primary key for this object (row).
1478:      * @return int
1479:      */
1480:     public function getPrimaryKey()
1481:     {
1482:         return $this->getId();
1483:     }
1484: 
1485:     /**
1486:      * Generic method to set the primary key (id column).
1487:      *
1488:      * @param  int $key Primary key.
1489:      * @return void
1490:      */
1491:     public function setPrimaryKey($key)
1492:     {
1493:         $this->setId($key);
1494:     }
1495: 
1496:     /**
1497:      * Returns true if the primary key for this object is null.
1498:      * @return boolean
1499:      */
1500:     public function isPrimaryKeyNull()
1501:     {
1502: 
1503:         return null === $this->getId();
1504:     }
1505: 
1506:     /**
1507:      * Sets contents of passed object to values from current object.
1508:      *
1509:      * If desired, this method can also make copies of all associated (fkey referrers)
1510:      * objects.
1511:      *
1512:      * @param object $copyObj An object of Content (or compatible) type.
1513:      * @param boolean $deepCopy Whether to also copy all rows that refer (by fkey) to the current row.
1514:      * @param boolean $makeNew Whether to reset autoincrement PKs and make the object new.
1515:      * @throws PropelException
1516:      */
1517:     public function copyInto($copyObj, $deepCopy = false, $makeNew = true)
1518:     {
1519:         $copyObj->setVisible($this->getVisible());
1520:         $copyObj->setPosition($this->getPosition());
1521:         $copyObj->setCreatedAt($this->getCreatedAt());
1522:         $copyObj->setUpdatedAt($this->getUpdatedAt());
1523:         $copyObj->setVersion($this->getVersion());
1524:         $copyObj->setVersionCreatedAt($this->getVersionCreatedAt());
1525:         $copyObj->setVersionCreatedBy($this->getVersionCreatedBy());
1526: 
1527:         if ($deepCopy && !$this->startCopy) {
1528:             // important: temporarily setNew(false) because this affects the behavior of
1529:             // the getter/setter methods for fkey referrer objects.
1530:             $copyObj->setNew(false);
1531:             // store object hash to prevent cycle
1532:             $this->startCopy = true;
1533: 
1534:             foreach ($this->getContentAssocs() as $relObj) {
1535:                 if ($relObj !== $this) {  // ensure that we don't try to copy a reference to ourselves
1536:                     $copyObj->addContentAssoc($relObj->copy($deepCopy));
1537:                 }
1538:             }
1539: 
1540:             foreach ($this->getImages() as $relObj) {
1541:                 if ($relObj !== $this) {  // ensure that we don't try to copy a reference to ourselves
1542:                     $copyObj->addImage($relObj->copy($deepCopy));
1543:                 }
1544:             }
1545: 
1546:             foreach ($this->getDocuments() as $relObj) {
1547:                 if ($relObj !== $this) {  // ensure that we don't try to copy a reference to ourselves
1548:                     $copyObj->addDocument($relObj->copy($deepCopy));
1549:                 }
1550:             }
1551: 
1552:             foreach ($this->getRewritings() as $relObj) {
1553:                 if ($relObj !== $this) {  // ensure that we don't try to copy a reference to ourselves
1554:                     $copyObj->addRewriting($relObj->copy($deepCopy));
1555:                 }
1556:             }
1557: 
1558:             foreach ($this->getContentFolders() as $relObj) {
1559:                 if ($relObj !== $this) {  // ensure that we don't try to copy a reference to ourselves
1560:                     $copyObj->addContentFolder($relObj->copy($deepCopy));
1561:                 }
1562:             }
1563: 
1564:             foreach ($this->getContentI18ns() as $relObj) {
1565:                 if ($relObj !== $this) {  // ensure that we don't try to copy a reference to ourselves
1566:                     $copyObj->addContentI18n($relObj->copy($deepCopy));
1567:                 }
1568:             }
1569: 
1570:             foreach ($this->getContentVersions() as $relObj) {
1571:                 if ($relObj !== $this) {  // ensure that we don't try to copy a reference to ourselves
1572:                     $copyObj->addContentVersion($relObj->copy($deepCopy));
1573:                 }
1574:             }
1575: 
1576:             //unflag object copy
1577:             $this->startCopy = false;
1578:         } // if ($deepCopy)
1579: 
1580:         if ($makeNew) {
1581:             $copyObj->setNew(true);
1582:             $copyObj->setId(NULL); // this is a auto-increment column, so set to default value
1583:         }
1584:     }
1585: 
1586:     /**
1587:      * Makes a copy of this object that will be inserted as a new row in table when saved.
1588:      * It creates a new object filling in the simple attributes, but skipping any primary
1589:      * keys that are defined for the table.
1590:      *
1591:      * If desired, this method can also make copies of all associated (fkey referrers)
1592:      * objects.
1593:      *
1594:      * @param boolean $deepCopy Whether to also copy all rows that refer (by fkey) to the current row.
1595:      * @return Content Clone of current object.
1596:      * @throws PropelException
1597:      */
1598:     public function copy($deepCopy = false)
1599:     {
1600:         // we use get_class(), because this might be a subclass
1601:         $clazz = get_class($this);
1602:         $copyObj = new $clazz();
1603:         $this->copyInto($copyObj, $deepCopy);
1604: 
1605:         return $copyObj;
1606:     }
1607: 
1608:     /**
1609:      * Returns a peer instance associated with this om.
1610:      *
1611:      * Since Peer classes are not to have any instance attributes, this method returns the
1612:      * same instance for all member of this class. The method could therefore
1613:      * be static, but this would prevent one from overriding the behavior.
1614:      *
1615:      * @return ContentPeer
1616:      */
1617:     public function getPeer()
1618:     {
1619:         if (self::$peer === null) {
1620:             self::$peer = new ContentPeer();
1621:         }
1622: 
1623:         return self::$peer;
1624:     }
1625: 
1626: 
1627:     /**
1628:      * Initializes a collection based on the name of a relation.
1629:      * Avoids crafting an 'init[$relationName]s' method name
1630:      * that wouldn't work when StandardEnglishPluralizer is used.
1631:      *
1632:      * @param string $relationName The name of the relation to initialize
1633:      * @return void
1634:      */
1635:     public function initRelation($relationName)
1636:     {
1637:         if ('ContentAssoc' == $relationName) {
1638:             $this->initContentAssocs();
1639:         }
1640:         if ('Image' == $relationName) {
1641:             $this->initImages();
1642:         }
1643:         if ('Document' == $relationName) {
1644:             $this->initDocuments();
1645:         }
1646:         if ('Rewriting' == $relationName) {
1647:             $this->initRewritings();
1648:         }
1649:         if ('ContentFolder' == $relationName) {
1650:             $this->initContentFolders();
1651:         }
1652:         if ('ContentI18n' == $relationName) {
1653:             $this->initContentI18ns();
1654:         }
1655:         if ('ContentVersion' == $relationName) {
1656:             $this->initContentVersions();
1657:         }
1658:     }
1659: 
1660:     /**
1661:      * Clears out the collContentAssocs collection
1662:      *
1663:      * This does not modify the database; however, it will remove any associated objects, causing
1664:      * them to be refetched by subsequent calls to accessor method.
1665:      *
1666:      * @return void
1667:      * @see        addContentAssocs()
1668:      */
1669:     public function clearContentAssocs()
1670:     {
1671:         $this->collContentAssocs = null; // important to set this to null since that means it is uninitialized
1672:         $this->collContentAssocsPartial = null;
1673:     }
1674: 
1675:     /**
1676:      * reset is the collContentAssocs collection loaded partially
1677:      *
1678:      * @return void
1679:      */
1680:     public function resetPartialContentAssocs($v = true)
1681:     {
1682:         $this->collContentAssocsPartial = $v;
1683:     }
1684: 
1685:     /**
1686:      * Initializes the collContentAssocs collection.
1687:      *
1688:      * By default this just sets the collContentAssocs collection to an empty array (like clearcollContentAssocs());
1689:      * however, you may wish to override this method in your stub class to provide setting appropriate
1690:      * to your application -- for example, setting the initial array to the values stored in database.
1691:      *
1692:      * @param boolean $overrideExisting If set to true, the method call initializes
1693:      *                                        the collection even if it is not empty
1694:      *
1695:      * @return void
1696:      */
1697:     public function initContentAssocs($overrideExisting = true)
1698:     {
1699:         if (null !== $this->collContentAssocs && !$overrideExisting) {
1700:             return;
1701:         }
1702:         $this->collContentAssocs = new PropelObjectCollection();
1703:         $this->collContentAssocs->setModel('ContentAssoc');
1704:     }
1705: 
1706:     /**
1707:      * Gets an array of ContentAssoc objects which contain a foreign key that references this object.
1708:      *
1709:      * If the $criteria is not null, it is used to always fetch the results from the database.
1710:      * Otherwise the results are fetched from the database the first time, then cached.
1711:      * Next time the same method is called without $criteria, the cached collection is returned.
1712:      * If this Content is new, it will return
1713:      * an empty collection or the current collection; the criteria is ignored on a new object.
1714:      *
1715:      * @param Criteria $criteria optional Criteria object to narrow the query
1716:      * @param PropelPDO $con optional connection object
1717:      * @return PropelObjectCollection|ContentAssoc[] List of ContentAssoc objects
1718:      * @throws PropelException
1719:      */
1720:     public function getContentAssocs($criteria = null, PropelPDO $con = null)
1721:     {
1722:         $partial = $this->collContentAssocsPartial && !$this->isNew();
1723:         if (null === $this->collContentAssocs || null !== $criteria  || $partial) {
1724:             if ($this->isNew() && null === $this->collContentAssocs) {
1725:                 // return empty collection
1726:                 $this->initContentAssocs();
1727:             } else {
1728:                 $collContentAssocs = ContentAssocQuery::create(null, $criteria)
1729:                     ->filterByContent($this)
1730:                     ->find($con);
1731:                 if (null !== $criteria) {
1732:                     if (false !== $this->collContentAssocsPartial && count($collContentAssocs)) {
1733:                       $this->initContentAssocs(false);
1734: 
1735:                       foreach($collContentAssocs as $obj) {
1736:                         if (false == $this->collContentAssocs->contains($obj)) {
1737:                           $this->collContentAssocs->append($obj);
1738:                         }
1739:                       }
1740: 
1741:                       $this->collContentAssocsPartial = true;
1742:                     }
1743: 
1744:                     return $collContentAssocs;
1745:                 }
1746: 
1747:                 if($partial && $this->collContentAssocs) {
1748:                     foreach($this->collContentAssocs as $obj) {
1749:                         if($obj->isNew()) {
1750:                             $collContentAssocs[] = $obj;
1751:                         }
1752:                     }
1753:                 }
1754: 
1755:                 $this->collContentAssocs = $collContentAssocs;
1756:                 $this->collContentAssocsPartial = false;
1757:             }
1758:         }
1759: 
1760:         return $this->collContentAssocs;
1761:     }
1762: 
1763:     /**
1764:      * Sets a collection of ContentAssoc objects related by a one-to-many relationship
1765:      * to the current object.
1766:      * It will also schedule objects for deletion based on a diff between old objects (aka persisted)
1767:      * and new objects from the given Propel collection.
1768:      *
1769:      * @param PropelCollection $contentAssocs A Propel collection.
1770:      * @param PropelPDO $con Optional connection object
1771:      */
1772:     public function setContentAssocs(PropelCollection $contentAssocs, PropelPDO $con = null)
1773:     {
1774:         $this->contentAssocsScheduledForDeletion = $this->getContentAssocs(new Criteria(), $con)->diff($contentAssocs);
1775: 
1776:         foreach ($this->contentAssocsScheduledForDeletion as $contentAssocRemoved) {
1777:             $contentAssocRemoved->setContent(null);
1778:         }
1779: 
1780:         $this->collContentAssocs = null;
1781:         foreach ($contentAssocs as $contentAssoc) {
1782:             $this->addContentAssoc($contentAssoc);
1783:         }
1784: 
1785:         $this->collContentAssocs = $contentAssocs;
1786:         $this->collContentAssocsPartial = false;
1787:     }
1788: 
1789:     /**
1790:      * Returns the number of related ContentAssoc objects.
1791:      *
1792:      * @param Criteria $criteria
1793:      * @param boolean $distinct
1794:      * @param PropelPDO $con
1795:      * @return int             Count of related ContentAssoc objects.
1796:      * @throws PropelException
1797:      */
1798:     public function countContentAssocs(Criteria $criteria = null, $distinct = false, PropelPDO $con = null)
1799:     {
1800:         $partial = $this->collContentAssocsPartial && !$this->isNew();
1801:         if (null === $this->collContentAssocs || null !== $criteria || $partial) {
1802:             if ($this->isNew() && null === $this->collContentAssocs) {
1803:                 return 0;
1804:             } else {
1805:                 if($partial && !$criteria) {
1806:                     return count($this->getContentAssocs());
1807:                 }
1808:                 $query = ContentAssocQuery::create(null, $criteria);
1809:                 if ($distinct) {
1810:                     $query->distinct();
1811:                 }
1812: 
1813:                 return $query
1814:                     ->filterByContent($this)
1815:                     ->count($con);
1816:             }
1817:         } else {
1818:             return count($this->collContentAssocs);
1819:         }
1820:     }
1821: 
1822:     /**
1823:      * Method called to associate a ContentAssoc object to this object
1824:      * through the ContentAssoc foreign key attribute.
1825:      *
1826:      * @param    ContentAssoc $l ContentAssoc
1827:      * @return Content The current object (for fluent API support)
1828:      */
1829:     public function addContentAssoc(ContentAssoc $l)
1830:     {
1831:         if ($this->collContentAssocs === null) {
1832:             $this->initContentAssocs();
1833:             $this->collContentAssocsPartial = true;
1834:         }
1835:         if (!$this->collContentAssocs->contains($l)) { // only add it if the **same** object is not already associated
1836:             $this->doAddContentAssoc($l);
1837:         }
1838: 
1839:         return $this;
1840:     }
1841: 
1842:     /**
1843:      * @param   ContentAssoc $contentAssoc The contentAssoc object to add.
1844:      */
1845:     protected function doAddContentAssoc($contentAssoc)
1846:     {
1847:         $this->collContentAssocs[]= $contentAssoc;
1848:         $contentAssoc->setContent($this);
1849:     }
1850: 
1851:     /**
1852:      * @param   ContentAssoc $contentAssoc The contentAssoc object to remove.
1853:      */
1854:     public function removeContentAssoc($contentAssoc)
1855:     {
1856:         if ($this->getContentAssocs()->contains($contentAssoc)) {
1857:             $this->collContentAssocs->remove($this->collContentAssocs->search($contentAssoc));
1858:             if (null === $this->contentAssocsScheduledForDeletion) {
1859:                 $this->contentAssocsScheduledForDeletion = clone $this->collContentAssocs;
1860:                 $this->contentAssocsScheduledForDeletion->clear();
1861:             }
1862:             $this->contentAssocsScheduledForDeletion[]= $contentAssoc;
1863:             $contentAssoc->setContent(null);
1864:         }
1865:     }
1866: 
1867: 
1868:     /**
1869:      * If this collection has already been initialized with
1870:      * an identical criteria, it returns the collection.
1871:      * Otherwise if this Content is new, it will return
1872:      * an empty collection; or if this Content has previously
1873:      * been saved, it will retrieve related ContentAssocs from storage.
1874:      *
1875:      * This method is protected by default in order to keep the public
1876:      * api reasonable.  You can provide public methods for those you
1877:      * actually need in Content.
1878:      *
1879:      * @param Criteria $criteria optional Criteria object to narrow the query
1880:      * @param PropelPDO $con optional connection object
1881:      * @param string $join_behavior optional join type to use (defaults to Criteria::LEFT_JOIN)
1882:      * @return PropelObjectCollection|ContentAssoc[] List of ContentAssoc objects
1883:      */
1884:     public function getContentAssocsJoinCategory($criteria = null, $con = null, $join_behavior = Criteria::LEFT_JOIN)
1885:     {
1886:         $query = ContentAssocQuery::create(null, $criteria);
1887:         $query->joinWith('Category', $join_behavior);
1888: 
1889:         return $this->getContentAssocs($query, $con);
1890:     }
1891: 
1892: 
1893:     /**
1894:      * If this collection has already been initialized with
1895:      * an identical criteria, it returns the collection.
1896:      * Otherwise if this Content is new, it will return
1897:      * an empty collection; or if this Content has previously
1898:      * been saved, it will retrieve related ContentAssocs from storage.
1899:      *
1900:      * This method is protected by default in order to keep the public
1901:      * api reasonable.  You can provide public methods for those you
1902:      * actually need in Content.
1903:      *
1904:      * @param Criteria $criteria optional Criteria object to narrow the query
1905:      * @param PropelPDO $con optional connection object
1906:      * @param string $join_behavior optional join type to use (defaults to Criteria::LEFT_JOIN)
1907:      * @return PropelObjectCollection|ContentAssoc[] List of ContentAssoc objects
1908:      */
1909:     public function getContentAssocsJoinProduct($criteria = null, $con = null, $join_behavior = Criteria::LEFT_JOIN)
1910:     {
1911:         $query = ContentAssocQuery::create(null, $criteria);
1912:         $query->joinWith('Product', $join_behavior);
1913: 
1914:         return $this->getContentAssocs($query, $con);
1915:     }
1916: 
1917:     /**
1918:      * Clears out the collImages collection
1919:      *
1920:      * This does not modify the database; however, it will remove any associated objects, causing
1921:      * them to be refetched by subsequent calls to accessor method.
1922:      *
1923:      * @return void
1924:      * @see        addImages()
1925:      */
1926:     public function clearImages()
1927:     {
1928:         $this->collImages = null; // important to set this to null since that means it is uninitialized
1929:         $this->collImagesPartial = null;
1930:     }
1931: 
1932:     /**
1933:      * reset is the collImages collection loaded partially
1934:      *
1935:      * @return void
1936:      */
1937:     public function resetPartialImages($v = true)
1938:     {
1939:         $this->collImagesPartial = $v;
1940:     }
1941: 
1942:     /**
1943:      * Initializes the collImages collection.
1944:      *
1945:      * By default this just sets the collImages collection to an empty array (like clearcollImages());
1946:      * however, you may wish to override this method in your stub class to provide setting appropriate
1947:      * to your application -- for example, setting the initial array to the values stored in database.
1948:      *
1949:      * @param boolean $overrideExisting If set to true, the method call initializes
1950:      *                                        the collection even if it is not empty
1951:      *
1952:      * @return void
1953:      */
1954:     public function initImages($overrideExisting = true)
1955:     {
1956:         if (null !== $this->collImages && !$overrideExisting) {
1957:             return;
1958:         }
1959:         $this->collImages = new PropelObjectCollection();
1960:         $this->collImages->setModel('Image');
1961:     }
1962: 
1963:     /**
1964:      * Gets an array of Image objects which contain a foreign key that references this object.
1965:      *
1966:      * If the $criteria is not null, it is used to always fetch the results from the database.
1967:      * Otherwise the results are fetched from the database the first time, then cached.
1968:      * Next time the same method is called without $criteria, the cached collection is returned.
1969:      * If this Content is new, it will return
1970:      * an empty collection or the current collection; the criteria is ignored on a new object.
1971:      *
1972:      * @param Criteria $criteria optional Criteria object to narrow the query
1973:      * @param PropelPDO $con optional connection object
1974:      * @return PropelObjectCollection|Image[] List of Image objects
1975:      * @throws PropelException
1976:      */
1977:     public function getImages($criteria = null, PropelPDO $con = null)
1978:     {
1979:         $partial = $this->collImagesPartial && !$this->isNew();
1980:         if (null === $this->collImages || null !== $criteria  || $partial) {
1981:             if ($this->isNew() && null === $this->collImages) {
1982:                 // return empty collection
1983:                 $this->initImages();
1984:             } else {
1985:                 $collImages = ImageQuery::create(null, $criteria)
1986:                     ->filterByContent($this)
1987:                     ->find($con);
1988:                 if (null !== $criteria) {
1989:                     if (false !== $this->collImagesPartial && count($collImages)) {
1990:                       $this->initImages(false);
1991: 
1992:                       foreach($collImages as $obj) {
1993:                         if (false == $this->collImages->contains($obj)) {
1994:                           $this->collImages->append($obj);
1995:                         }
1996:                       }
1997: 
1998:                       $this->collImagesPartial = true;
1999:                     }
2000: 
2001:                     return $collImages;
2002:                 }
2003: 
2004:                 if($partial && $this->collImages) {
2005:                     foreach($this->collImages as $obj) {
2006:                         if($obj->isNew()) {
2007:                             $collImages[] = $obj;
2008:                         }
2009:                     }
2010:                 }
2011: 
2012:                 $this->collImages = $collImages;
2013:                 $this->collImagesPartial = false;
2014:             }
2015:         }
2016: 
2017:         return $this->collImages;
2018:     }
2019: 
2020:     /**
2021:      * Sets a collection of Image objects related by a one-to-many relationship
2022:      * to the current object.
2023:      * It will also schedule objects for deletion based on a diff between old objects (aka persisted)
2024:      * and new objects from the given Propel collection.
2025:      *
2026:      * @param PropelCollection $images A Propel collection.
2027:      * @param PropelPDO $con Optional connection object
2028:      */
2029:     public function setImages(PropelCollection $images, PropelPDO $con = null)
2030:     {
2031:         $this->imagesScheduledForDeletion = $this->getImages(new Criteria(), $con)->diff($images);
2032: 
2033:         foreach ($this->imagesScheduledForDeletion as $imageRemoved) {
2034:             $imageRemoved->setContent(null);
2035:         }
2036: 
2037:         $this->collImages = null;
2038:         foreach ($images as $image) {
2039:             $this->addImage($image);
2040:         }
2041: 
2042:         $this->collImages = $images;
2043:         $this->collImagesPartial = false;
2044:     }
2045: 
2046:     /**
2047:      * Returns the number of related Image objects.
2048:      *
2049:      * @param Criteria $criteria
2050:      * @param boolean $distinct
2051:      * @param PropelPDO $con
2052:      * @return int             Count of related Image objects.
2053:      * @throws PropelException
2054:      */
2055:     public function countImages(Criteria $criteria = null, $distinct = false, PropelPDO $con = null)
2056:     {
2057:         $partial = $this->collImagesPartial && !$this->isNew();
2058:         if (null === $this->collImages || null !== $criteria || $partial) {
2059:             if ($this->isNew() && null === $this->collImages) {
2060:                 return 0;
2061:             } else {
2062:                 if($partial && !$criteria) {
2063:                     return count($this->getImages());
2064:                 }
2065:                 $query = ImageQuery::create(null, $criteria);
2066:                 if ($distinct) {
2067:                     $query->distinct();
2068:                 }
2069: 
2070:                 return $query
2071:                     ->filterByContent($this)
2072:                     ->count($con);
2073:             }
2074:         } else {
2075:             return count($this->collImages);
2076:         }
2077:     }
2078: 
2079:     /**
2080:      * Method called to associate a Image object to this object
2081:      * through the Image foreign key attribute.
2082:      *
2083:      * @param    Image $l Image
2084:      * @return Content The current object (for fluent API support)
2085:      */
2086:     public function addImage(Image $l)
2087:     {
2088:         if ($this->collImages === null) {
2089:             $this->initImages();
2090:             $this->collImagesPartial = true;
2091:         }
2092:         if (!$this->collImages->contains($l)) { // only add it if the **same** object is not already associated
2093:             $this->doAddImage($l);
2094:         }
2095: 
2096:         return $this;
2097:     }
2098: 
2099:     /**
2100:      * @param   Image $image The image object to add.
2101:      */
2102:     protected function doAddImage($image)
2103:     {
2104:         $this->collImages[]= $image;
2105:         $image->setContent($this);
2106:     }
2107: 
2108:     /**
2109:      * @param   Image $image The image object to remove.
2110:      */
2111:     public function removeImage($image)
2112:     {
2113:         if ($this->getImages()->contains($image)) {
2114:             $this->collImages->remove($this->collImages->search($image));
2115:             if (null === $this->imagesScheduledForDeletion) {
2116:                 $this->imagesScheduledForDeletion = clone $this->collImages;
2117:                 $this->imagesScheduledForDeletion->clear();
2118:             }
2119:             $this->imagesScheduledForDeletion[]= $image;
2120:             $image->setContent(null);
2121:         }
2122:     }
2123: 
2124: 
2125:     /**
2126:      * If this collection has already been initialized with
2127:      * an identical criteria, it returns the collection.
2128:      * Otherwise if this Content is new, it will return
2129:      * an empty collection; or if this Content has previously
2130:      * been saved, it will retrieve related Images from storage.
2131:      *
2132:      * This method is protected by default in order to keep the public
2133:      * api reasonable.  You can provide public methods for those you
2134:      * actually need in Content.
2135:      *
2136:      * @param Criteria $criteria optional Criteria object to narrow the query
2137:      * @param PropelPDO $con optional connection object
2138:      * @param string $join_behavior optional join type to use (defaults to Criteria::LEFT_JOIN)
2139:      * @return PropelObjectCollection|Image[] List of Image objects
2140:      */
2141:     public function getImagesJoinProduct($criteria = null, $con = null, $join_behavior = Criteria::LEFT_JOIN)
2142:     {
2143:         $query = ImageQuery::create(null, $criteria);
2144:         $query->joinWith('Product', $join_behavior);
2145: 
2146:         return $this->getImages($query, $con);
2147:     }
2148: 
2149: 
2150:     /**
2151:      * If this collection has already been initialized with
2152:      * an identical criteria, it returns the collection.
2153:      * Otherwise if this Content is new, it will return
2154:      * an empty collection; or if this Content has previously
2155:      * been saved, it will retrieve related Images from storage.
2156:      *
2157:      * This method is protected by default in order to keep the public
2158:      * api reasonable.  You can provide public methods for those you
2159:      * actually need in Content.
2160:      *
2161:      * @param Criteria $criteria optional Criteria object to narrow the query
2162:      * @param PropelPDO $con optional connection object
2163:      * @param string $join_behavior optional join type to use (defaults to Criteria::LEFT_JOIN)
2164:      * @return PropelObjectCollection|Image[] List of Image objects
2165:      */
2166:     public function getImagesJoinCategory($criteria = null, $con = null, $join_behavior = Criteria::LEFT_JOIN)
2167:     {
2168:         $query = ImageQuery::create(null, $criteria);
2169:         $query->joinWith('Category', $join_behavior);
2170: 
2171:         return $this->getImages($query, $con);
2172:     }
2173: 
2174: 
2175:     /**
2176:      * If this collection has already been initialized with
2177:      * an identical criteria, it returns the collection.
2178:      * Otherwise if this Content is new, it will return
2179:      * an empty collection; or if this Content has previously
2180:      * been saved, it will retrieve related Images from storage.
2181:      *
2182:      * This method is protected by default in order to keep the public
2183:      * api reasonable.  You can provide public methods for those you
2184:      * actually need in Content.
2185:      *
2186:      * @param Criteria $criteria optional Criteria object to narrow the query
2187:      * @param PropelPDO $con optional connection object
2188:      * @param string $join_behavior optional join type to use (defaults to Criteria::LEFT_JOIN)
2189:      * @return PropelObjectCollection|Image[] List of Image objects
2190:      */
2191:     public function getImagesJoinFolder($criteria = null, $con = null, $join_behavior = Criteria::LEFT_JOIN)
2192:     {
2193:         $query = ImageQuery::create(null, $criteria);
2194:         $query->joinWith('Folder', $join_behavior);
2195: 
2196:         return $this->getImages($query, $con);
2197:     }
2198: 
2199:     /**
2200:      * Clears out the collDocuments collection
2201:      *
2202:      * This does not modify the database; however, it will remove any associated objects, causing
2203:      * them to be refetched by subsequent calls to accessor method.
2204:      *
2205:      * @return void
2206:      * @see        addDocuments()
2207:      */
2208:     public function clearDocuments()
2209:     {
2210:         $this->collDocuments = null; // important to set this to null since that means it is uninitialized
2211:         $this->collDocumentsPartial = null;
2212:     }
2213: 
2214:     /**
2215:      * reset is the collDocuments collection loaded partially
2216:      *
2217:      * @return void
2218:      */
2219:     public function resetPartialDocuments($v = true)
2220:     {
2221:         $this->collDocumentsPartial = $v;
2222:     }
2223: 
2224:     /**
2225:      * Initializes the collDocuments collection.
2226:      *
2227:      * By default this just sets the collDocuments collection to an empty array (like clearcollDocuments());
2228:      * however, you may wish to override this method in your stub class to provide setting appropriate
2229:      * to your application -- for example, setting the initial array to the values stored in database.
2230:      *
2231:      * @param boolean $overrideExisting If set to true, the method call initializes
2232:      *                                        the collection even if it is not empty
2233:      *
2234:      * @return void
2235:      */
2236:     public function initDocuments($overrideExisting = true)
2237:     {
2238:         if (null !== $this->collDocuments && !$overrideExisting) {
2239:             return;
2240:         }
2241:         $this->collDocuments = new PropelObjectCollection();
2242:         $this->collDocuments->setModel('Document');
2243:     }
2244: 
2245:     /**
2246:      * Gets an array of Document objects which contain a foreign key that references this object.
2247:      *
2248:      * If the $criteria is not null, it is used to always fetch the results from the database.
2249:      * Otherwise the results are fetched from the database the first time, then cached.
2250:      * Next time the same method is called without $criteria, the cached collection is returned.
2251:      * If this Content is new, it will return
2252:      * an empty collection or the current collection; the criteria is ignored on a new object.
2253:      *
2254:      * @param Criteria $criteria optional Criteria object to narrow the query
2255:      * @param PropelPDO $con optional connection object
2256:      * @return PropelObjectCollection|Document[] List of Document objects
2257:      * @throws PropelException
2258:      */
2259:     public function getDocuments($criteria = null, PropelPDO $con = null)
2260:     {
2261:         $partial = $this->collDocumentsPartial && !$this->isNew();
2262:         if (null === $this->collDocuments || null !== $criteria  || $partial) {
2263:             if ($this->isNew() && null === $this->collDocuments) {
2264:                 // return empty collection
2265:                 $this->initDocuments();
2266:             } else {
2267:                 $collDocuments = DocumentQuery::create(null, $criteria)
2268:                     ->filterByContent($this)
2269:                     ->find($con);
2270:                 if (null !== $criteria) {
2271:                     if (false !== $this->collDocumentsPartial && count($collDocuments)) {
2272:                       $this->initDocuments(false);
2273: 
2274:                       foreach($collDocuments as $obj) {
2275:                         if (false == $this->collDocuments->contains($obj)) {
2276:                           $this->collDocuments->append($obj);
2277:                         }
2278:                       }
2279: 
2280:                       $this->collDocumentsPartial = true;
2281:                     }
2282: 
2283:                     return $collDocuments;
2284:                 }
2285: 
2286:                 if($partial && $this->collDocuments) {
2287:                     foreach($this->collDocuments as $obj) {
2288:                         if($obj->isNew()) {
2289:                             $collDocuments[] = $obj;
2290:                         }
2291:                     }
2292:                 }
2293: 
2294:                 $this->collDocuments = $collDocuments;
2295:                 $this->collDocumentsPartial = false;
2296:             }
2297:         }
2298: 
2299:         return $this->collDocuments;
2300:     }
2301: 
2302:     /**
2303:      * Sets a collection of Document objects related by a one-to-many relationship
2304:      * to the current object.
2305:      * It will also schedule objects for deletion based on a diff between old objects (aka persisted)
2306:      * and new objects from the given Propel collection.
2307:      *
2308:      * @param PropelCollection $documents A Propel collection.
2309:      * @param PropelPDO $con Optional connection object
2310:      */
2311:     public function setDocuments(PropelCollection $documents, PropelPDO $con = null)
2312:     {
2313:         $this->documentsScheduledForDeletion = $this->getDocuments(new Criteria(), $con)->diff($documents);
2314: 
2315:         foreach ($this->documentsScheduledForDeletion as $documentRemoved) {
2316:             $documentRemoved->setContent(null);
2317:         }
2318: 
2319:         $this->collDocuments = null;
2320:         foreach ($documents as $document) {
2321:             $this->addDocument($document);
2322:         }
2323: 
2324:         $this->collDocuments = $documents;
2325:         $this->collDocumentsPartial = false;
2326:     }
2327: 
2328:     /**
2329:      * Returns the number of related Document objects.
2330:      *
2331:      * @param Criteria $criteria
2332:      * @param boolean $distinct
2333:      * @param PropelPDO $con
2334:      * @return int             Count of related Document objects.
2335:      * @throws PropelException
2336:      */
2337:     public function countDocuments(Criteria $criteria = null, $distinct = false, PropelPDO $con = null)
2338:     {
2339:         $partial = $this->collDocumentsPartial && !$this->isNew();
2340:         if (null === $this->collDocuments || null !== $criteria || $partial) {
2341:             if ($this->isNew() && null === $this->collDocuments) {
2342:                 return 0;
2343:             } else {
2344:                 if($partial && !$criteria) {
2345:                     return count($this->getDocuments());
2346:                 }
2347:                 $query = DocumentQuery::create(null, $criteria);
2348:                 if ($distinct) {
2349:                     $query->distinct();
2350:                 }
2351: 
2352:                 return $query
2353:                     ->filterByContent($this)
2354:                     ->count($con);
2355:             }
2356:         } else {
2357:             return count($this->collDocuments);
2358:         }
2359:     }
2360: 
2361:     /**
2362:      * Method called to associate a Document object to this object
2363:      * through the Document foreign key attribute.
2364:      *
2365:      * @param    Document $l Document
2366:      * @return Content The current object (for fluent API support)
2367:      */
2368:     public function addDocument(Document $l)
2369:     {
2370:         if ($this->collDocuments === null) {
2371:             $this->initDocuments();
2372:             $this->collDocumentsPartial = true;
2373:         }
2374:         if (!$this->collDocuments->contains($l)) { // only add it if the **same** object is not already associated
2375:             $this->doAddDocument($l);
2376:         }
2377: 
2378:         return $this;
2379:     }
2380: 
2381:     /**
2382:      * @param   Document $document The document object to add.
2383:      */
2384:     protected function doAddDocument($document)
2385:     {
2386:         $this->collDocuments[]= $document;
2387:         $document->setContent($this);
2388:     }
2389: 
2390:     /**
2391:      * @param   Document $document The document object to remove.
2392:      */
2393:     public function removeDocument($document)
2394:     {
2395:         if ($this->getDocuments()->contains($document)) {
2396:             $this->collDocuments->remove($this->collDocuments->search($document));
2397:             if (null === $this->documentsScheduledForDeletion) {
2398:                 $this->documentsScheduledForDeletion = clone $this->collDocuments;
2399:                 $this->documentsScheduledForDeletion->clear();
2400:             }
2401:             $this->documentsScheduledForDeletion[]= $document;
2402:             $document->setContent(null);
2403:         }
2404:     }
2405: 
2406: 
2407:     /**
2408:      * If this collection has already been initialized with
2409:      * an identical criteria, it returns the collection.
2410:      * Otherwise if this Content is new, it will return
2411:      * an empty collection; or if this Content has previously
2412:      * been saved, it will retrieve related Documents from storage.
2413:      *
2414:      * This method is protected by default in order to keep the public
2415:      * api reasonable.  You can provide public methods for those you
2416:      * actually need in Content.
2417:      *
2418:      * @param Criteria $criteria optional Criteria object to narrow the query
2419:      * @param PropelPDO $con optional connection object
2420:      * @param string $join_behavior optional join type to use (defaults to Criteria::LEFT_JOIN)
2421:      * @return PropelObjectCollection|Document[] List of Document objects
2422:      */
2423:     public function getDocumentsJoinProduct($criteria = null, $con = null, $join_behavior = Criteria::LEFT_JOIN)
2424:     {
2425:         $query = DocumentQuery::create(null, $criteria);
2426:         $query->joinWith('Product', $join_behavior);
2427: 
2428:         return $this->getDocuments($query, $con);
2429:     }
2430: 
2431: 
2432:     /**
2433:      * If this collection has already been initialized with
2434:      * an identical criteria, it returns the collection.
2435:      * Otherwise if this Content is new, it will return
2436:      * an empty collection; or if this Content has previously
2437:      * been saved, it will retrieve related Documents from storage.
2438:      *
2439:      * This method is protected by default in order to keep the public
2440:      * api reasonable.  You can provide public methods for those you
2441:      * actually need in Content.
2442:      *
2443:      * @param Criteria $criteria optional Criteria object to narrow the query
2444:      * @param PropelPDO $con optional connection object
2445:      * @param string $join_behavior optional join type to use (defaults to Criteria::LEFT_JOIN)
2446:      * @return PropelObjectCollection|Document[] List of Document objects
2447:      */
2448:     public function getDocumentsJoinCategory($criteria = null, $con = null, $join_behavior = Criteria::LEFT_JOIN)
2449:     {
2450:         $query = DocumentQuery::create(null, $criteria);
2451:         $query->joinWith('Category', $join_behavior);
2452: 
2453:         return $this->getDocuments($query, $con);
2454:     }
2455: 
2456: 
2457:     /**
2458:      * If this collection has already been initialized with
2459:      * an identical criteria, it returns the collection.
2460:      * Otherwise if this Content is new, it will return
2461:      * an empty collection; or if this Content has previously
2462:      * been saved, it will retrieve related Documents from storage.
2463:      *
2464:      * This method is protected by default in order to keep the public
2465:      * api reasonable.  You can provide public methods for those you
2466:      * actually need in Content.
2467:      *
2468:      * @param Criteria $criteria optional Criteria object to narrow the query
2469:      * @param PropelPDO $con optional connection object
2470:      * @param string $join_behavior optional join type to use (defaults to Criteria::LEFT_JOIN)
2471:      * @return PropelObjectCollection|Document[] List of Document objects
2472:      */
2473:     public function getDocumentsJoinFolder($criteria = null, $con = null, $join_behavior = Criteria::LEFT_JOIN)
2474:     {
2475:         $query = DocumentQuery::create(null, $criteria);
2476:         $query->joinWith('Folder', $join_behavior);
2477: 
2478:         return $this->getDocuments($query, $con);
2479:     }
2480: 
2481:     /**
2482:      * Clears out the collRewritings collection
2483:      *
2484:      * This does not modify the database; however, it will remove any associated objects, causing
2485:      * them to be refetched by subsequent calls to accessor method.
2486:      *
2487:      * @return void
2488:      * @see        addRewritings()
2489:      */
2490:     public function clearRewritings()
2491:     {
2492:         $this->collRewritings = null; // important to set this to null since that means it is uninitialized
2493:         $this->collRewritingsPartial = null;
2494:     }
2495: 
2496:     /**
2497:      * reset is the collRewritings collection loaded partially
2498:      *
2499:      * @return void
2500:      */
2501:     public function resetPartialRewritings($v = true)
2502:     {
2503:         $this->collRewritingsPartial = $v;
2504:     }
2505: 
2506:     /**
2507:      * Initializes the collRewritings collection.
2508:      *
2509:      * By default this just sets the collRewritings collection to an empty array (like clearcollRewritings());
2510:      * however, you may wish to override this method in your stub class to provide setting appropriate
2511:      * to your application -- for example, setting the initial array to the values stored in database.
2512:      *
2513:      * @param boolean $overrideExisting If set to true, the method call initializes
2514:      *                                        the collection even if it is not empty
2515:      *
2516:      * @return void
2517:      */
2518:     public function initRewritings($overrideExisting = true)
2519:     {
2520:         if (null !== $this->collRewritings && !$overrideExisting) {
2521:             return;
2522:         }
2523:         $this->collRewritings = new PropelObjectCollection();
2524:         $this->collRewritings->setModel('Rewriting');
2525:     }
2526: 
2527:     /**
2528:      * Gets an array of Rewriting objects which contain a foreign key that references this object.
2529:      *
2530:      * If the $criteria is not null, it is used to always fetch the results from the database.
2531:      * Otherwise the results are fetched from the database the first time, then cached.
2532:      * Next time the same method is called without $criteria, the cached collection is returned.
2533:      * If this Content is new, it will return
2534:      * an empty collection or the current collection; the criteria is ignored on a new object.
2535:      *
2536:      * @param Criteria $criteria optional Criteria object to narrow the query
2537:      * @param PropelPDO $con optional connection object
2538:      * @return PropelObjectCollection|Rewriting[] List of Rewriting objects
2539:      * @throws PropelException
2540:      */
2541:     public function getRewritings($criteria = null, PropelPDO $con = null)
2542:     {
2543:         $partial = $this->collRewritingsPartial && !$this->isNew();
2544:         if (null === $this->collRewritings || null !== $criteria  || $partial) {
2545:             if ($this->isNew() && null === $this->collRewritings) {
2546:                 // return empty collection
2547:                 $this->initRewritings();
2548:             } else {
2549:                 $collRewritings = RewritingQuery::create(null, $criteria)
2550:                     ->filterByContent($this)
2551:                     ->find($con);
2552:                 if (null !== $criteria) {
2553:                     if (false !== $this->collRewritingsPartial && count($collRewritings)) {
2554:                       $this->initRewritings(false);
2555: 
2556:                       foreach($collRewritings as $obj) {
2557:                         if (false == $this->collRewritings->contains($obj)) {
2558:                           $this->collRewritings->append($obj);
2559:                         }
2560:                       }
2561: 
2562:                       $this->collRewritingsPartial = true;
2563:                     }
2564: 
2565:                     return $collRewritings;
2566:                 }
2567: 
2568:                 if($partial && $this->collRewritings) {
2569:                     foreach($this->collRewritings as $obj) {
2570:                         if($obj->isNew()) {
2571:                             $collRewritings[] = $obj;
2572:                         }
2573:                     }
2574:                 }
2575: 
2576:                 $this->collRewritings = $collRewritings;
2577:                 $this->collRewritingsPartial = false;
2578:             }
2579:         }
2580: 
2581:         return $this->collRewritings;
2582:     }
2583: 
2584:     /**
2585:      * Sets a collection of Rewriting objects related by a one-to-many relationship
2586:      * to the current object.
2587:      * It will also schedule objects for deletion based on a diff between old objects (aka persisted)
2588:      * and new objects from the given Propel collection.
2589:      *
2590:      * @param PropelCollection $rewritings A Propel collection.
2591:      * @param PropelPDO $con Optional connection object
2592:      */
2593:     public function setRewritings(PropelCollection $rewritings, PropelPDO $con = null)
2594:     {
2595:         $this->rewritingsScheduledForDeletion = $this->getRewritings(new Criteria(), $con)->diff($rewritings);
2596: 
2597:         foreach ($this->rewritingsScheduledForDeletion as $rewritingRemoved) {
2598:             $rewritingRemoved->setContent(null);
2599:         }
2600: 
2601:         $this->collRewritings = null;
2602:         foreach ($rewritings as $rewriting) {
2603:             $this->addRewriting($rewriting);
2604:         }
2605: 
2606:         $this->collRewritings = $rewritings;
2607:         $this->collRewritingsPartial = false;
2608:     }
2609: 
2610:     /**
2611:      * Returns the number of related Rewriting objects.
2612:      *
2613:      * @param Criteria $criteria
2614:      * @param boolean $distinct
2615:      * @param PropelPDO $con
2616:      * @return int             Count of related Rewriting objects.
2617:      * @throws PropelException
2618:      */
2619:     public function countRewritings(Criteria $criteria = null, $distinct = false, PropelPDO $con = null)
2620:     {
2621:         $partial = $this->collRewritingsPartial && !$this->isNew();
2622:         if (null === $this->collRewritings || null !== $criteria || $partial) {
2623:             if ($this->isNew() && null === $this->collRewritings) {
2624:                 return 0;
2625:             } else {
2626:                 if($partial && !$criteria) {
2627:                     return count($this->getRewritings());
2628:                 }
2629:                 $query = RewritingQuery::create(null, $criteria);
2630:                 if ($distinct) {
2631:                     $query->distinct();
2632:                 }
2633: 
2634:                 return $query
2635:                     ->filterByContent($this)
2636:                     ->count($con);
2637:             }
2638:         } else {
2639:             return count($this->collRewritings);
2640:         }
2641:     }
2642: 
2643:     /**
2644:      * Method called to associate a Rewriting object to this object
2645:      * through the Rewriting foreign key attribute.
2646:      *
2647:      * @param    Rewriting $l Rewriting
2648:      * @return Content The current object (for fluent API support)
2649:      */
2650:     public function addRewriting(Rewriting $l)
2651:     {
2652:         if ($this->collRewritings === null) {
2653:             $this->initRewritings();
2654:             $this->collRewritingsPartial = true;
2655:         }
2656:         if (!$this->collRewritings->contains($l)) { // only add it if the **same** object is not already associated
2657:             $this->doAddRewriting($l);
2658:         }
2659: 
2660:         return $this;
2661:     }
2662: 
2663:     /**
2664:      * @param   Rewriting $rewriting The rewriting object to add.
2665:      */
2666:     protected function doAddRewriting($rewriting)
2667:     {
2668:         $this->collRewritings[]= $rewriting;
2669:         $rewriting->setContent($this);
2670:     }
2671: 
2672:     /**
2673:      * @param   Rewriting $rewriting The rewriting object to remove.
2674:      */
2675:     public function removeRewriting($rewriting)
2676:     {
2677:         if ($this->getRewritings()->contains($rewriting)) {
2678:             $this->collRewritings->remove($this->collRewritings->search($rewriting));
2679:             if (null === $this->rewritingsScheduledForDeletion) {
2680:                 $this->rewritingsScheduledForDeletion = clone $this->collRewritings;
2681:                 $this->rewritingsScheduledForDeletion->clear();
2682:             }
2683:             $this->rewritingsScheduledForDeletion[]= $rewriting;
2684:             $rewriting->setContent(null);
2685:         }
2686:     }
2687: 
2688: 
2689:     /**
2690:      * If this collection has already been initialized with
2691:      * an identical criteria, it returns the collection.
2692:      * Otherwise if this Content is new, it will return
2693:      * an empty collection; or if this Content has previously
2694:      * been saved, it will retrieve related Rewritings from storage.
2695:      *
2696:      * This method is protected by default in order to keep the public
2697:      * api reasonable.  You can provide public methods for those you
2698:      * actually need in Content.
2699:      *
2700:      * @param Criteria $criteria optional Criteria object to narrow the query
2701:      * @param PropelPDO $con optional connection object
2702:      * @param string $join_behavior optional join type to use (defaults to Criteria::LEFT_JOIN)
2703:      * @return PropelObjectCollection|Rewriting[] List of Rewriting objects
2704:      */
2705:     public function getRewritingsJoinProduct($criteria = null, $con = null, $join_behavior = Criteria::LEFT_JOIN)
2706:     {
2707:         $query = RewritingQuery::create(null, $criteria);
2708:         $query->joinWith('Product', $join_behavior);
2709: 
2710:         return $this->getRewritings($query, $con);
2711:     }
2712: 
2713: 
2714:     /**
2715:      * If this collection has already been initialized with
2716:      * an identical criteria, it returns the collection.
2717:      * Otherwise if this Content is new, it will return
2718:      * an empty collection; or if this Content has previously
2719:      * been saved, it will retrieve related Rewritings from storage.
2720:      *
2721:      * This method is protected by default in order to keep the public
2722:      * api reasonable.  You can provide public methods for those you
2723:      * actually need in Content.
2724:      *
2725:      * @param Criteria $criteria optional Criteria object to narrow the query
2726:      * @param PropelPDO $con optional connection object
2727:      * @param string $join_behavior optional join type to use (defaults to Criteria::LEFT_JOIN)
2728:      * @return PropelObjectCollection|Rewriting[] List of Rewriting objects
2729:      */
2730:     public function getRewritingsJoinCategory($criteria = null, $con = null, $join_behavior = Criteria::LEFT_JOIN)
2731:     {
2732:         $query = RewritingQuery::create(null, $criteria);
2733:         $query->joinWith('Category', $join_behavior);
2734: 
2735:         return $this->getRewritings($query, $con);
2736:     }
2737: 
2738: 
2739:     /**
2740:      * If this collection has already been initialized with
2741:      * an identical criteria, it returns the collection.
2742:      * Otherwise if this Content is new, it will return
2743:      * an empty collection; or if this Content has previously
2744:      * been saved, it will retrieve related Rewritings from storage.
2745:      *
2746:      * This method is protected by default in order to keep the public
2747:      * api reasonable.  You can provide public methods for those you
2748:      * actually need in Content.
2749:      *
2750:      * @param Criteria $criteria optional Criteria object to narrow the query
2751:      * @param PropelPDO $con optional connection object
2752:      * @param string $join_behavior optional join type to use (defaults to Criteria::LEFT_JOIN)
2753:      * @return PropelObjectCollection|Rewriting[] List of Rewriting objects
2754:      */
2755:     public function getRewritingsJoinFolder($criteria = null, $con = null, $join_behavior = Criteria::LEFT_JOIN)
2756:     {
2757:         $query = RewritingQuery::create(null, $criteria);
2758:         $query->joinWith('Folder', $join_behavior);
2759: 
2760:         return $this->getRewritings($query, $con);
2761:     }
2762: 
2763:     /**
2764:      * Clears out the collContentFolders collection
2765:      *
2766:      * This does not modify the database; however, it will remove any associated objects, causing
2767:      * them to be refetched by subsequent calls to accessor method.
2768:      *
2769:      * @return void
2770:      * @see        addContentFolders()
2771:      */
2772:     public function clearContentFolders()
2773:     {
2774:         $this->collContentFolders = null; // important to set this to null since that means it is uninitialized
2775:         $this->collContentFoldersPartial = null;
2776:     }
2777: 
2778:     /**
2779:      * reset is the collContentFolders collection loaded partially
2780:      *
2781:      * @return void
2782:      */
2783:     public function resetPartialContentFolders($v = true)
2784:     {
2785:         $this->collContentFoldersPartial = $v;
2786:     }
2787: 
2788:     /**
2789:      * Initializes the collContentFolders collection.
2790:      *
2791:      * By default this just sets the collContentFolders collection to an empty array (like clearcollContentFolders());
2792:      * however, you may wish to override this method in your stub class to provide setting appropriate
2793:      * to your application -- for example, setting the initial array to the values stored in database.
2794:      *
2795:      * @param boolean $overrideExisting If set to true, the method call initializes
2796:      *                                        the collection even if it is not empty
2797:      *
2798:      * @return void
2799:      */
2800:     public function initContentFolders($overrideExisting = true)
2801:     {
2802:         if (null !== $this->collContentFolders && !$overrideExisting) {
2803:             return;
2804:         }
2805:         $this->collContentFolders = new PropelObjectCollection();
2806:         $this->collContentFolders->setModel('ContentFolder');
2807:     }
2808: 
2809:     /**
2810:      * Gets an array of ContentFolder objects which contain a foreign key that references this object.
2811:      *
2812:      * If the $criteria is not null, it is used to always fetch the results from the database.
2813:      * Otherwise the results are fetched from the database the first time, then cached.
2814:      * Next time the same method is called without $criteria, the cached collection is returned.
2815:      * If this Content is new, it will return
2816:      * an empty collection or the current collection; the criteria is ignored on a new object.
2817:      *
2818:      * @param Criteria $criteria optional Criteria object to narrow the query
2819:      * @param PropelPDO $con optional connection object
2820:      * @return PropelObjectCollection|ContentFolder[] List of ContentFolder objects
2821:      * @throws PropelException
2822:      */
2823:     public function getContentFolders($criteria = null, PropelPDO $con = null)
2824:     {
2825:         $partial = $this->collContentFoldersPartial && !$this->isNew();
2826:         if (null === $this->collContentFolders || null !== $criteria  || $partial) {
2827:             if ($this->isNew() && null === $this->collContentFolders) {
2828:                 // return empty collection
2829:                 $this->initContentFolders();
2830:             } else {
2831:                 $collContentFolders = ContentFolderQuery::create(null, $criteria)
2832:                     ->filterByContent($this)
2833:                     ->find($con);
2834:                 if (null !== $criteria) {
2835:                     if (false !== $this->collContentFoldersPartial && count($collContentFolders)) {
2836:                       $this->initContentFolders(false);
2837: 
2838:                       foreach($collContentFolders as $obj) {
2839:                         if (false == $this->collContentFolders->contains($obj)) {
2840:                           $this->collContentFolders->append($obj);
2841:                         }
2842:                       }
2843: 
2844:                       $this->collContentFoldersPartial = true;
2845:                     }
2846: 
2847:                     return $collContentFolders;
2848:                 }
2849: 
2850:                 if($partial && $this->collContentFolders) {
2851:                     foreach($this->collContentFolders as $obj) {
2852:                         if($obj->isNew()) {
2853:                             $collContentFolders[] = $obj;
2854:                         }
2855:                     }
2856:                 }
2857: 
2858:                 $this->collContentFolders = $collContentFolders;
2859:                 $this->collContentFoldersPartial = false;
2860:             }
2861:         }
2862: 
2863:         return $this->collContentFolders;
2864:     }
2865: 
2866:     /**
2867:      * Sets a collection of ContentFolder objects related by a one-to-many relationship
2868:      * to the current object.
2869:      * It will also schedule objects for deletion based on a diff between old objects (aka persisted)
2870:      * and new objects from the given Propel collection.
2871:      *
2872:      * @param PropelCollection $contentFolders A Propel collection.
2873:      * @param PropelPDO $con Optional connection object
2874:      */
2875:     public function setContentFolders(PropelCollection $contentFolders, PropelPDO $con = null)
2876:     {
2877:         $this->contentFoldersScheduledForDeletion = $this->getContentFolders(new Criteria(), $con)->diff($contentFolders);
2878: 
2879:         foreach ($this->contentFoldersScheduledForDeletion as $contentFolderRemoved) {
2880:             $contentFolderRemoved->setContent(null);
2881:         }
2882: 
2883:         $this->collContentFolders = null;
2884:         foreach ($contentFolders as $contentFolder) {
2885:             $this->addContentFolder($contentFolder);
2886:         }
2887: 
2888:         $this->collContentFolders = $contentFolders;
2889:         $this->collContentFoldersPartial = false;
2890:     }
2891: 
2892:     /**
2893:      * Returns the number of related ContentFolder objects.
2894:      *
2895:      * @param Criteria $criteria
2896:      * @param boolean $distinct
2897:      * @param PropelPDO $con
2898:      * @return int             Count of related ContentFolder objects.
2899:      * @throws PropelException
2900:      */
2901:     public function countContentFolders(Criteria $criteria = null, $distinct = false, PropelPDO $con = null)
2902:     {
2903:         $partial = $this->collContentFoldersPartial && !$this->isNew();
2904:         if (null === $this->collContentFolders || null !== $criteria || $partial) {
2905:             if ($this->isNew() && null === $this->collContentFolders) {
2906:                 return 0;
2907:             } else {
2908:                 if($partial && !$criteria) {
2909:                     return count($this->getContentFolders());
2910:                 }
2911:                 $query = ContentFolderQuery::create(null, $criteria);
2912:                 if ($distinct) {
2913:                     $query->distinct();
2914:                 }
2915: 
2916:                 return $query
2917:                     ->filterByContent($this)
2918:                     ->count($con);
2919:             }
2920:         } else {
2921:             return count($this->collContentFolders);
2922:         }
2923:     }
2924: 
2925:     /**
2926:      * Method called to associate a ContentFolder object to this object
2927:      * through the ContentFolder foreign key attribute.
2928:      *
2929:      * @param    ContentFolder $l ContentFolder
2930:      * @return Content The current object (for fluent API support)
2931:      */
2932:     public function addContentFolder(ContentFolder $l)
2933:     {
2934:         if ($this->collContentFolders === null) {
2935:             $this->initContentFolders();
2936:             $this->collContentFoldersPartial = true;
2937:         }
2938:         if (!$this->collContentFolders->contains($l)) { // only add it if the **same** object is not already associated
2939:             $this->doAddContentFolder($l);
2940:         }
2941: 
2942:         return $this;
2943:     }
2944: 
2945:     /**
2946:      * @param   ContentFolder $contentFolder The contentFolder object to add.
2947:      */
2948:     protected function doAddContentFolder($contentFolder)
2949:     {
2950:         $this->collContentFolders[]= $contentFolder;
2951:         $contentFolder->setContent($this);
2952:     }
2953: 
2954:     /**
2955:      * @param   ContentFolder $contentFolder The contentFolder object to remove.
2956:      */
2957:     public function removeContentFolder($contentFolder)
2958:     {
2959:         if ($this->getContentFolders()->contains($contentFolder)) {
2960:             $this->collContentFolders->remove($this->collContentFolders->search($contentFolder));
2961:             if (null === $this->contentFoldersScheduledForDeletion) {
2962:                 $this->contentFoldersScheduledForDeletion = clone $this->collContentFolders;
2963:                 $this->contentFoldersScheduledForDeletion->clear();
2964:             }
2965:             $this->contentFoldersScheduledForDeletion[]= $contentFolder;
2966:             $contentFolder->setContent(null);
2967:         }
2968:     }
2969: 
2970: 
2971:     /**
2972:      * If this collection has already been initialized with
2973:      * an identical criteria, it returns the collection.
2974:      * Otherwise if this Content is new, it will return
2975:      * an empty collection; or if this Content has previously
2976:      * been saved, it will retrieve related ContentFolders from storage.
2977:      *
2978:      * This method is protected by default in order to keep the public
2979:      * api reasonable.  You can provide public methods for those you
2980:      * actually need in Content.
2981:      *
2982:      * @param Criteria $criteria optional Criteria object to narrow the query
2983:      * @param PropelPDO $con optional connection object
2984:      * @param string $join_behavior optional join type to use (defaults to Criteria::LEFT_JOIN)
2985:      * @return PropelObjectCollection|ContentFolder[] List of ContentFolder objects
2986:      */
2987:     public function getContentFoldersJoinFolder($criteria = null, $con = null, $join_behavior = Criteria::LEFT_JOIN)
2988:     {
2989:         $query = ContentFolderQuery::create(null, $criteria);
2990:         $query->joinWith('Folder', $join_behavior);
2991: 
2992:         return $this->getContentFolders($query, $con);
2993:     }
2994: 
2995:     /**
2996:      * Clears out the collContentI18ns collection
2997:      *
2998:      * This does not modify the database; however, it will remove any associated objects, causing
2999:      * them to be refetched by subsequent calls to accessor method.
3000:      *
3001:      * @return void
3002:      * @see        addContentI18ns()
3003:      */
3004:     public function clearContentI18ns()
3005:     {
3006:         $this->collContentI18ns = null; // important to set this to null since that means it is uninitialized
3007:         $this->collContentI18nsPartial = null;
3008:     }
3009: 
3010:     /**
3011:      * reset is the collContentI18ns collection loaded partially
3012:      *
3013:      * @return void
3014:      */
3015:     public function resetPartialContentI18ns($v = true)
3016:     {
3017:         $this->collContentI18nsPartial = $v;
3018:     }
3019: 
3020:     /**
3021:      * Initializes the collContentI18ns collection.
3022:      *
3023:      * By default this just sets the collContentI18ns collection to an empty array (like clearcollContentI18ns());
3024:      * however, you may wish to override this method in your stub class to provide setting appropriate
3025:      * to your application -- for example, setting the initial array to the values stored in database.
3026:      *
3027:      * @param boolean $overrideExisting If set to true, the method call initializes
3028:      *                                        the collection even if it is not empty
3029:      *
3030:      * @return void
3031:      */
3032:     public function initContentI18ns($overrideExisting = true)
3033:     {
3034:         if (null !== $this->collContentI18ns && !$overrideExisting) {
3035:             return;
3036:         }
3037:         $this->collContentI18ns = new PropelObjectCollection();
3038:         $this->collContentI18ns->setModel('ContentI18n');
3039:     }
3040: 
3041:     /**
3042:      * Gets an array of ContentI18n objects which contain a foreign key that references this object.
3043:      *
3044:      * If the $criteria is not null, it is used to always fetch the results from the database.
3045:      * Otherwise the results are fetched from the database the first time, then cached.
3046:      * Next time the same method is called without $criteria, the cached collection is returned.
3047:      * If this Content is new, it will return
3048:      * an empty collection or the current collection; the criteria is ignored on a new object.
3049:      *
3050:      * @param Criteria $criteria optional Criteria object to narrow the query
3051:      * @param PropelPDO $con optional connection object
3052:      * @return PropelObjectCollection|ContentI18n[] List of ContentI18n objects
3053:      * @throws PropelException
3054:      */
3055:     public function getContentI18ns($criteria = null, PropelPDO $con = null)
3056:     {
3057:         $partial = $this->collContentI18nsPartial && !$this->isNew();
3058:         if (null === $this->collContentI18ns || null !== $criteria  || $partial) {
3059:             if ($this->isNew() && null === $this->collContentI18ns) {
3060:                 // return empty collection
3061:                 $this->initContentI18ns();
3062:             } else {
3063:                 $collContentI18ns = ContentI18nQuery::create(null, $criteria)
3064:                     ->filterByContent($this)
3065:                     ->find($con);
3066:                 if (null !== $criteria) {
3067:                     if (false !== $this->collContentI18nsPartial && count($collContentI18ns)) {
3068:                       $this->initContentI18ns(false);
3069: 
3070:                       foreach($collContentI18ns as $obj) {
3071:                         if (false == $this->collContentI18ns->contains($obj)) {
3072:                           $this->collContentI18ns->append($obj);
3073:                         }
3074:                       }
3075: 
3076:                       $this->collContentI18nsPartial = true;
3077:                     }
3078: 
3079:                     return $collContentI18ns;
3080:                 }
3081: 
3082:                 if($partial && $this->collContentI18ns) {
3083:                     foreach($this->collContentI18ns as $obj) {
3084:                         if($obj->isNew()) {
3085:                             $collContentI18ns[] = $obj;
3086:                         }
3087:                     }
3088:                 }
3089: 
3090:                 $this->collContentI18ns = $collContentI18ns;
3091:                 $this->collContentI18nsPartial = false;
3092:             }
3093:         }
3094: 
3095:         return $this->collContentI18ns;
3096:     }
3097: 
3098:     /**
3099:      * Sets a collection of ContentI18n objects related by a one-to-many relationship
3100:      * to the current object.
3101:      * It will also schedule objects for deletion based on a diff between old objects (aka persisted)
3102:      * and new objects from the given Propel collection.
3103:      *
3104:      * @param PropelCollection $contentI18ns A Propel collection.
3105:      * @param PropelPDO $con Optional connection object
3106:      */
3107:     public function setContentI18ns(PropelCollection $contentI18ns, PropelPDO $con = null)
3108:     {
3109:         $this->contentI18nsScheduledForDeletion = $this->getContentI18ns(new Criteria(), $con)->diff($contentI18ns);
3110: 
3111:         foreach ($this->contentI18nsScheduledForDeletion as $contentI18nRemoved) {
3112:             $contentI18nRemoved->setContent(null);
3113:         }
3114: 
3115:         $this->collContentI18ns = null;
3116:         foreach ($contentI18ns as $contentI18n) {
3117:             $this->addContentI18n($contentI18n);
3118:         }
3119: 
3120:         $this->collContentI18ns = $contentI18ns;
3121:         $this->collContentI18nsPartial = false;
3122:     }
3123: 
3124:     /**
3125:      * Returns the number of related ContentI18n objects.
3126:      *
3127:      * @param Criteria $criteria
3128:      * @param boolean $distinct
3129:      * @param PropelPDO $con
3130:      * @return int             Count of related ContentI18n objects.
3131:      * @throws PropelException
3132:      */
3133:     public function countContentI18ns(Criteria $criteria = null, $distinct = false, PropelPDO $con = null)
3134:     {
3135:         $partial = $this->collContentI18nsPartial && !$this->isNew();
3136:         if (null === $this->collContentI18ns || null !== $criteria || $partial) {
3137:             if ($this->isNew() && null === $this->collContentI18ns) {
3138:                 return 0;
3139:             } else {
3140:                 if($partial && !$criteria) {
3141:                     return count($this->getContentI18ns());
3142:                 }
3143:                 $query = ContentI18nQuery::create(null, $criteria);
3144:                 if ($distinct) {
3145:                     $query->distinct();
3146:                 }
3147: 
3148:                 return $query
3149:                     ->filterByContent($this)
3150:                     ->count($con);
3151:             }
3152:         } else {
3153:             return count($this->collContentI18ns);
3154:         }
3155:     }
3156: 
3157:     /**
3158:      * Method called to associate a ContentI18n object to this object
3159:      * through the ContentI18n foreign key attribute.
3160:      *
3161:      * @param    ContentI18n $l ContentI18n
3162:      * @return Content The current object (for fluent API support)
3163:      */
3164:     public function addContentI18n(ContentI18n $l)
3165:     {
3166:         if ($l && $locale = $l->getLocale()) {
3167:             $this->setLocale($locale);
3168:             $this->currentTranslations[$locale] = $l;
3169:         }
3170:         if ($this->collContentI18ns === null) {
3171:             $this->initContentI18ns();
3172:             $this->collContentI18nsPartial = true;
3173:         }
3174:         if (!$this->collContentI18ns->contains($l)) { // only add it if the **same** object is not already associated
3175:             $this->doAddContentI18n($l);
3176:         }
3177: 
3178:         return $this;
3179:     }
3180: 
3181:     /**
3182:      * @param   ContentI18n $contentI18n The contentI18n object to add.
3183:      */
3184:     protected function doAddContentI18n($contentI18n)
3185:     {
3186:         $this->collContentI18ns[]= $contentI18n;
3187:         $contentI18n->setContent($this);
3188:     }
3189: 
3190:     /**
3191:      * @param   ContentI18n $contentI18n The contentI18n object to remove.
3192:      */
3193:     public function removeContentI18n($contentI18n)
3194:     {
3195:         if ($this->getContentI18ns()->contains($contentI18n)) {
3196:             $this->collContentI18ns->remove($this->collContentI18ns->search($contentI18n));
3197:             if (null === $this->contentI18nsScheduledForDeletion) {
3198:                 $this->contentI18nsScheduledForDeletion = clone $this->collContentI18ns;
3199:                 $this->contentI18nsScheduledForDeletion->clear();
3200:             }
3201:             $this->contentI18nsScheduledForDeletion[]= $contentI18n;
3202:             $contentI18n->setContent(null);
3203:         }
3204:     }
3205: 
3206:     /**
3207:      * Clears out the collContentVersions collection
3208:      *
3209:      * This does not modify the database; however, it will remove any associated objects, causing
3210:      * them to be refetched by subsequent calls to accessor method.
3211:      *
3212:      * @return void
3213:      * @see        addContentVersions()
3214:      */
3215:     public function clearContentVersions()
3216:     {
3217:         $this->collContentVersions = null; // important to set this to null since that means it is uninitialized
3218:         $this->collContentVersionsPartial = null;
3219:     }
3220: 
3221:     /**
3222:      * reset is the collContentVersions collection loaded partially
3223:      *
3224:      * @return void
3225:      */
3226:     public function resetPartialContentVersions($v = true)
3227:     {
3228:         $this->collContentVersionsPartial = $v;
3229:     }
3230: 
3231:     /**
3232:      * Initializes the collContentVersions collection.
3233:      *
3234:      * By default this just sets the collContentVersions collection to an empty array (like clearcollContentVersions());
3235:      * however, you may wish to override this method in your stub class to provide setting appropriate
3236:      * to your application -- for example, setting the initial array to the values stored in database.
3237:      *
3238:      * @param boolean $overrideExisting If set to true, the method call initializes
3239:      *                                        the collection even if it is not empty
3240:      *
3241:      * @return void
3242:      */
3243:     public function initContentVersions($overrideExisting = true)
3244:     {
3245:         if (null !== $this->collContentVersions && !$overrideExisting) {
3246:             return;
3247:         }
3248:         $this->collContentVersions = new PropelObjectCollection();
3249:         $this->collContentVersions->setModel('ContentVersion');
3250:     }
3251: 
3252:     /**
3253:      * Gets an array of ContentVersion objects which contain a foreign key that references this object.
3254:      *
3255:      * If the $criteria is not null, it is used to always fetch the results from the database.
3256:      * Otherwise the results are fetched from the database the first time, then cached.
3257:      * Next time the same method is called without $criteria, the cached collection is returned.
3258:      * If this Content is new, it will return
3259:      * an empty collection or the current collection; the criteria is ignored on a new object.
3260:      *
3261:      * @param Criteria $criteria optional Criteria object to narrow the query
3262:      * @param PropelPDO $con optional connection object
3263:      * @return PropelObjectCollection|ContentVersion[] List of ContentVersion objects
3264:      * @throws PropelException
3265:      */
3266:     public function getContentVersions($criteria = null, PropelPDO $con = null)
3267:     {
3268:         $partial = $this->collContentVersionsPartial && !$this->isNew();
3269:         if (null === $this->collContentVersions || null !== $criteria  || $partial) {
3270:             if ($this->isNew() && null === $this->collContentVersions) {
3271:                 // return empty collection
3272:                 $this->initContentVersions();
3273:             } else {
3274:                 $collContentVersions = ContentVersionQuery::create(null, $criteria)
3275:                     ->filterByContent($this)
3276:                     ->find($con);
3277:                 if (null !== $criteria) {
3278:                     if (false !== $this->collContentVersionsPartial && count($collContentVersions)) {
3279:                       $this->initContentVersions(false);
3280: 
3281:                       foreach($collContentVersions as $obj) {
3282:                         if (false == $this->collContentVersions->contains($obj)) {
3283:                           $this->collContentVersions->append($obj);
3284:                         }
3285:                       }
3286: 
3287:                       $this->collContentVersionsPartial = true;
3288:                     }
3289: 
3290:                     return $collContentVersions;
3291:                 }
3292: 
3293:                 if($partial && $this->collContentVersions) {
3294:                     foreach($this->collContentVersions as $obj) {
3295:                         if($obj->isNew()) {
3296:                             $collContentVersions[] = $obj;
3297:                         }
3298:                     }
3299:                 }
3300: 
3301:                 $this->collContentVersions = $collContentVersions;
3302:                 $this->collContentVersionsPartial = false;
3303:             }
3304:         }
3305: 
3306:         return $this->collContentVersions;
3307:     }
3308: 
3309:     /**
3310:      * Sets a collection of ContentVersion objects related by a one-to-many relationship
3311:      * to the current object.
3312:      * It will also schedule objects for deletion based on a diff between old objects (aka persisted)
3313:      * and new objects from the given Propel collection.
3314:      *
3315:      * @param PropelCollection $contentVersions A Propel collection.
3316:      * @param PropelPDO $con Optional connection object
3317:      */
3318:     public function setContentVersions(PropelCollection $contentVersions, PropelPDO $con = null)
3319:     {
3320:         $this->contentVersionsScheduledForDeletion = $this->getContentVersions(new Criteria(), $con)->diff($contentVersions);
3321: 
3322:         foreach ($this->contentVersionsScheduledForDeletion as $contentVersionRemoved) {
3323:             $contentVersionRemoved->setContent(null);
3324:         }
3325: 
3326:         $this->collContentVersions = null;
3327:         foreach ($contentVersions as $contentVersion) {
3328:             $this->addContentVersion($contentVersion);
3329:         }
3330: 
3331:         $this->collContentVersions = $contentVersions;
3332:         $this->collContentVersionsPartial = false;
3333:     }
3334: 
3335:     /**
3336:      * Returns the number of related ContentVersion objects.
3337:      *
3338:      * @param Criteria $criteria
3339:      * @param boolean $distinct
3340:      * @param PropelPDO $con
3341:      * @return int             Count of related ContentVersion objects.
3342:      * @throws PropelException
3343:      */
3344:     public function countContentVersions(Criteria $criteria = null, $distinct = false, PropelPDO $con = null)
3345:     {
3346:         $partial = $this->collContentVersionsPartial && !$this->isNew();
3347:         if (null === $this->collContentVersions || null !== $criteria || $partial) {
3348:             if ($this->isNew() && null === $this->collContentVersions) {
3349:                 return 0;
3350:             } else {
3351:                 if($partial && !$criteria) {
3352:                     return count($this->getContentVersions());
3353:                 }
3354:                 $query = ContentVersionQuery::create(null, $criteria);
3355:                 if ($distinct) {
3356:                     $query->distinct();
3357:                 }
3358: 
3359:                 return $query
3360:                     ->filterByContent($this)
3361:                     ->count($con);
3362:             }
3363:         } else {
3364:             return count($this->collContentVersions);
3365:         }
3366:     }
3367: 
3368:     /**
3369:      * Method called to associate a ContentVersion object to this object
3370:      * through the ContentVersion foreign key attribute.
3371:      *
3372:      * @param    ContentVersion $l ContentVersion
3373:      * @return Content The current object (for fluent API support)
3374:      */
3375:     public function addContentVersion(ContentVersion $l)
3376:     {
3377:         if ($this->collContentVersions === null) {
3378:             $this->initContentVersions();
3379:             $this->collContentVersionsPartial = true;
3380:         }
3381:         if (!$this->collContentVersions->contains($l)) { // only add it if the **same** object is not already associated
3382:             $this->doAddContentVersion($l);
3383:         }
3384: 
3385:         return $this;
3386:     }
3387: 
3388:     /**
3389:      * @param   ContentVersion $contentVersion The contentVersion object to add.
3390:      */
3391:     protected function doAddContentVersion($contentVersion)
3392:     {
3393:         $this->collContentVersions[]= $contentVersion;
3394:         $contentVersion->setContent($this);
3395:     }
3396: 
3397:     /**
3398:      * @param   ContentVersion $contentVersion The contentVersion object to remove.
3399:      */
3400:     public function removeContentVersion($contentVersion)
3401:     {
3402:         if ($this->getContentVersions()->contains($contentVersion)) {
3403:             $this->collContentVersions->remove($this->collContentVersions->search($contentVersion));
3404:             if (null === $this->contentVersionsScheduledForDeletion) {
3405:                 $this->contentVersionsScheduledForDeletion = clone $this->collContentVersions;
3406:                 $this->contentVersionsScheduledForDeletion->clear();
3407:             }
3408:             $this->contentVersionsScheduledForDeletion[]= $contentVersion;
3409:             $contentVersion->setContent(null);
3410:         }
3411:     }
3412: 
3413:     /**
3414:      * Clears the current object and sets all attributes to their default values
3415:      */
3416:     public function clear()
3417:     {
3418:         $this->id = null;
3419:         $this->visible = null;
3420:         $this->position = null;
3421:         $this->created_at = null;
3422:         $this->updated_at = null;
3423:         $this->version = null;
3424:         $this->version_created_at = null;
3425:         $this->version_created_by = null;
3426:         $this->alreadyInSave = false;
3427:         $this->alreadyInValidation = false;
3428:         $this->clearAllReferences();
3429:         $this->applyDefaultValues();
3430:         $this->resetModified();
3431:         $this->setNew(true);
3432:         $this->setDeleted(false);
3433:     }
3434: 
3435:     /**
3436:      * Resets all references to other model objects or collections of model objects.
3437:      *
3438:      * This method is a user-space workaround for PHP's inability to garbage collect
3439:      * objects with circular references (even in PHP 5.3). This is currently necessary
3440:      * when using Propel in certain daemon or large-volumne/high-memory operations.
3441:      *
3442:      * @param boolean $deep Whether to also clear the references on all referrer objects.
3443:      */
3444:     public function clearAllReferences($deep = false)
3445:     {
3446:         if ($deep) {
3447:             if ($this->collContentAssocs) {
3448:                 foreach ($this->collContentAssocs as $o) {
3449:                     $o->clearAllReferences($deep);
3450:                 }
3451:             }
3452:             if ($this->collImages) {
3453:                 foreach ($this->collImages as $o) {
3454:                     $o->clearAllReferences($deep);
3455:                 }
3456:             }
3457:             if ($this->collDocuments) {
3458:                 foreach ($this->collDocuments as $o) {
3459:                     $o->clearAllReferences($deep);
3460:                 }
3461:             }
3462:             if ($this->collRewritings) {
3463:                 foreach ($this->collRewritings as $o) {
3464:                     $o->clearAllReferences($deep);
3465:                 }
3466:             }
3467:             if ($this->collContentFolders) {
3468:                 foreach ($this->collContentFolders as $o) {
3469:                     $o->clearAllReferences($deep);
3470:                 }
3471:             }
3472:             if ($this->collContentI18ns) {
3473:                 foreach ($this->collContentI18ns as $o) {
3474:                     $o->clearAllReferences($deep);
3475:                 }
3476:             }
3477:             if ($this->collContentVersions) {
3478:                 foreach ($this->collContentVersions as $o) {
3479:                     $o->clearAllReferences($deep);
3480:                 }
3481:             }
3482:         } // if ($deep)
3483: 
3484:         // i18n behavior
3485:         $this->currentLocale = 'en_EN';
3486:         $this->currentTranslations = null;
3487: 
3488:         if ($this->collContentAssocs instanceof PropelCollection) {
3489:             $this->collContentAssocs->clearIterator();
3490:         }
3491:         $this->collContentAssocs = null;
3492:         if ($this->collImages instanceof PropelCollection) {
3493:             $this->collImages->clearIterator();
3494:         }
3495:         $this->collImages = null;
3496:         if ($this->collDocuments instanceof PropelCollection) {
3497:             $this->collDocuments->clearIterator();
3498:         }
3499:         $this->collDocuments = null;
3500:         if ($this->collRewritings instanceof PropelCollection) {
3501:             $this->collRewritings->clearIterator();
3502:         }
3503:         $this->collRewritings = null;
3504:         if ($this->collContentFolders instanceof PropelCollection) {
3505:             $this->collContentFolders->clearIterator();
3506:         }
3507:         $this->collContentFolders = null;
3508:         if ($this->collContentI18ns instanceof PropelCollection) {
3509:             $this->collContentI18ns->clearIterator();
3510:         }
3511:         $this->collContentI18ns = null;
3512:         if ($this->collContentVersions instanceof PropelCollection) {
3513:             $this->collContentVersions->clearIterator();
3514:         }
3515:         $this->collContentVersions = null;
3516:     }
3517: 
3518:     /**
3519:      * return the string representation of this object
3520:      *
3521:      * @return string
3522:      */
3523:     public function __toString()
3524:     {
3525:         return (string) $this->exportTo(ContentPeer::DEFAULT_STRING_FORMAT);
3526:     }
3527: 
3528:     /**
3529:      * return true is the object is in saving state
3530:      *
3531:      * @return boolean
3532:      */
3533:     public function isAlreadyInSave()
3534:     {
3535:         return $this->alreadyInSave;
3536:     }
3537: 
3538:     // timestampable behavior
3539: 
3540:     /**
3541:      * Mark the current object so that the update date doesn't get updated during next save
3542:      *
3543:      * @return     Content The current object (for fluent API support)
3544:      */
3545:     public function keepUpdateDateUnchanged()
3546:     {
3547:         $this->modifiedColumns[] = ContentPeer::UPDATED_AT;
3548: 
3549:         return $this;
3550:     }
3551: 
3552:     // i18n behavior
3553: 
3554:     /**
3555:      * Sets the locale for translations
3556:      *
3557:      * @param     string $locale Locale to use for the translation, e.g. 'fr_FR'
3558:      *
3559:      * @return    Content The current object (for fluent API support)
3560:      */
3561:     public function setLocale($locale = 'en_EN')
3562:     {
3563:         $this->currentLocale = $locale;
3564: 
3565:         return $this;
3566:     }
3567: 
3568:     /**
3569:      * Gets the locale for translations
3570:      *
3571:      * @return    string $locale Locale to use for the translation, e.g. 'fr_FR'
3572:      */
3573:     public function getLocale()
3574:     {
3575:         return $this->currentLocale;
3576:     }
3577: 
3578:     /**
3579:      * Returns the current translation for a given locale
3580:      *
3581:      * @param     string $locale Locale to use for the translation, e.g. 'fr_FR'
3582:      * @param     PropelPDO $con an optional connection object
3583:      *
3584:      * @return ContentI18n */
3585:     public function getTranslation($locale = 'en_EN', PropelPDO $con = null)
3586:     {
3587:         if (!isset($this->currentTranslations[$locale])) {
3588:             if (null !== $this->collContentI18ns) {
3589:                 foreach ($this->collContentI18ns as $translation) {
3590:                     if ($translation->getLocale() == $locale) {
3591:                         $this->currentTranslations[$locale] = $translation;
3592: 
3593:                         return $translation;
3594:                     }
3595:                 }
3596:             }
3597:             if ($this->isNew()) {
3598:                 $translation = new ContentI18n();
3599:                 $translation->setLocale($locale);
3600:             } else {
3601:                 $translation = ContentI18nQuery::create()
3602:                     ->filterByPrimaryKey(array($this->getPrimaryKey(), $locale))
3603:                     ->findOneOrCreate($con);
3604:                 $this->currentTranslations[$locale] = $translation;
3605:             }
3606:             $this->addContentI18n($translation);
3607:         }
3608: 
3609:         return $this->currentTranslations[$locale];
3610:     }
3611: 
3612:     /**
3613:      * Remove the translation for a given locale
3614:      *
3615:      * @param     string $locale Locale to use for the translation, e.g. 'fr_FR'
3616:      * @param     PropelPDO $con an optional connection object
3617:      *
3618:      * @return    Content The current object (for fluent API support)
3619:      */
3620:     public function removeTranslation($locale = 'en_EN', PropelPDO $con = null)
3621:     {
3622:         if (!$this->isNew()) {
3623:             ContentI18nQuery::create()
3624:                 ->filterByPrimaryKey(array($this->getPrimaryKey(), $locale))
3625:                 ->delete($con);
3626:         }
3627:         if (isset($this->currentTranslations[$locale])) {
3628:             unset($this->currentTranslations[$locale]);
3629:         }
3630:         foreach ($this->collContentI18ns as $key => $translation) {
3631:             if ($translation->getLocale() == $locale) {
3632:                 unset($this->collContentI18ns[$key]);
3633:                 break;
3634:             }
3635:         }
3636: 
3637:         return $this;
3638:     }
3639: 
3640:     /**
3641:      * Returns the current translation
3642:      *
3643:      * @param     PropelPDO $con an optional connection object
3644:      *
3645:      * @return ContentI18n */
3646:     public function getCurrentTranslation(PropelPDO $con = null)
3647:     {
3648:         return $this->getTranslation($this->getLocale(), $con);
3649:     }
3650: 
3651: 
3652:         /**
3653:          * Get the [title] column value.
3654:          *
3655:          * @return string
3656:          */
3657:         public function getTitle()
3658:         {
3659:         return $this->getCurrentTranslation()->getTitle();
3660:     }
3661: 
3662: 
3663:         /**
3664:          * Set the value of [title] column.
3665:          *
3666:          * @param string $v new value
3667:          * @return ContentI18n The current object (for fluent API support)
3668:          */
3669:         public function setTitle($v)
3670:         {    $this->getCurrentTranslation()->setTitle($v);
3671: 
3672:         return $this;
3673:     }
3674: 
3675: 
3676:         /**
3677:          * Get the [description] column value.
3678:          *
3679:          * @return string
3680:          */
3681:         public function getDescription()
3682:         {
3683:         return $this->getCurrentTranslation()->getDescription();
3684:     }
3685: 
3686: 
3687:         /**
3688:          * Set the value of [description] column.
3689:          *
3690:          * @param string $v new value
3691:          * @return ContentI18n The current object (for fluent API support)
3692:          */
3693:         public function setDescription($v)
3694:         {    $this->getCurrentTranslation()->setDescription($v);
3695: 
3696:         return $this;
3697:     }
3698: 
3699: 
3700:         /**
3701:          * Get the [chapo] column value.
3702:          *
3703:          * @return string
3704:          */
3705:         public function getChapo()
3706:         {
3707:         return $this->getCurrentTranslation()->getChapo();
3708:     }
3709: 
3710: 
3711:         /**
3712:          * Set the value of [chapo] column.
3713:          *
3714:          * @param string $v new value
3715:          * @return ContentI18n The current object (for fluent API support)
3716:          */
3717:         public function setChapo($v)
3718:         {    $this->getCurrentTranslation()->setChapo($v);
3719: 
3720:         return $this;
3721:     }
3722: 
3723: 
3724:         /**
3725:          * Get the [postscriptum] column value.
3726:          *
3727:          * @return string
3728:          */
3729:         public function getPostscriptum()
3730:         {
3731:         return $this->getCurrentTranslation()->getPostscriptum();
3732:     }
3733: 
3734: 
3735:         /**
3736:          * Set the value of [postscriptum] column.
3737:          *
3738:          * @param string $v new value
3739:          * @return ContentI18n The current object (for fluent API support)
3740:          */
3741:         public function setPostscriptum($v)
3742:         {    $this->getCurrentTranslation()->setPostscriptum($v);
3743: 
3744:         return $this;
3745:     }
3746: 
3747:     // versionable behavior
3748: 
3749:     /**
3750:      * Enforce a new Version of this object upon next save.
3751:      *
3752:      * @return Content
3753:      */
3754:     public function enforceVersioning()
3755:     {
3756:         $this->enforceVersion = true;
3757: 
3758:         return $this;
3759:     }
3760: 
3761:     /**
3762:      * Checks whether the current state must be recorded as a version
3763:      *
3764:      * @param PropelPDO $con An optional PropelPDO connection to use.
3765:      *
3766:      * @return  boolean
3767:      */
3768:     public function isVersioningNecessary($con = null)
3769:     {
3770:         if ($this->alreadyInSave) {
3771:             return false;
3772:         }
3773: 
3774:         if ($this->enforceVersion) {
3775:             return true;
3776:         }
3777: 
3778:         if (ContentPeer::isVersioningEnabled() && ($this->isNew() || $this->isModified() || $this->isDeleted())) {
3779:             return true;
3780:         }
3781: 
3782:         return false;
3783:     }
3784: 
3785:     /**
3786:      * Creates a version of the current object and saves it.
3787:      *
3788:      * @param   PropelPDO $con the connection to use
3789:      *
3790:      * @return  ContentVersion A version object
3791:      */
3792:     public function addVersion($con = null)
3793:     {
3794:         $this->enforceVersion = false;
3795: 
3796:         $version = new ContentVersion();
3797:         $version->setId($this->getId());
3798:         $version->setVisible($this->getVisible());
3799:         $version->setPosition($this->getPosition());
3800:         $version->setCreatedAt($this->getCreatedAt());
3801:         $version->setUpdatedAt($this->getUpdatedAt());
3802:         $version->setVersion($this->getVersion());
3803:         $version->setVersionCreatedAt($this->getVersionCreatedAt());
3804:         $version->setVersionCreatedBy($this->getVersionCreatedBy());
3805:         $version->setContent($this);
3806:         $version->save($con);
3807: 
3808:         return $version;
3809:     }
3810: 
3811:     /**
3812:      * Sets the properties of the curent object to the value they had at a specific version
3813:      *
3814:      * @param   integer $versionNumber The version number to read
3815:      * @param   PropelPDO $con the connection to use
3816:      *
3817:      * @return  Content The current object (for fluent API support)
3818:      * @throws  PropelException - if no object with the given version can be found.
3819:      */
3820:     public function toVersion($versionNumber, $con = null)
3821:     {
3822:         $version = $this->getOneVersion($versionNumber, $con);
3823:         if (!$version) {
3824:             throw new PropelException(sprintf('No Content object found with version %d', $version));
3825:         }
3826:         $this->populateFromVersion($version, $con);
3827: 
3828:         return $this;
3829:     }
3830: 
3831:     /**
3832:      * Sets the properties of the curent object to the value they had at a specific version
3833:      *
3834:      * @param   ContentVersion $version The version object to use
3835:      * @param   PropelPDO $con the connection to use
3836:      * @param   array $loadedObjects objects thats been loaded in a chain of populateFromVersion calls on referrer or fk objects.
3837:      *
3838:      * @return  Content The current object (for fluent API support)
3839:      */
3840:     public function populateFromVersion($version, $con = null, &$loadedObjects = array())
3841:     {
3842: 
3843:         $loadedObjects['Content'][$version->getId()][$version->getVersion()] = $this;
3844:         $this->setId($version->getId());
3845:         $this->setVisible($version->getVisible());
3846:         $this->setPosition($version->getPosition());
3847:         $this->setCreatedAt($version->getCreatedAt());
3848:         $this->setUpdatedAt($version->getUpdatedAt());
3849:         $this->setVersion($version->getVersion());
3850:         $this->setVersionCreatedAt($version->getVersionCreatedAt());
3851:         $this->setVersionCreatedBy($version->getVersionCreatedBy());
3852: 
3853:         return $this;
3854:     }
3855: 
3856:     /**
3857:      * Gets the latest persisted version number for the current object
3858:      *
3859:      * @param   PropelPDO $con the connection to use
3860:      *
3861:      * @return  integer
3862:      */
3863:     public function getLastVersionNumber($con = null)
3864:     {
3865:         $v = ContentVersionQuery::create()
3866:             ->filterByContent($this)
3867:             ->orderByVersion('desc')
3868:             ->findOne($con);
3869:         if (!$v) {
3870:             return 0;
3871:         }
3872: 
3873:         return $v->getVersion();
3874:     }
3875: 
3876:     /**
3877:      * Checks whether the current object is the latest one
3878:      *
3879:      * @param   PropelPDO $con the connection to use
3880:      *
3881:      * @return  boolean
3882:      */
3883:     public function isLastVersion($con = null)
3884:     {
3885:         return $this->getLastVersionNumber($con) == $this->getVersion();
3886:     }
3887: 
3888:     /**
3889:      * Retrieves a version object for this entity and a version number
3890:      *
3891:      * @param   integer $versionNumber The version number to read
3892:      * @param   PropelPDO $con the connection to use
3893:      *
3894:      * @return  ContentVersion A version object
3895:      */
3896:     public function getOneVersion($versionNumber, $con = null)
3897:     {
3898:         return ContentVersionQuery::create()
3899:             ->filterByContent($this)
3900:             ->filterByVersion($versionNumber)
3901:             ->findOne($con);
3902:     }
3903: 
3904:     /**
3905:      * Gets all the versions of this object, in incremental order
3906:      *
3907:      * @param   PropelPDO $con the connection to use
3908:      *
3909:      * @return  PropelObjectCollection A list of ContentVersion objects
3910:      */
3911:     public function getAllVersions($con = null)
3912:     {
3913:         $criteria = new Criteria();
3914:         $criteria->addAscendingOrderByColumn(ContentVersionPeer::VERSION);
3915: 
3916:         return $this->getContentVersions($criteria, $con);
3917:     }
3918: 
3919:     /**
3920:      * Compares the current object with another of its version.
3921:      * <code>
3922:      * print_r($book->compareVersion(1));
3923:      * => array(
3924:      *   '1' => array('Title' => 'Book title at version 1'),
3925:      *   '2' => array('Title' => 'Book title at version 2')
3926:      * );
3927:      * </code>
3928:      *
3929:      * @param   integer   $versionNumber
3930:      * @param   string    $keys Main key used for the result diff (versions|columns)
3931:      * @param   PropelPDO $con the connection to use
3932:      * @param   array     $ignoredColumns  The columns to exclude from the diff.
3933:      *
3934:      * @return  array A list of differences
3935:      */
3936:     public function compareVersion($versionNumber, $keys = 'columns', $con = null, $ignoredColumns = array())
3937:     {
3938:         $fromVersion = $this->toArray();
3939:         $toVersion = $this->getOneVersion($versionNumber, $con)->toArray();
3940: 
3941:         return $this->computeDiff($fromVersion, $toVersion, $keys, $ignoredColumns);
3942:     }
3943: 
3944:     /**
3945:      * Compares two versions of the current object.
3946:      * <code>
3947:      * print_r($book->compareVersions(1, 2));
3948:      * => array(
3949:      *   '1' => array('Title' => 'Book title at version 1'),
3950:      *   '2' => array('Title' => 'Book title at version 2')
3951:      * );
3952:      * </code>
3953:      *
3954:      * @param   integer   $fromVersionNumber
3955:      * @param   integer   $toVersionNumber
3956:      * @param   string    $keys Main key used for the result diff (versions|columns)
3957:      * @param   PropelPDO $con the connection to use
3958:      * @param   array     $ignoredColumns  The columns to exclude from the diff.
3959:      *
3960:      * @return  array A list of differences
3961:      */
3962:     public function compareVersions($fromVersionNumber, $toVersionNumber, $keys = 'columns', $con = null, $ignoredColumns = array())
3963:     {
3964:         $fromVersion = $this->getOneVersion($fromVersionNumber, $con)->toArray();
3965:         $toVersion = $this->getOneVersion($toVersionNumber, $con)->toArray();
3966: 
3967:         return $this->computeDiff($fromVersion, $toVersion, $keys, $ignoredColumns);
3968:     }
3969: 
3970:     /**
3971:      * Computes the diff between two versions.
3972:      * <code>
3973:      * print_r($this->computeDiff(1, 2));
3974:      * => array(
3975:      *   '1' => array('Title' => 'Book title at version 1'),
3976:      *   '2' => array('Title' => 'Book title at version 2')
3977:      * );
3978:      * </code>
3979:      *
3980:      * @param   array     $fromVersion     An array representing the original version.
3981:      * @param   array     $toVersion       An array representing the destination version.
3982:      * @param   string    $keys            Main key used for the result diff (versions|columns).
3983:      * @param   array     $ignoredColumns  The columns to exclude from the diff.
3984:      *
3985:      * @return  array A list of differences
3986:      */
3987:     protected function computeDiff($fromVersion, $toVersion, $keys = 'columns', $ignoredColumns = array())
3988:     {
3989:         $fromVersionNumber = $fromVersion['Version'];
3990:         $toVersionNumber = $toVersion['Version'];
3991:         $ignoredColumns = array_merge(array(
3992:             'Version',
3993:             'VersionCreatedAt',
3994:             'VersionCreatedBy',
3995:         ), $ignoredColumns);
3996:         $diff = array();
3997:         foreach ($fromVersion as $key => $value) {
3998:             if (in_array($key, $ignoredColumns)) {
3999:                 continue;
4000:             }
4001:             if ($toVersion[$key] != $value) {
4002:                 switch ($keys) {
4003:                     case 'versions':
4004:                         $diff[$fromVersionNumber][$key] = $value;
4005:                         $diff[$toVersionNumber][$key] = $toVersion[$key];
4006:                         break;
4007:                     default:
4008:                         $diff[$key] = array(
4009:                             $fromVersionNumber => $value,
4010:                             $toVersionNumber => $toVersion[$key],
4011:                         );
4012:                         break;
4013:                 }
4014:             }
4015:         }
4016: 
4017:         return $diff;
4018:     }
4019:     /**
4020:      * retrieve the last $number versions.
4021:      *
4022:      * @param integer $number the number of record to return.
4023:      * @param ContentVersionQuery|Criteria $criteria Additional criteria to filter.
4024:      * @param PropelPDO $con An optional connection to use.
4025:      *
4026:      * @return PropelCollection|ContentVersion[] List of ContentVersion objects
4027:      */
4028:     public function getLastVersions($number = 10, $criteria = null, PropelPDO $con = null)
4029:     {
4030:         $criteria = ContentVersionQuery::create(null, $criteria);
4031:         $criteria->addDescendingOrderByColumn(ContentVersionPeer::VERSION);
4032:         $criteria->limit($number);
4033: 
4034:         return $this->getContentVersions($criteria, $con);
4035:     }
4036: }
4037: 
thelia API documentation generated by ApiGen 2.8.0