Overview

Namespaces

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

Classes

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