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