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