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 \DateTime;
   9: use \Exception;
  10: use \PDO;
  11: use \Persistent;
  12: use \Propel;
  13: use \PropelCollection;
  14: use \PropelDateTime;
  15: use \PropelException;
  16: use \PropelObjectCollection;
  17: use \PropelPDO;
  18: use cli_db\propel\Analysis;
  19: use cli_db\propel\AnalysisPeer;
  20: use cli_db\propel\AnalysisQuery;
  21: use cli_db\propel\Quantification;
  22: use cli_db\propel\QuantificationQuery;
  23: 
  24: /**
  25:  * Base class that represents a row from the 'analysis' table.
  26:  *
  27:  *
  28:  *
  29:  * @package    propel.generator.cli_db.om
  30:  */
  31: abstract class BaseAnalysis extends BaseObject implements Persistent
  32: {
  33:     /**
  34:      * Peer class name
  35:      */
  36:     const PEER = 'cli_db\\propel\\AnalysisPeer';
  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        AnalysisPeer
  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 analysis_id field.
  54:      * @var        int
  55:      */
  56:     protected $analysis_id;
  57: 
  58:     /**
  59:      * The value for the name field.
  60:      * @var        string
  61:      */
  62:     protected $name;
  63: 
  64:     /**
  65:      * The value for the description field.
  66:      * @var        string
  67:      */
  68:     protected $description;
  69: 
  70:     /**
  71:      * The value for the program field.
  72:      * @var        string
  73:      */
  74:     protected $program;
  75: 
  76:     /**
  77:      * The value for the programversion field.
  78:      * @var        string
  79:      */
  80:     protected $programversion;
  81: 
  82:     /**
  83:      * The value for the algorithm field.
  84:      * @var        string
  85:      */
  86:     protected $algorithm;
  87: 
  88:     /**
  89:      * The value for the sourcename field.
  90:      * @var        string
  91:      */
  92:     protected $sourcename;
  93: 
  94:     /**
  95:      * The value for the sourceversion field.
  96:      * @var        string
  97:      */
  98:     protected $sourceversion;
  99: 
 100:     /**
 101:      * The value for the sourceuri field.
 102:      * @var        string
 103:      */
 104:     protected $sourceuri;
 105: 
 106:     /**
 107:      * The value for the timeexecuted field.
 108:      * Note: this column has a database default value of: (expression) now()
 109:      * @var        string
 110:      */
 111:     protected $timeexecuted;
 112: 
 113:     /**
 114:      * @var        PropelObjectCollection|Quantification[] Collection to store aggregation of Quantification objects.
 115:      */
 116:     protected $collQuantifications;
 117:     protected $collQuantificationsPartial;
 118: 
 119:     /**
 120:      * Flag to prevent endless save loop, if this object is referenced
 121:      * by another object which falls in this transaction.
 122:      * @var        boolean
 123:      */
 124:     protected $alreadyInSave = false;
 125: 
 126:     /**
 127:      * Flag to prevent endless validation loop, if this object is referenced
 128:      * by another object which falls in this transaction.
 129:      * @var        boolean
 130:      */
 131:     protected $alreadyInValidation = false;
 132: 
 133:     /**
 134:      * Flag to prevent endless clearAllReferences($deep=true) loop, if this object is referenced
 135:      * @var        boolean
 136:      */
 137:     protected $alreadyInClearAllReferencesDeep = false;
 138: 
 139:     /**
 140:      * An array of objects scheduled for deletion.
 141:      * @var     PropelObjectCollection
 142:      */
 143:     protected $quantificationsScheduledForDeletion = null;
 144: 
 145:     /**
 146:      * Applies default values to this object.
 147:      * This method should be called from the object's constructor (or
 148:      * equivalent initialization method).
 149:      * @see        __construct()
 150:      */
 151:     public function applyDefaultValues()
 152:     {
 153:     }
 154: 
 155:     /**
 156:      * Initializes internal state of BaseAnalysis object.
 157:      * @see        applyDefaults()
 158:      */
 159:     public function __construct()
 160:     {
 161:         parent::__construct();
 162:         $this->applyDefaultValues();
 163:     }
 164: 
 165:     /**
 166:      * Get the [analysis_id] column value.
 167:      *
 168:      * @return int
 169:      */
 170:     public function getAnalysisId()
 171:     {
 172:         return $this->analysis_id;
 173:     }
 174: 
 175:     /**
 176:      * Get the [name] column value.
 177:      *
 178:      * @return string
 179:      */
 180:     public function getName()
 181:     {
 182:         return $this->name;
 183:     }
 184: 
 185:     /**
 186:      * Get the [description] column value.
 187:      *
 188:      * @return string
 189:      */
 190:     public function getDescription()
 191:     {
 192:         return $this->description;
 193:     }
 194: 
 195:     /**
 196:      * Get the [program] column value.
 197:      *
 198:      * @return string
 199:      */
 200:     public function getProgram()
 201:     {
 202:         return $this->program;
 203:     }
 204: 
 205:     /**
 206:      * Get the [programversion] column value.
 207:      *
 208:      * @return string
 209:      */
 210:     public function getProgramversion()
 211:     {
 212:         return $this->programversion;
 213:     }
 214: 
 215:     /**
 216:      * Get the [algorithm] column value.
 217:      *
 218:      * @return string
 219:      */
 220:     public function getAlgorithm()
 221:     {
 222:         return $this->algorithm;
 223:     }
 224: 
 225:     /**
 226:      * Get the [sourcename] column value.
 227:      *
 228:      * @return string
 229:      */
 230:     public function getSourcename()
 231:     {
 232:         return $this->sourcename;
 233:     }
 234: 
 235:     /**
 236:      * Get the [sourceversion] column value.
 237:      *
 238:      * @return string
 239:      */
 240:     public function getSourceversion()
 241:     {
 242:         return $this->sourceversion;
 243:     }
 244: 
 245:     /**
 246:      * Get the [sourceuri] column value.
 247:      *
 248:      * @return string
 249:      */
 250:     public function getSourceuri()
 251:     {
 252:         return $this->sourceuri;
 253:     }
 254: 
 255:     /**
 256:      * Get the [optionally formatted] temporal [timeexecuted] column value.
 257:      *
 258:      *
 259:      * @param string $format The date/time format string (either date()-style or strftime()-style).
 260:      *               If format is null, then the raw DateTime object will be returned.
 261:      * @return mixed Formatted date/time value as string or DateTime object (if format is null), null if column is null
 262:      * @throws PropelException - if unable to parse/validate the date/time value.
 263:      */
 264:     public function getTimeexecuted($format = 'Y-m-d H:i:s')
 265:     {
 266:         if ($this->timeexecuted === null) {
 267:             return null;
 268:         }
 269: 
 270: 
 271:         try {
 272:             $dt = new DateTime($this->timeexecuted);
 273:         } catch (Exception $x) {
 274:             throw new PropelException("Internally stored date/time/timestamp value could not be converted to DateTime: " . var_export($this->timeexecuted, true), $x);
 275:         }
 276: 
 277:         if ($format === null) {
 278:             // Because propel.useDateTimeClass is true, we return a DateTime object.
 279:             return $dt;
 280:         }
 281: 
 282:         if (strpos($format, '%') !== false) {
 283:             return strftime($format, $dt->format('U'));
 284:         }
 285: 
 286:         return $dt->format($format);
 287: 
 288:     }
 289: 
 290:     /**
 291:      * Set the value of [analysis_id] column.
 292:      *
 293:      * @param int $v new value
 294:      * @return Analysis The current object (for fluent API support)
 295:      */
 296:     public function setAnalysisId($v)
 297:     {
 298:         if ($v !== null && is_numeric($v)) {
 299:             $v = (int) $v;
 300:         }
 301: 
 302:         if ($this->analysis_id !== $v) {
 303:             $this->analysis_id = $v;
 304:             $this->modifiedColumns[] = AnalysisPeer::ANALYSIS_ID;
 305:         }
 306: 
 307: 
 308:         return $this;
 309:     } // setAnalysisId()
 310: 
 311:     /**
 312:      * Set the value of [name] column.
 313:      *
 314:      * @param string $v new value
 315:      * @return Analysis The current object (for fluent API support)
 316:      */
 317:     public function setName($v)
 318:     {
 319:         if ($v !== null && is_numeric($v)) {
 320:             $v = (string) $v;
 321:         }
 322: 
 323:         if ($this->name !== $v) {
 324:             $this->name = $v;
 325:             $this->modifiedColumns[] = AnalysisPeer::NAME;
 326:         }
 327: 
 328: 
 329:         return $this;
 330:     } // setName()
 331: 
 332:     /**
 333:      * Set the value of [description] column.
 334:      *
 335:      * @param string $v new value
 336:      * @return Analysis The current object (for fluent API support)
 337:      */
 338:     public function setDescription($v)
 339:     {
 340:         if ($v !== null && is_numeric($v)) {
 341:             $v = (string) $v;
 342:         }
 343: 
 344:         if ($this->description !== $v) {
 345:             $this->description = $v;
 346:             $this->modifiedColumns[] = AnalysisPeer::DESCRIPTION;
 347:         }
 348: 
 349: 
 350:         return $this;
 351:     } // setDescription()
 352: 
 353:     /**
 354:      * Set the value of [program] column.
 355:      *
 356:      * @param string $v new value
 357:      * @return Analysis The current object (for fluent API support)
 358:      */
 359:     public function setProgram($v)
 360:     {
 361:         if ($v !== null && is_numeric($v)) {
 362:             $v = (string) $v;
 363:         }
 364: 
 365:         if ($this->program !== $v) {
 366:             $this->program = $v;
 367:             $this->modifiedColumns[] = AnalysisPeer::PROGRAM;
 368:         }
 369: 
 370: 
 371:         return $this;
 372:     } // setProgram()
 373: 
 374:     /**
 375:      * Set the value of [programversion] column.
 376:      *
 377:      * @param string $v new value
 378:      * @return Analysis The current object (for fluent API support)
 379:      */
 380:     public function setProgramversion($v)
 381:     {
 382:         if ($v !== null && is_numeric($v)) {
 383:             $v = (string) $v;
 384:         }
 385: 
 386:         if ($this->programversion !== $v) {
 387:             $this->programversion = $v;
 388:             $this->modifiedColumns[] = AnalysisPeer::PROGRAMVERSION;
 389:         }
 390: 
 391: 
 392:         return $this;
 393:     } // setProgramversion()
 394: 
 395:     /**
 396:      * Set the value of [algorithm] column.
 397:      *
 398:      * @param string $v new value
 399:      * @return Analysis The current object (for fluent API support)
 400:      */
 401:     public function setAlgorithm($v)
 402:     {
 403:         if ($v !== null && is_numeric($v)) {
 404:             $v = (string) $v;
 405:         }
 406: 
 407:         if ($this->algorithm !== $v) {
 408:             $this->algorithm = $v;
 409:             $this->modifiedColumns[] = AnalysisPeer::ALGORITHM;
 410:         }
 411: 
 412: 
 413:         return $this;
 414:     } // setAlgorithm()
 415: 
 416:     /**
 417:      * Set the value of [sourcename] column.
 418:      *
 419:      * @param string $v new value
 420:      * @return Analysis The current object (for fluent API support)
 421:      */
 422:     public function setSourcename($v)
 423:     {
 424:         if ($v !== null && is_numeric($v)) {
 425:             $v = (string) $v;
 426:         }
 427: 
 428:         if ($this->sourcename !== $v) {
 429:             $this->sourcename = $v;
 430:             $this->modifiedColumns[] = AnalysisPeer::SOURCENAME;
 431:         }
 432: 
 433: 
 434:         return $this;
 435:     } // setSourcename()
 436: 
 437:     /**
 438:      * Set the value of [sourceversion] column.
 439:      *
 440:      * @param string $v new value
 441:      * @return Analysis The current object (for fluent API support)
 442:      */
 443:     public function setSourceversion($v)
 444:     {
 445:         if ($v !== null && is_numeric($v)) {
 446:             $v = (string) $v;
 447:         }
 448: 
 449:         if ($this->sourceversion !== $v) {
 450:             $this->sourceversion = $v;
 451:             $this->modifiedColumns[] = AnalysisPeer::SOURCEVERSION;
 452:         }
 453: 
 454: 
 455:         return $this;
 456:     } // setSourceversion()
 457: 
 458:     /**
 459:      * Set the value of [sourceuri] column.
 460:      *
 461:      * @param string $v new value
 462:      * @return Analysis The current object (for fluent API support)
 463:      */
 464:     public function setSourceuri($v)
 465:     {
 466:         if ($v !== null && is_numeric($v)) {
 467:             $v = (string) $v;
 468:         }
 469: 
 470:         if ($this->sourceuri !== $v) {
 471:             $this->sourceuri = $v;
 472:             $this->modifiedColumns[] = AnalysisPeer::SOURCEURI;
 473:         }
 474: 
 475: 
 476:         return $this;
 477:     } // setSourceuri()
 478: 
 479:     /**
 480:      * Sets the value of [timeexecuted] column to a normalized version of the date/time value specified.
 481:      *
 482:      * @param mixed $v string, integer (timestamp), or DateTime value.
 483:      *               Empty strings are treated as null.
 484:      * @return Analysis The current object (for fluent API support)
 485:      */
 486:     public function setTimeexecuted($v)
 487:     {
 488:         $dt = PropelDateTime::newInstance($v, null, 'DateTime');
 489:         if ($this->timeexecuted !== null || $dt !== null) {
 490:             $currentDateAsString = ($this->timeexecuted !== null && $tmpDt = new DateTime($this->timeexecuted)) ? $tmpDt->format('Y-m-d H:i:s') : null;
 491:             $newDateAsString = $dt ? $dt->format('Y-m-d H:i:s') : null;
 492:             if ($currentDateAsString !== $newDateAsString) {
 493:                 $this->timeexecuted = $newDateAsString;
 494:                 $this->modifiedColumns[] = AnalysisPeer::TIMEEXECUTED;
 495:             }
 496:         } // if either are not null
 497: 
 498: 
 499:         return $this;
 500:     } // setTimeexecuted()
 501: 
 502:     /**
 503:      * Indicates whether the columns in this object are only set to default values.
 504:      *
 505:      * This method can be used in conjunction with isModified() to indicate whether an object is both
 506:      * modified _and_ has some values set which are non-default.
 507:      *
 508:      * @return boolean Whether the columns in this object are only been set with default values.
 509:      */
 510:     public function hasOnlyDefaultValues()
 511:     {
 512:         // otherwise, everything was equal, so return true
 513:         return true;
 514:     } // hasOnlyDefaultValues()
 515: 
 516:     /**
 517:      * Hydrates (populates) the object variables with values from the database resultset.
 518:      *
 519:      * An offset (0-based "start column") is specified so that objects can be hydrated
 520:      * with a subset of the columns in the resultset rows.  This is needed, for example,
 521:      * for results of JOIN queries where the resultset row includes columns from two or
 522:      * more tables.
 523:      *
 524:      * @param array $row The row returned by PDOStatement->fetch(PDO::FETCH_NUM)
 525:      * @param int $startcol 0-based offset column which indicates which restultset column to start with.
 526:      * @param boolean $rehydrate Whether this object is being re-hydrated from the database.
 527:      * @return int             next starting column
 528:      * @throws PropelException - Any caught Exception will be rewrapped as a PropelException.
 529:      */
 530:     public function hydrate($row, $startcol = 0, $rehydrate = false)
 531:     {
 532:         try {
 533: 
 534:             $this->analysis_id = ($row[$startcol + 0] !== null) ? (int) $row[$startcol + 0] : null;
 535:             $this->name = ($row[$startcol + 1] !== null) ? (string) $row[$startcol + 1] : null;
 536:             $this->description = ($row[$startcol + 2] !== null) ? (string) $row[$startcol + 2] : null;
 537:             $this->program = ($row[$startcol + 3] !== null) ? (string) $row[$startcol + 3] : null;
 538:             $this->programversion = ($row[$startcol + 4] !== null) ? (string) $row[$startcol + 4] : null;
 539:             $this->algorithm = ($row[$startcol + 5] !== null) ? (string) $row[$startcol + 5] : null;
 540:             $this->sourcename = ($row[$startcol + 6] !== null) ? (string) $row[$startcol + 6] : null;
 541:             $this->sourceversion = ($row[$startcol + 7] !== null) ? (string) $row[$startcol + 7] : null;
 542:             $this->sourceuri = ($row[$startcol + 8] !== null) ? (string) $row[$startcol + 8] : null;
 543:             $this->timeexecuted = ($row[$startcol + 9] !== null) ? (string) $row[$startcol + 9] : null;
 544:             $this->resetModified();
 545: 
 546:             $this->setNew(false);
 547: 
 548:             if ($rehydrate) {
 549:                 $this->ensureConsistency();
 550:             }
 551:             $this->postHydrate($row, $startcol, $rehydrate);
 552:             return $startcol + 10; // 10 = AnalysisPeer::NUM_HYDRATE_COLUMNS.
 553: 
 554:         } catch (Exception $e) {
 555:             throw new PropelException("Error populating Analysis object", $e);
 556:         }
 557:     }
 558: 
 559:     /**
 560:      * Checks and repairs the internal consistency of the object.
 561:      *
 562:      * This method is executed after an already-instantiated object is re-hydrated
 563:      * from the database.  It exists to check any foreign keys to make sure that
 564:      * the objects related to the current object are correct based on foreign key.
 565:      *
 566:      * You can override this method in the stub class, but you should always invoke
 567:      * the base method from the overridden method (i.e. parent::ensureConsistency()),
 568:      * in case your model changes.
 569:      *
 570:      * @throws PropelException
 571:      */
 572:     public function ensureConsistency()
 573:     {
 574: 
 575:     } // ensureConsistency
 576: 
 577:     /**
 578:      * Reloads this object from datastore based on primary key and (optionally) resets all associated objects.
 579:      *
 580:      * This will only work if the object has been saved and has a valid primary key set.
 581:      *
 582:      * @param boolean $deep (optional) Whether to also de-associated any related objects.
 583:      * @param PropelPDO $con (optional) The PropelPDO connection to use.
 584:      * @return void
 585:      * @throws PropelException - if this object is deleted, unsaved or doesn't have pk match in db
 586:      */
 587:     public function reload($deep = false, PropelPDO $con = null)
 588:     {
 589:         if ($this->isDeleted()) {
 590:             throw new PropelException("Cannot reload a deleted object.");
 591:         }
 592: 
 593:         if ($this->isNew()) {
 594:             throw new PropelException("Cannot reload an unsaved object.");
 595:         }
 596: 
 597:         if ($con === null) {
 598:             $con = Propel::getConnection(AnalysisPeer::DATABASE_NAME, Propel::CONNECTION_READ);
 599:         }
 600: 
 601:         // We don't need to alter the object instance pool; we're just modifying this instance
 602:         // already in the pool.
 603: 
 604:         $stmt = AnalysisPeer::doSelectStmt($this->buildPkeyCriteria(), $con);
 605:         $row = $stmt->fetch(PDO::FETCH_NUM);
 606:         $stmt->closeCursor();
 607:         if (!$row) {
 608:             throw new PropelException('Cannot find matching row in the database to reload object values.');
 609:         }
 610:         $this->hydrate($row, 0, true); // rehydrate
 611: 
 612:         if ($deep) {  // also de-associate any related objects?
 613: 
 614:             $this->collQuantifications = null;
 615: 
 616:         } // if (deep)
 617:     }
 618: 
 619:     /**
 620:      * Removes this object from datastore and sets delete attribute.
 621:      *
 622:      * @param PropelPDO $con
 623:      * @return void
 624:      * @throws PropelException
 625:      * @throws Exception
 626:      * @see        BaseObject::setDeleted()
 627:      * @see        BaseObject::isDeleted()
 628:      */
 629:     public function delete(PropelPDO $con = null)
 630:     {
 631:         if ($this->isDeleted()) {
 632:             throw new PropelException("This object has already been deleted.");
 633:         }
 634: 
 635:         if ($con === null) {
 636:             $con = Propel::getConnection(AnalysisPeer::DATABASE_NAME, Propel::CONNECTION_WRITE);
 637:         }
 638: 
 639:         $con->beginTransaction();
 640:         try {
 641:             $deleteQuery = AnalysisQuery::create()
 642:                 ->filterByPrimaryKey($this->getPrimaryKey());
 643:             $ret = $this->preDelete($con);
 644:             if ($ret) {
 645:                 $deleteQuery->delete($con);
 646:                 $this->postDelete($con);
 647:                 $con->commit();
 648:                 $this->setDeleted(true);
 649:             } else {
 650:                 $con->commit();
 651:             }
 652:         } catch (Exception $e) {
 653:             $con->rollBack();
 654:             throw $e;
 655:         }
 656:     }
 657: 
 658:     /**
 659:      * Persists this object to the database.
 660:      *
 661:      * If the object is new, it inserts it; otherwise an update is performed.
 662:      * All modified related objects will also be persisted in the doSave()
 663:      * method.  This method wraps all precipitate database operations in a
 664:      * single transaction.
 665:      *
 666:      * @param PropelPDO $con
 667:      * @return int             The number of rows affected by this insert/update and any referring fk objects' save() operations.
 668:      * @throws PropelException
 669:      * @throws Exception
 670:      * @see        doSave()
 671:      */
 672:     public function save(PropelPDO $con = null)
 673:     {
 674:         if ($this->isDeleted()) {
 675:             throw new PropelException("You cannot save an object that has been deleted.");
 676:         }
 677: 
 678:         if ($con === null) {
 679:             $con = Propel::getConnection(AnalysisPeer::DATABASE_NAME, Propel::CONNECTION_WRITE);
 680:         }
 681: 
 682:         $con->beginTransaction();
 683:         $isInsert = $this->isNew();
 684:         try {
 685:             $ret = $this->preSave($con);
 686:             if ($isInsert) {
 687:                 $ret = $ret && $this->preInsert($con);
 688:             } else {
 689:                 $ret = $ret && $this->preUpdate($con);
 690:             }
 691:             if ($ret) {
 692:                 $affectedRows = $this->doSave($con);
 693:                 if ($isInsert) {
 694:                     $this->postInsert($con);
 695:                 } else {
 696:                     $this->postUpdate($con);
 697:                 }
 698:                 $this->postSave($con);
 699:                 AnalysisPeer::addInstanceToPool($this);
 700:             } else {
 701:                 $affectedRows = 0;
 702:             }
 703:             $con->commit();
 704: 
 705:             return $affectedRows;
 706:         } catch (Exception $e) {
 707:             $con->rollBack();
 708:             throw $e;
 709:         }
 710:     }
 711: 
 712:     /**
 713:      * Performs the work of inserting or updating the row in the database.
 714:      *
 715:      * If the object is new, it inserts it; otherwise an update is performed.
 716:      * All related objects are also updated in this method.
 717:      *
 718:      * @param PropelPDO $con
 719:      * @return int             The number of rows affected by this insert/update and any referring fk objects' save() operations.
 720:      * @throws PropelException
 721:      * @see        save()
 722:      */
 723:     protected function doSave(PropelPDO $con)
 724:     {
 725:         $affectedRows = 0; // initialize var to track total num of affected rows
 726:         if (!$this->alreadyInSave) {
 727:             $this->alreadyInSave = true;
 728: 
 729:             if ($this->isNew() || $this->isModified()) {
 730:                 // persist changes
 731:                 if ($this->isNew()) {
 732:                     $this->doInsert($con);
 733:                 } else {
 734:                     $this->doUpdate($con);
 735:                 }
 736:                 $affectedRows += 1;
 737:                 $this->resetModified();
 738:             }
 739: 
 740:             if ($this->quantificationsScheduledForDeletion !== null) {
 741:                 if (!$this->quantificationsScheduledForDeletion->isEmpty()) {
 742:                     QuantificationQuery::create()
 743:                         ->filterByPrimaryKeys($this->quantificationsScheduledForDeletion->getPrimaryKeys(false))
 744:                         ->delete($con);
 745:                     $this->quantificationsScheduledForDeletion = null;
 746:                 }
 747:             }
 748: 
 749:             if ($this->collQuantifications !== null) {
 750:                 foreach ($this->collQuantifications as $referrerFK) {
 751:                     if (!$referrerFK->isDeleted() && ($referrerFK->isNew() || $referrerFK->isModified())) {
 752:                         $affectedRows += $referrerFK->save($con);
 753:                     }
 754:                 }
 755:             }
 756: 
 757:             $this->alreadyInSave = false;
 758: 
 759:         }
 760: 
 761:         return $affectedRows;
 762:     } // doSave()
 763: 
 764:     /**
 765:      * Insert the row in the database.
 766:      *
 767:      * @param PropelPDO $con
 768:      *
 769:      * @throws PropelException
 770:      * @see        doSave()
 771:      */
 772:     protected function doInsert(PropelPDO $con)
 773:     {
 774:         $modifiedColumns = array();
 775:         $index = 0;
 776: 
 777:         $this->modifiedColumns[] = AnalysisPeer::ANALYSIS_ID;
 778:         if (null !== $this->analysis_id) {
 779:             throw new PropelException('Cannot insert a value for auto-increment primary key (' . AnalysisPeer::ANALYSIS_ID . ')');
 780:         }
 781:         if (null === $this->analysis_id) {
 782:             try {
 783:                 $stmt = $con->query("SELECT nextval('analysis_analysis_id_seq')");
 784:                 $row = $stmt->fetch(PDO::FETCH_NUM);
 785:                 $this->analysis_id = $row[0];
 786:             } catch (Exception $e) {
 787:                 throw new PropelException('Unable to get sequence id.', $e);
 788:             }
 789:         }
 790: 
 791: 
 792:          // check the columns in natural order for more readable SQL queries
 793:         if ($this->isColumnModified(AnalysisPeer::ANALYSIS_ID)) {
 794:             $modifiedColumns[':p' . $index++]  = '"analysis_id"';
 795:         }
 796:         if ($this->isColumnModified(AnalysisPeer::NAME)) {
 797:             $modifiedColumns[':p' . $index++]  = '"name"';
 798:         }
 799:         if ($this->isColumnModified(AnalysisPeer::DESCRIPTION)) {
 800:             $modifiedColumns[':p' . $index++]  = '"description"';
 801:         }
 802:         if ($this->isColumnModified(AnalysisPeer::PROGRAM)) {
 803:             $modifiedColumns[':p' . $index++]  = '"program"';
 804:         }
 805:         if ($this->isColumnModified(AnalysisPeer::PROGRAMVERSION)) {
 806:             $modifiedColumns[':p' . $index++]  = '"programversion"';
 807:         }
 808:         if ($this->isColumnModified(AnalysisPeer::ALGORITHM)) {
 809:             $modifiedColumns[':p' . $index++]  = '"algorithm"';
 810:         }
 811:         if ($this->isColumnModified(AnalysisPeer::SOURCENAME)) {
 812:             $modifiedColumns[':p' . $index++]  = '"sourcename"';
 813:         }
 814:         if ($this->isColumnModified(AnalysisPeer::SOURCEVERSION)) {
 815:             $modifiedColumns[':p' . $index++]  = '"sourceversion"';
 816:         }
 817:         if ($this->isColumnModified(AnalysisPeer::SOURCEURI)) {
 818:             $modifiedColumns[':p' . $index++]  = '"sourceuri"';
 819:         }
 820:         if ($this->isColumnModified(AnalysisPeer::TIMEEXECUTED)) {
 821:             $modifiedColumns[':p' . $index++]  = '"timeexecuted"';
 822:         }
 823: 
 824:         $sql = sprintf(
 825:             'INSERT INTO "analysis" (%s) VALUES (%s)',
 826:             implode(', ', $modifiedColumns),
 827:             implode(', ', array_keys($modifiedColumns))
 828:         );
 829: 
 830:         try {
 831:             $stmt = $con->prepare($sql);
 832:             foreach ($modifiedColumns as $identifier => $columnName) {
 833:                 switch ($columnName) {
 834:                     case '"analysis_id"':
 835:                         $stmt->bindValue($identifier, $this->analysis_id, PDO::PARAM_INT);
 836:                         break;
 837:                     case '"name"':
 838:                         $stmt->bindValue($identifier, $this->name, PDO::PARAM_STR);
 839:                         break;
 840:                     case '"description"':
 841:                         $stmt->bindValue($identifier, $this->description, PDO::PARAM_STR);
 842:                         break;
 843:                     case '"program"':
 844:                         $stmt->bindValue($identifier, $this->program, PDO::PARAM_STR);
 845:                         break;
 846:                     case '"programversion"':
 847:                         $stmt->bindValue($identifier, $this->programversion, PDO::PARAM_STR);
 848:                         break;
 849:                     case '"algorithm"':
 850:                         $stmt->bindValue($identifier, $this->algorithm, PDO::PARAM_STR);
 851:                         break;
 852:                     case '"sourcename"':
 853:                         $stmt->bindValue($identifier, $this->sourcename, PDO::PARAM_STR);
 854:                         break;
 855:                     case '"sourceversion"':
 856:                         $stmt->bindValue($identifier, $this->sourceversion, PDO::PARAM_STR);
 857:                         break;
 858:                     case '"sourceuri"':
 859:                         $stmt->bindValue($identifier, $this->sourceuri, PDO::PARAM_STR);
 860:                         break;
 861:                     case '"timeexecuted"':
 862:                         $stmt->bindValue($identifier, $this->timeexecuted, PDO::PARAM_STR);
 863:                         break;
 864:                 }
 865:             }
 866:             $stmt->execute();
 867:         } catch (Exception $e) {
 868:             Propel::log($e->getMessage(), Propel::LOG_ERR);
 869:             throw new PropelException(sprintf('Unable to execute INSERT statement [%s]', $sql), $e);
 870:         }
 871: 
 872:         $this->setNew(false);
 873:     }
 874: 
 875:     /**
 876:      * Update the row in the database.
 877:      *
 878:      * @param PropelPDO $con
 879:      *
 880:      * @see        doSave()
 881:      */
 882:     protected function doUpdate(PropelPDO $con)
 883:     {
 884:         $selectCriteria = $this->buildPkeyCriteria();
 885:         $valuesCriteria = $this->buildCriteria();
 886:         BasePeer::doUpdate($selectCriteria, $valuesCriteria, $con);
 887:     }
 888: 
 889:     /**
 890:      * Array of ValidationFailed objects.
 891:      * @var        array ValidationFailed[]
 892:      */
 893:     protected $validationFailures = array();
 894: 
 895:     /**
 896:      * Gets any ValidationFailed objects that resulted from last call to validate().
 897:      *
 898:      *
 899:      * @return array ValidationFailed[]
 900:      * @see        validate()
 901:      */
 902:     public function getValidationFailures()
 903:     {
 904:         return $this->validationFailures;
 905:     }
 906: 
 907:     /**
 908:      * Validates the objects modified field values and all objects related to this table.
 909:      *
 910:      * If $columns is either a column name or an array of column names
 911:      * only those columns are validated.
 912:      *
 913:      * @param mixed $columns Column name or an array of column names.
 914:      * @return boolean Whether all columns pass validation.
 915:      * @see        doValidate()
 916:      * @see        getValidationFailures()
 917:      */
 918:     public function validate($columns = null)
 919:     {
 920:         $res = $this->doValidate($columns);
 921:         if ($res === true) {
 922:             $this->validationFailures = array();
 923: 
 924:             return true;
 925:         }
 926: 
 927:         $this->validationFailures = $res;
 928: 
 929:         return false;
 930:     }
 931: 
 932:     /**
 933:      * This function performs the validation work for complex object models.
 934:      *
 935:      * In addition to checking the current object, all related objects will
 936:      * also be validated.  If all pass then <code>true</code> is returned; otherwise
 937:      * an aggreagated array of ValidationFailed objects will be returned.
 938:      *
 939:      * @param array $columns Array of column names to validate.
 940:      * @return mixed <code>true</code> if all validations pass; array of <code>ValidationFailed</code> objets otherwise.
 941:      */
 942:     protected function doValidate($columns = null)
 943:     {
 944:         if (!$this->alreadyInValidation) {
 945:             $this->alreadyInValidation = true;
 946:             $retval = null;
 947: 
 948:             $failureMap = array();
 949: 
 950: 
 951:             if (($retval = AnalysisPeer::doValidate($this, $columns)) !== true) {
 952:                 $failureMap = array_merge($failureMap, $retval);
 953:             }
 954: 
 955: 
 956:                 if ($this->collQuantifications !== null) {
 957:                     foreach ($this->collQuantifications as $referrerFK) {
 958:                         if (!$referrerFK->validate($columns)) {
 959:                             $failureMap = array_merge($failureMap, $referrerFK->getValidationFailures());
 960:                         }
 961:                     }
 962:                 }
 963: 
 964: 
 965:             $this->alreadyInValidation = false;
 966:         }
 967: 
 968:         return (!empty($failureMap) ? $failureMap : true);
 969:     }
 970: 
 971:     /**
 972:      * Retrieves a field from the object by name passed in as a string.
 973:      *
 974:      * @param string $name name
 975:      * @param string $type The type of fieldname the $name is of:
 976:      *               one of the class type constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME
 977:      *               BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM.
 978:      *               Defaults to BasePeer::TYPE_PHPNAME
 979:      * @return mixed Value of field.
 980:      */
 981:     public function getByName($name, $type = BasePeer::TYPE_PHPNAME)
 982:     {
 983:         $pos = AnalysisPeer::translateFieldName($name, $type, BasePeer::TYPE_NUM);
 984:         $field = $this->getByPosition($pos);
 985: 
 986:         return $field;
 987:     }
 988: 
 989:     /**
 990:      * Retrieves a field from the object by Position as specified in the xml schema.
 991:      * Zero-based.
 992:      *
 993:      * @param int $pos position in xml schema
 994:      * @return mixed Value of field at $pos
 995:      */
 996:     public function getByPosition($pos)
 997:     {
 998:         switch ($pos) {
 999:             case 0:
1000:                 return $this->getAnalysisId();
1001:                 break;
1002:             case 1:
1003:                 return $this->getName();
1004:                 break;
1005:             case 2:
1006:                 return $this->getDescription();
1007:                 break;
1008:             case 3:
1009:                 return $this->getProgram();
1010:                 break;
1011:             case 4:
1012:                 return $this->getProgramversion();
1013:                 break;
1014:             case 5:
1015:                 return $this->getAlgorithm();
1016:                 break;
1017:             case 6:
1018:                 return $this->getSourcename();
1019:                 break;
1020:             case 7:
1021:                 return $this->getSourceversion();
1022:                 break;
1023:             case 8:
1024:                 return $this->getSourceuri();
1025:                 break;
1026:             case 9:
1027:                 return $this->getTimeexecuted();
1028:                 break;
1029:             default:
1030:                 return null;
1031:                 break;
1032:         } // switch()
1033:     }
1034: 
1035:     /**
1036:      * Exports the object as an array.
1037:      *
1038:      * You can specify the key type of the array by passing one of the class
1039:      * type constants.
1040:      *
1041:      * @param     string  $keyType (optional) One of the class type constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME,
1042:      *                    BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM.
1043:      *                    Defaults to BasePeer::TYPE_PHPNAME.
1044:      * @param     boolean $includeLazyLoadColumns (optional) Whether to include lazy loaded columns. Defaults to true.
1045:      * @param     array $alreadyDumpedObjects List of objects to skip to avoid recursion
1046:      * @param     boolean $includeForeignObjects (optional) Whether to include hydrated related objects. Default to FALSE.
1047:      *
1048:      * @return array an associative array containing the field names (as keys) and field values
1049:      */
1050:     public function toArray($keyType = BasePeer::TYPE_PHPNAME, $includeLazyLoadColumns = true, $alreadyDumpedObjects = array(), $includeForeignObjects = false)
1051:     {
1052:         if (isset($alreadyDumpedObjects['Analysis'][$this->getPrimaryKey()])) {
1053:             return '*RECURSION*';
1054:         }
1055:         $alreadyDumpedObjects['Analysis'][$this->getPrimaryKey()] = true;
1056:         $keys = AnalysisPeer::getFieldNames($keyType);
1057:         $result = array(
1058:             $keys[0] => $this->getAnalysisId(),
1059:             $keys[1] => $this->getName(),
1060:             $keys[2] => $this->getDescription(),
1061:             $keys[3] => $this->getProgram(),
1062:             $keys[4] => $this->getProgramversion(),
1063:             $keys[5] => $this->getAlgorithm(),
1064:             $keys[6] => $this->getSourcename(),
1065:             $keys[7] => $this->getSourceversion(),
1066:             $keys[8] => $this->getSourceuri(),
1067:             $keys[9] => $this->getTimeexecuted(),
1068:         );
1069:         if ($includeForeignObjects) {
1070:             if (null !== $this->collQuantifications) {
1071:                 $result['Quantifications'] = $this->collQuantifications->toArray(null, true, $keyType, $includeLazyLoadColumns, $alreadyDumpedObjects);
1072:             }
1073:         }
1074: 
1075:         return $result;
1076:     }
1077: 
1078:     /**
1079:      * Sets a field from the object by name passed in as a string.
1080:      *
1081:      * @param string $name peer name
1082:      * @param mixed $value field value
1083:      * @param string $type The type of fieldname the $name is of:
1084:      *                     one of the class type constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME
1085:      *                     BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM.
1086:      *                     Defaults to BasePeer::TYPE_PHPNAME
1087:      * @return void
1088:      */
1089:     public function setByName($name, $value, $type = BasePeer::TYPE_PHPNAME)
1090:     {
1091:         $pos = AnalysisPeer::translateFieldName($name, $type, BasePeer::TYPE_NUM);
1092: 
1093:         $this->setByPosition($pos, $value);
1094:     }
1095: 
1096:     /**
1097:      * Sets a field from the object by Position as specified in the xml schema.
1098:      * Zero-based.
1099:      *
1100:      * @param int $pos position in xml schema
1101:      * @param mixed $value field value
1102:      * @return void
1103:      */
1104:     public function setByPosition($pos, $value)
1105:     {
1106:         switch ($pos) {
1107:             case 0:
1108:                 $this->setAnalysisId($value);
1109:                 break;
1110:             case 1:
1111:                 $this->setName($value);
1112:                 break;
1113:             case 2:
1114:                 $this->setDescription($value);
1115:                 break;
1116:             case 3:
1117:                 $this->setProgram($value);
1118:                 break;
1119:             case 4:
1120:                 $this->setProgramversion($value);
1121:                 break;
1122:             case 5:
1123:                 $this->setAlgorithm($value);
1124:                 break;
1125:             case 6:
1126:                 $this->setSourcename($value);
1127:                 break;
1128:             case 7:
1129:                 $this->setSourceversion($value);
1130:                 break;
1131:             case 8:
1132:                 $this->setSourceuri($value);
1133:                 break;
1134:             case 9:
1135:                 $this->setTimeexecuted($value);
1136:                 break;
1137:         } // switch()
1138:     }
1139: 
1140:     /**
1141:      * Populates the object using an array.
1142:      *
1143:      * This is particularly useful when populating an object from one of the
1144:      * request arrays (e.g. $_POST).  This method goes through the column
1145:      * names, checking to see whether a matching key exists in populated
1146:      * array. If so the setByName() method is called for that column.
1147:      *
1148:      * You can specify the key type of the array by additionally passing one
1149:      * of the class type constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME,
1150:      * BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM.
1151:      * The default key type is the column's BasePeer::TYPE_PHPNAME
1152:      *
1153:      * @param array  $arr     An array to populate the object from.
1154:      * @param string $keyType The type of keys the array uses.
1155:      * @return void
1156:      */
1157:     public function fromArray($arr, $keyType = BasePeer::TYPE_PHPNAME)
1158:     {
1159:         $keys = AnalysisPeer::getFieldNames($keyType);
1160: 
1161:         if (array_key_exists($keys[0], $arr)) $this->setAnalysisId($arr[$keys[0]]);
1162:         if (array_key_exists($keys[1], $arr)) $this->setName($arr[$keys[1]]);
1163:         if (array_key_exists($keys[2], $arr)) $this->setDescription($arr[$keys[2]]);
1164:         if (array_key_exists($keys[3], $arr)) $this->setProgram($arr[$keys[3]]);
1165:         if (array_key_exists($keys[4], $arr)) $this->setProgramversion($arr[$keys[4]]);
1166:         if (array_key_exists($keys[5], $arr)) $this->setAlgorithm($arr[$keys[5]]);
1167:         if (array_key_exists($keys[6], $arr)) $this->setSourcename($arr[$keys[6]]);
1168:         if (array_key_exists($keys[7], $arr)) $this->setSourceversion($arr[$keys[7]]);
1169:         if (array_key_exists($keys[8], $arr)) $this->setSourceuri($arr[$keys[8]]);
1170:         if (array_key_exists($keys[9], $arr)) $this->setTimeexecuted($arr[$keys[9]]);
1171:     }
1172: 
1173:     /**
1174:      * Build a Criteria object containing the values of all modified columns in this object.
1175:      *
1176:      * @return Criteria The Criteria object containing all modified values.
1177:      */
1178:     public function buildCriteria()
1179:     {
1180:         $criteria = new Criteria(AnalysisPeer::DATABASE_NAME);
1181: 
1182:         if ($this->isColumnModified(AnalysisPeer::ANALYSIS_ID)) $criteria->add(AnalysisPeer::ANALYSIS_ID, $this->analysis_id);
1183:         if ($this->isColumnModified(AnalysisPeer::NAME)) $criteria->add(AnalysisPeer::NAME, $this->name);
1184:         if ($this->isColumnModified(AnalysisPeer::DESCRIPTION)) $criteria->add(AnalysisPeer::DESCRIPTION, $this->description);
1185:         if ($this->isColumnModified(AnalysisPeer::PROGRAM)) $criteria->add(AnalysisPeer::PROGRAM, $this->program);
1186:         if ($this->isColumnModified(AnalysisPeer::PROGRAMVERSION)) $criteria->add(AnalysisPeer::PROGRAMVERSION, $this->programversion);
1187:         if ($this->isColumnModified(AnalysisPeer::ALGORITHM)) $criteria->add(AnalysisPeer::ALGORITHM, $this->algorithm);
1188:         if ($this->isColumnModified(AnalysisPeer::SOURCENAME)) $criteria->add(AnalysisPeer::SOURCENAME, $this->sourcename);
1189:         if ($this->isColumnModified(AnalysisPeer::SOURCEVERSION)) $criteria->add(AnalysisPeer::SOURCEVERSION, $this->sourceversion);
1190:         if ($this->isColumnModified(AnalysisPeer::SOURCEURI)) $criteria->add(AnalysisPeer::SOURCEURI, $this->sourceuri);
1191:         if ($this->isColumnModified(AnalysisPeer::TIMEEXECUTED)) $criteria->add(AnalysisPeer::TIMEEXECUTED, $this->timeexecuted);
1192: 
1193:         return $criteria;
1194:     }
1195: 
1196:     /**
1197:      * Builds a Criteria object containing the primary key for this object.
1198:      *
1199:      * Unlike buildCriteria() this method includes the primary key values regardless
1200:      * of whether or not they have been modified.
1201:      *
1202:      * @return Criteria The Criteria object containing value(s) for primary key(s).
1203:      */
1204:     public function buildPkeyCriteria()
1205:     {
1206:         $criteria = new Criteria(AnalysisPeer::DATABASE_NAME);
1207:         $criteria->add(AnalysisPeer::ANALYSIS_ID, $this->analysis_id);
1208: 
1209:         return $criteria;
1210:     }
1211: 
1212:     /**
1213:      * Returns the primary key for this object (row).
1214:      * @return int
1215:      */
1216:     public function getPrimaryKey()
1217:     {
1218:         return $this->getAnalysisId();
1219:     }
1220: 
1221:     /**
1222:      * Generic method to set the primary key (analysis_id column).
1223:      *
1224:      * @param  int $key Primary key.
1225:      * @return void
1226:      */
1227:     public function setPrimaryKey($key)
1228:     {
1229:         $this->setAnalysisId($key);
1230:     }
1231: 
1232:     /**
1233:      * Returns true if the primary key for this object is null.
1234:      * @return boolean
1235:      */
1236:     public function isPrimaryKeyNull()
1237:     {
1238: 
1239:         return null === $this->getAnalysisId();
1240:     }
1241: 
1242:     /**
1243:      * Sets contents of passed object to values from current object.
1244:      *
1245:      * If desired, this method can also make copies of all associated (fkey referrers)
1246:      * objects.
1247:      *
1248:      * @param object $copyObj An object of Analysis (or compatible) type.
1249:      * @param boolean $deepCopy Whether to also copy all rows that refer (by fkey) to the current row.
1250:      * @param boolean $makeNew Whether to reset autoincrement PKs and make the object new.
1251:      * @throws PropelException
1252:      */
1253:     public function copyInto($copyObj, $deepCopy = false, $makeNew = true)
1254:     {
1255:         $copyObj->setName($this->getName());
1256:         $copyObj->setDescription($this->getDescription());
1257:         $copyObj->setProgram($this->getProgram());
1258:         $copyObj->setProgramversion($this->getProgramversion());
1259:         $copyObj->setAlgorithm($this->getAlgorithm());
1260:         $copyObj->setSourcename($this->getSourcename());
1261:         $copyObj->setSourceversion($this->getSourceversion());
1262:         $copyObj->setSourceuri($this->getSourceuri());
1263:         $copyObj->setTimeexecuted($this->getTimeexecuted());
1264: 
1265:         if ($deepCopy && !$this->startCopy) {
1266:             // important: temporarily setNew(false) because this affects the behavior of
1267:             // the getter/setter methods for fkey referrer objects.
1268:             $copyObj->setNew(false);
1269:             // store object hash to prevent cycle
1270:             $this->startCopy = true;
1271: 
1272:             foreach ($this->getQuantifications() as $relObj) {
1273:                 if ($relObj !== $this) {  // ensure that we don't try to copy a reference to ourselves
1274:                     $copyObj->addQuantification($relObj->copy($deepCopy));
1275:                 }
1276:             }
1277: 
1278:             //unflag object copy
1279:             $this->startCopy = false;
1280:         } // if ($deepCopy)
1281: 
1282:         if ($makeNew) {
1283:             $copyObj->setNew(true);
1284:             $copyObj->setAnalysisId(NULL); // this is a auto-increment column, so set to default value
1285:         }
1286:     }
1287: 
1288:     /**
1289:      * Makes a copy of this object that will be inserted as a new row in table when saved.
1290:      * It creates a new object filling in the simple attributes, but skipping any primary
1291:      * keys that are defined for the table.
1292:      *
1293:      * If desired, this method can also make copies of all associated (fkey referrers)
1294:      * objects.
1295:      *
1296:      * @param boolean $deepCopy Whether to also copy all rows that refer (by fkey) to the current row.
1297:      * @return Analysis Clone of current object.
1298:      * @throws PropelException
1299:      */
1300:     public function copy($deepCopy = false)
1301:     {
1302:         // we use get_class(), because this might be a subclass
1303:         $clazz = get_class($this);
1304:         $copyObj = new $clazz();
1305:         $this->copyInto($copyObj, $deepCopy);
1306: 
1307:         return $copyObj;
1308:     }
1309: 
1310:     /**
1311:      * Returns a peer instance associated with this om.
1312:      *
1313:      * Since Peer classes are not to have any instance attributes, this method returns the
1314:      * same instance for all member of this class. The method could therefore
1315:      * be static, but this would prevent one from overriding the behavior.
1316:      *
1317:      * @return AnalysisPeer
1318:      */
1319:     public function getPeer()
1320:     {
1321:         if (self::$peer === null) {
1322:             self::$peer = new AnalysisPeer();
1323:         }
1324: 
1325:         return self::$peer;
1326:     }
1327: 
1328: 
1329:     /**
1330:      * Initializes a collection based on the name of a relation.
1331:      * Avoids crafting an 'init[$relationName]s' method name
1332:      * that wouldn't work when StandardEnglishPluralizer is used.
1333:      *
1334:      * @param string $relationName The name of the relation to initialize
1335:      * @return void
1336:      */
1337:     public function initRelation($relationName)
1338:     {
1339:         if ('Quantification' == $relationName) {
1340:             $this->initQuantifications();
1341:         }
1342:     }
1343: 
1344:     /**
1345:      * Clears out the collQuantifications collection
1346:      *
1347:      * This does not modify the database; however, it will remove any associated objects, causing
1348:      * them to be refetched by subsequent calls to accessor method.
1349:      *
1350:      * @return Analysis The current object (for fluent API support)
1351:      * @see        addQuantifications()
1352:      */
1353:     public function clearQuantifications()
1354:     {
1355:         $this->collQuantifications = null; // important to set this to null since that means it is uninitialized
1356:         $this->collQuantificationsPartial = null;
1357: 
1358:         return $this;
1359:     }
1360: 
1361:     /**
1362:      * reset is the collQuantifications collection loaded partially
1363:      *
1364:      * @return void
1365:      */
1366:     public function resetPartialQuantifications($v = true)
1367:     {
1368:         $this->collQuantificationsPartial = $v;
1369:     }
1370: 
1371:     /**
1372:      * Initializes the collQuantifications collection.
1373:      *
1374:      * By default this just sets the collQuantifications collection to an empty array (like clearcollQuantifications());
1375:      * however, you may wish to override this method in your stub class to provide setting appropriate
1376:      * to your application -- for example, setting the initial array to the values stored in database.
1377:      *
1378:      * @param boolean $overrideExisting If set to true, the method call initializes
1379:      *                                        the collection even if it is not empty
1380:      *
1381:      * @return void
1382:      */
1383:     public function initQuantifications($overrideExisting = true)
1384:     {
1385:         if (null !== $this->collQuantifications && !$overrideExisting) {
1386:             return;
1387:         }
1388:         $this->collQuantifications = new PropelObjectCollection();
1389:         $this->collQuantifications->setModel('Quantification');
1390:     }
1391: 
1392:     /**
1393:      * Gets an array of Quantification objects which contain a foreign key that references this object.
1394:      *
1395:      * If the $criteria is not null, it is used to always fetch the results from the database.
1396:      * Otherwise the results are fetched from the database the first time, then cached.
1397:      * Next time the same method is called without $criteria, the cached collection is returned.
1398:      * If this Analysis is new, it will return
1399:      * an empty collection or the current collection; the criteria is ignored on a new object.
1400:      *
1401:      * @param Criteria $criteria optional Criteria object to narrow the query
1402:      * @param PropelPDO $con optional connection object
1403:      * @return PropelObjectCollection|Quantification[] List of Quantification objects
1404:      * @throws PropelException
1405:      */
1406:     public function getQuantifications($criteria = null, PropelPDO $con = null)
1407:     {
1408:         $partial = $this->collQuantificationsPartial && !$this->isNew();
1409:         if (null === $this->collQuantifications || null !== $criteria  || $partial) {
1410:             if ($this->isNew() && null === $this->collQuantifications) {
1411:                 // return empty collection
1412:                 $this->initQuantifications();
1413:             } else {
1414:                 $collQuantifications = QuantificationQuery::create(null, $criteria)
1415:                     ->filterByAnalysis($this)
1416:                     ->find($con);
1417:                 if (null !== $criteria) {
1418:                     if (false !== $this->collQuantificationsPartial && count($collQuantifications)) {
1419:                       $this->initQuantifications(false);
1420: 
1421:                       foreach($collQuantifications as $obj) {
1422:                         if (false == $this->collQuantifications->contains($obj)) {
1423:                           $this->collQuantifications->append($obj);
1424:                         }
1425:                       }
1426: 
1427:                       $this->collQuantificationsPartial = true;
1428:                     }
1429: 
1430:                     $collQuantifications->getInternalIterator()->rewind();
1431:                     return $collQuantifications;
1432:                 }
1433: 
1434:                 if($partial && $this->collQuantifications) {
1435:                     foreach($this->collQuantifications as $obj) {
1436:                         if($obj->isNew()) {
1437:                             $collQuantifications[] = $obj;
1438:                         }
1439:                     }
1440:                 }
1441: 
1442:                 $this->collQuantifications = $collQuantifications;
1443:                 $this->collQuantificationsPartial = false;
1444:             }
1445:         }
1446: 
1447:         return $this->collQuantifications;
1448:     }
1449: 
1450:     /**
1451:      * Sets a collection of Quantification objects related by a one-to-many relationship
1452:      * to the current object.
1453:      * It will also schedule objects for deletion based on a diff between old objects (aka persisted)
1454:      * and new objects from the given Propel collection.
1455:      *
1456:      * @param PropelCollection $quantifications A Propel collection.
1457:      * @param PropelPDO $con Optional connection object
1458:      * @return Analysis The current object (for fluent API support)
1459:      */
1460:     public function setQuantifications(PropelCollection $quantifications, PropelPDO $con = null)
1461:     {
1462:         $quantificationsToDelete = $this->getQuantifications(new Criteria(), $con)->diff($quantifications);
1463: 
1464:         $this->quantificationsScheduledForDeletion = unserialize(serialize($quantificationsToDelete));
1465: 
1466:         foreach ($quantificationsToDelete as $quantificationRemoved) {
1467:             $quantificationRemoved->setAnalysis(null);
1468:         }
1469: 
1470:         $this->collQuantifications = null;
1471:         foreach ($quantifications as $quantification) {
1472:             $this->addQuantification($quantification);
1473:         }
1474: 
1475:         $this->collQuantifications = $quantifications;
1476:         $this->collQuantificationsPartial = false;
1477: 
1478:         return $this;
1479:     }
1480: 
1481:     /**
1482:      * Returns the number of related Quantification objects.
1483:      *
1484:      * @param Criteria $criteria
1485:      * @param boolean $distinct
1486:      * @param PropelPDO $con
1487:      * @return int             Count of related Quantification objects.
1488:      * @throws PropelException
1489:      */
1490:     public function countQuantifications(Criteria $criteria = null, $distinct = false, PropelPDO $con = null)
1491:     {
1492:         $partial = $this->collQuantificationsPartial && !$this->isNew();
1493:         if (null === $this->collQuantifications || null !== $criteria || $partial) {
1494:             if ($this->isNew() && null === $this->collQuantifications) {
1495:                 return 0;
1496:             }
1497: 
1498:             if($partial && !$criteria) {
1499:                 return count($this->getQuantifications());
1500:             }
1501:             $query = QuantificationQuery::create(null, $criteria);
1502:             if ($distinct) {
1503:                 $query->distinct();
1504:             }
1505: 
1506:             return $query
1507:                 ->filterByAnalysis($this)
1508:                 ->count($con);
1509:         }
1510: 
1511:         return count($this->collQuantifications);
1512:     }
1513: 
1514:     /**
1515:      * Method called to associate a Quantification object to this object
1516:      * through the Quantification foreign key attribute.
1517:      *
1518:      * @param    Quantification $l Quantification
1519:      * @return Analysis The current object (for fluent API support)
1520:      */
1521:     public function addQuantification(Quantification $l)
1522:     {
1523:         if ($this->collQuantifications === null) {
1524:             $this->initQuantifications();
1525:             $this->collQuantificationsPartial = true;
1526:         }
1527:         if (!in_array($l, $this->collQuantifications->getArrayCopy(), true)) { // only add it if the **same** object is not already associated
1528:             $this->doAddQuantification($l);
1529:         }
1530: 
1531:         return $this;
1532:     }
1533: 
1534:     /**
1535:      * @param   Quantification $quantification The quantification object to add.
1536:      */
1537:     protected function doAddQuantification($quantification)
1538:     {
1539:         $this->collQuantifications[]= $quantification;
1540:         $quantification->setAnalysis($this);
1541:     }
1542: 
1543:     /**
1544:      * @param   Quantification $quantification The quantification object to remove.
1545:      * @return Analysis The current object (for fluent API support)
1546:      */
1547:     public function removeQuantification($quantification)
1548:     {
1549:         if ($this->getQuantifications()->contains($quantification)) {
1550:             $this->collQuantifications->remove($this->collQuantifications->search($quantification));
1551:             if (null === $this->quantificationsScheduledForDeletion) {
1552:                 $this->quantificationsScheduledForDeletion = clone $this->collQuantifications;
1553:                 $this->quantificationsScheduledForDeletion->clear();
1554:             }
1555:             $this->quantificationsScheduledForDeletion[]= clone $quantification;
1556:             $quantification->setAnalysis(null);
1557:         }
1558: 
1559:         return $this;
1560:     }
1561: 
1562: 
1563:     /**
1564:      * If this collection has already been initialized with
1565:      * an identical criteria, it returns the collection.
1566:      * Otherwise if this Analysis is new, it will return
1567:      * an empty collection; or if this Analysis has previously
1568:      * been saved, it will retrieve related Quantifications from storage.
1569:      *
1570:      * This method is protected by default in order to keep the public
1571:      * api reasonable.  You can provide public methods for those you
1572:      * actually need in Analysis.
1573:      *
1574:      * @param Criteria $criteria optional Criteria object to narrow the query
1575:      * @param PropelPDO $con optional connection object
1576:      * @param string $join_behavior optional join type to use (defaults to Criteria::LEFT_JOIN)
1577:      * @return PropelObjectCollection|Quantification[] List of Quantification objects
1578:      */
1579:     public function getQuantificationsJoinAcquisition($criteria = null, $con = null, $join_behavior = Criteria::LEFT_JOIN)
1580:     {
1581:         $query = QuantificationQuery::create(null, $criteria);
1582:         $query->joinWith('Acquisition', $join_behavior);
1583: 
1584:         return $this->getQuantifications($query, $con);
1585:     }
1586: 
1587: 
1588:     /**
1589:      * If this collection has already been initialized with
1590:      * an identical criteria, it returns the collection.
1591:      * Otherwise if this Analysis is new, it will return
1592:      * an empty collection; or if this Analysis has previously
1593:      * been saved, it will retrieve related Quantifications from storage.
1594:      *
1595:      * This method is protected by default in order to keep the public
1596:      * api reasonable.  You can provide public methods for those you
1597:      * actually need in Analysis.
1598:      *
1599:      * @param Criteria $criteria optional Criteria object to narrow the query
1600:      * @param PropelPDO $con optional connection object
1601:      * @param string $join_behavior optional join type to use (defaults to Criteria::LEFT_JOIN)
1602:      * @return PropelObjectCollection|Quantification[] List of Quantification objects
1603:      */
1604:     public function getQuantificationsJoinContact($criteria = null, $con = null, $join_behavior = Criteria::LEFT_JOIN)
1605:     {
1606:         $query = QuantificationQuery::create(null, $criteria);
1607:         $query->joinWith('Contact', $join_behavior);
1608: 
1609:         return $this->getQuantifications($query, $con);
1610:     }
1611: 
1612: 
1613:     /**
1614:      * If this collection has already been initialized with
1615:      * an identical criteria, it returns the collection.
1616:      * Otherwise if this Analysis is new, it will return
1617:      * an empty collection; or if this Analysis has previously
1618:      * been saved, it will retrieve related Quantifications from storage.
1619:      *
1620:      * This method is protected by default in order to keep the public
1621:      * api reasonable.  You can provide public methods for those you
1622:      * actually need in Analysis.
1623:      *
1624:      * @param Criteria $criteria optional Criteria object to narrow the query
1625:      * @param PropelPDO $con optional connection object
1626:      * @param string $join_behavior optional join type to use (defaults to Criteria::LEFT_JOIN)
1627:      * @return PropelObjectCollection|Quantification[] List of Quantification objects
1628:      */
1629:     public function getQuantificationsJoinProtocol($criteria = null, $con = null, $join_behavior = Criteria::LEFT_JOIN)
1630:     {
1631:         $query = QuantificationQuery::create(null, $criteria);
1632:         $query->joinWith('Protocol', $join_behavior);
1633: 
1634:         return $this->getQuantifications($query, $con);
1635:     }
1636: 
1637:     /**
1638:      * Clears the current object and sets all attributes to their default values
1639:      */
1640:     public function clear()
1641:     {
1642:         $this->analysis_id = null;
1643:         $this->name = null;
1644:         $this->description = null;
1645:         $this->program = null;
1646:         $this->programversion = null;
1647:         $this->algorithm = null;
1648:         $this->sourcename = null;
1649:         $this->sourceversion = null;
1650:         $this->sourceuri = null;
1651:         $this->timeexecuted = null;
1652:         $this->alreadyInSave = false;
1653:         $this->alreadyInValidation = false;
1654:         $this->alreadyInClearAllReferencesDeep = false;
1655:         $this->clearAllReferences();
1656:         $this->applyDefaultValues();
1657:         $this->resetModified();
1658:         $this->setNew(true);
1659:         $this->setDeleted(false);
1660:     }
1661: 
1662:     /**
1663:      * Resets all references to other model objects or collections of model objects.
1664:      *
1665:      * This method is a user-space workaround for PHP's inability to garbage collect
1666:      * objects with circular references (even in PHP 5.3). This is currently necessary
1667:      * when using Propel in certain daemon or large-volumne/high-memory operations.
1668:      *
1669:      * @param boolean $deep Whether to also clear the references on all referrer objects.
1670:      */
1671:     public function clearAllReferences($deep = false)
1672:     {
1673:         if ($deep && !$this->alreadyInClearAllReferencesDeep) {
1674:             $this->alreadyInClearAllReferencesDeep = true;
1675:             if ($this->collQuantifications) {
1676:                 foreach ($this->collQuantifications as $o) {
1677:                     $o->clearAllReferences($deep);
1678:                 }
1679:             }
1680: 
1681:             $this->alreadyInClearAllReferencesDeep = false;
1682:         } // if ($deep)
1683: 
1684:         if ($this->collQuantifications instanceof PropelCollection) {
1685:             $this->collQuantifications->clearIterator();
1686:         }
1687:         $this->collQuantifications = null;
1688:     }
1689: 
1690:     /**
1691:      * return the string representation of this object
1692:      *
1693:      * @return string
1694:      */
1695:     public function __toString()
1696:     {
1697:         return (string) $this->exportTo(AnalysisPeer::DEFAULT_STRING_FORMAT);
1698:     }
1699: 
1700:     /**
1701:      * return true is the object is in saving state
1702:      *
1703:      * @return boolean
1704:      */
1705:     public function isAlreadyInSave()
1706:     {
1707:         return $this->alreadyInSave;
1708:     }
1709: 
1710: }
1711: 
tbro API documentation generated by ApiGen 2.8.0