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