Overview

Namespaces

  • Thelia
    • Action
    • Controller
    • Core
      • Bundle
      • Event
      • EventListener
      • Template
        • BaseParam
    • Exception
    • Log
      • Destination
    • Model
      • map
      • om
    • Routing
      • Matcher
    • Tools
    • Tpex
      • BaseParam
      • Exception
      • Loop
      • Tests

Classes

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