Overview

Namespaces

  • cli_db
    • propel
      • map
      • om
  • cli_import
  • LoggedPDO
  • None
  • PHP
  • webservices
    • cart
    • combisearch
    • details
      • annotations
        • feature
    • graphs
      • barplot
      • genome
    • listing
    • queue

Classes

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