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\FeatureCvterm;
  19: use cli_db\propel\FeatureCvtermPub;
  20: use cli_db\propel\FeatureCvtermPubQuery;
  21: use cli_db\propel\FeatureCvtermQuery;
  22: use cli_db\propel\FeaturePub;
  23: use cli_db\propel\FeaturePubQuery;
  24: use cli_db\propel\FeatureSynonym;
  25: use cli_db\propel\FeatureSynonymQuery;
  26: use cli_db\propel\Pub;
  27: use cli_db\propel\PubDbxref;
  28: use cli_db\propel\PubDbxrefQuery;
  29: use cli_db\propel\PubPeer;
  30: use cli_db\propel\PubQuery;
  31: use cli_db\propel\PubRelationship;
  32: use cli_db\propel\PubRelationshipQuery;
  33: use cli_db\propel\Pubauthor;
  34: use cli_db\propel\PubauthorQuery;
  35: use cli_db\propel\Pubprop;
  36: use cli_db\propel\PubpropQuery;
  37: 
  38: /**
  39:  * Base class that represents a row from the 'pub' table.
  40:  *
  41:  *
  42:  *
  43:  * @package    propel.generator.cli_db.om
  44:  */
  45: abstract class BasePub extends BaseObject implements Persistent
  46: {
  47:     /**
  48:      * Peer class name
  49:      */
  50:     const PEER = 'cli_db\\propel\\PubPeer';
  51: 
  52:     /**
  53:      * The Peer class.
  54:      * Instance provides a convenient way of calling static methods on a class
  55:      * that calling code may not be able to identify.
  56:      * @var        PubPeer
  57:      */
  58:     protected static $peer;
  59: 
  60:     /**
  61:      * The flag var to prevent infinit loop in deep copy
  62:      * @var       boolean
  63:      */
  64:     protected $startCopy = false;
  65: 
  66:     /**
  67:      * The value for the pub_id field.
  68:      * @var        int
  69:      */
  70:     protected $pub_id;
  71: 
  72:     /**
  73:      * The value for the title field.
  74:      * @var        string
  75:      */
  76:     protected $title;
  77: 
  78:     /**
  79:      * The value for the volumetitle field.
  80:      * @var        string
  81:      */
  82:     protected $volumetitle;
  83: 
  84:     /**
  85:      * The value for the volume field.
  86:      * @var        string
  87:      */
  88:     protected $volume;
  89: 
  90:     /**
  91:      * The value for the series_name field.
  92:      * @var        string
  93:      */
  94:     protected $series_name;
  95: 
  96:     /**
  97:      * The value for the issue field.
  98:      * @var        string
  99:      */
 100:     protected $issue;
 101: 
 102:     /**
 103:      * The value for the pyear field.
 104:      * @var        string
 105:      */
 106:     protected $pyear;
 107: 
 108:     /**
 109:      * The value for the pages field.
 110:      * @var        string
 111:      */
 112:     protected $pages;
 113: 
 114:     /**
 115:      * The value for the miniref field.
 116:      * @var        string
 117:      */
 118:     protected $miniref;
 119: 
 120:     /**
 121:      * The value for the uniquename field.
 122:      * @var        string
 123:      */
 124:     protected $uniquename;
 125: 
 126:     /**
 127:      * The value for the type_id field.
 128:      * @var        int
 129:      */
 130:     protected $type_id;
 131: 
 132:     /**
 133:      * The value for the is_obsolete field.
 134:      * Note: this column has a database default value of: false
 135:      * @var        boolean
 136:      */
 137:     protected $is_obsolete;
 138: 
 139:     /**
 140:      * The value for the publisher field.
 141:      * @var        string
 142:      */
 143:     protected $publisher;
 144: 
 145:     /**
 146:      * The value for the pubplace field.
 147:      * @var        string
 148:      */
 149:     protected $pubplace;
 150: 
 151:     /**
 152:      * @var        Cvterm
 153:      */
 154:     protected $aCvterm;
 155: 
 156:     /**
 157:      * @var        PropelObjectCollection|FeatureCvterm[] Collection to store aggregation of FeatureCvterm objects.
 158:      */
 159:     protected $collFeatureCvterms;
 160:     protected $collFeatureCvtermsPartial;
 161: 
 162:     /**
 163:      * @var        PropelObjectCollection|FeatureCvtermPub[] Collection to store aggregation of FeatureCvtermPub objects.
 164:      */
 165:     protected $collFeatureCvtermPubs;
 166:     protected $collFeatureCvtermPubsPartial;
 167: 
 168:     /**
 169:      * @var        PropelObjectCollection|FeaturePub[] Collection to store aggregation of FeaturePub objects.
 170:      */
 171:     protected $collFeaturePubs;
 172:     protected $collFeaturePubsPartial;
 173: 
 174:     /**
 175:      * @var        PropelObjectCollection|FeatureSynonym[] Collection to store aggregation of FeatureSynonym objects.
 176:      */
 177:     protected $collFeatureSynonyms;
 178:     protected $collFeatureSynonymsPartial;
 179: 
 180:     /**
 181:      * @var        PropelObjectCollection|PubDbxref[] Collection to store aggregation of PubDbxref objects.
 182:      */
 183:     protected $collPubDbxrefs;
 184:     protected $collPubDbxrefsPartial;
 185: 
 186:     /**
 187:      * @var        PropelObjectCollection|PubRelationship[] Collection to store aggregation of PubRelationship objects.
 188:      */
 189:     protected $collPubRelationshipsRelatedByObjectId;
 190:     protected $collPubRelationshipsRelatedByObjectIdPartial;
 191: 
 192:     /**
 193:      * @var        PropelObjectCollection|PubRelationship[] Collection to store aggregation of PubRelationship objects.
 194:      */
 195:     protected $collPubRelationshipsRelatedBySubjectId;
 196:     protected $collPubRelationshipsRelatedBySubjectIdPartial;
 197: 
 198:     /**
 199:      * @var        PropelObjectCollection|Pubauthor[] Collection to store aggregation of Pubauthor objects.
 200:      */
 201:     protected $collPubauthors;
 202:     protected $collPubauthorsPartial;
 203: 
 204:     /**
 205:      * @var        PropelObjectCollection|Pubprop[] Collection to store aggregation of Pubprop objects.
 206:      */
 207:     protected $collPubprops;
 208:     protected $collPubpropsPartial;
 209: 
 210:     /**
 211:      * Flag to prevent endless save loop, if this object is referenced
 212:      * by another object which falls in this transaction.
 213:      * @var        boolean
 214:      */
 215:     protected $alreadyInSave = false;
 216: 
 217:     /**
 218:      * Flag to prevent endless validation loop, if this object is referenced
 219:      * by another object which falls in this transaction.
 220:      * @var        boolean
 221:      */
 222:     protected $alreadyInValidation = false;
 223: 
 224:     /**
 225:      * Flag to prevent endless clearAllReferences($deep=true) loop, if this object is referenced
 226:      * @var        boolean
 227:      */
 228:     protected $alreadyInClearAllReferencesDeep = false;
 229: 
 230:     /**
 231:      * An array of objects scheduled for deletion.
 232:      * @var     PropelObjectCollection
 233:      */
 234:     protected $featureCvtermsScheduledForDeletion = null;
 235: 
 236:     /**
 237:      * An array of objects scheduled for deletion.
 238:      * @var     PropelObjectCollection
 239:      */
 240:     protected $featureCvtermPubsScheduledForDeletion = null;
 241: 
 242:     /**
 243:      * An array of objects scheduled for deletion.
 244:      * @var     PropelObjectCollection
 245:      */
 246:     protected $featurePubsScheduledForDeletion = null;
 247: 
 248:     /**
 249:      * An array of objects scheduled for deletion.
 250:      * @var     PropelObjectCollection
 251:      */
 252:     protected $featureSynonymsScheduledForDeletion = null;
 253: 
 254:     /**
 255:      * An array of objects scheduled for deletion.
 256:      * @var     PropelObjectCollection
 257:      */
 258:     protected $pubDbxrefsScheduledForDeletion = null;
 259: 
 260:     /**
 261:      * An array of objects scheduled for deletion.
 262:      * @var     PropelObjectCollection
 263:      */
 264:     protected $pubRelationshipsRelatedByObjectIdScheduledForDeletion = null;
 265: 
 266:     /**
 267:      * An array of objects scheduled for deletion.
 268:      * @var     PropelObjectCollection
 269:      */
 270:     protected $pubRelationshipsRelatedBySubjectIdScheduledForDeletion = null;
 271: 
 272:     /**
 273:      * An array of objects scheduled for deletion.
 274:      * @var     PropelObjectCollection
 275:      */
 276:     protected $pubauthorsScheduledForDeletion = null;
 277: 
 278:     /**
 279:      * An array of objects scheduled for deletion.
 280:      * @var     PropelObjectCollection
 281:      */
 282:     protected $pubpropsScheduledForDeletion = null;
 283: 
 284:     /**
 285:      * Applies default values to this object.
 286:      * This method should be called from the object's constructor (or
 287:      * equivalent initialization method).
 288:      * @see        __construct()
 289:      */
 290:     public function applyDefaultValues()
 291:     {
 292:         $this->is_obsolete = false;
 293:     }
 294: 
 295:     /**
 296:      * Initializes internal state of BasePub object.
 297:      * @see        applyDefaults()
 298:      */
 299:     public function __construct()
 300:     {
 301:         parent::__construct();
 302:         $this->applyDefaultValues();
 303:     }
 304: 
 305:     /**
 306:      * Get the [pub_id] column value.
 307:      *
 308:      * @return int
 309:      */
 310:     public function getPubId()
 311:     {
 312:         return $this->pub_id;
 313:     }
 314: 
 315:     /**
 316:      * Get the [title] column value.
 317:      *
 318:      * @return string
 319:      */
 320:     public function getTitle()
 321:     {
 322:         return $this->title;
 323:     }
 324: 
 325:     /**
 326:      * Get the [volumetitle] column value.
 327:      *
 328:      * @return string
 329:      */
 330:     public function getVolumetitle()
 331:     {
 332:         return $this->volumetitle;
 333:     }
 334: 
 335:     /**
 336:      * Get the [volume] column value.
 337:      *
 338:      * @return string
 339:      */
 340:     public function getVolume()
 341:     {
 342:         return $this->volume;
 343:     }
 344: 
 345:     /**
 346:      * Get the [series_name] column value.
 347:      *
 348:      * @return string
 349:      */
 350:     public function getSeriesName()
 351:     {
 352:         return $this->series_name;
 353:     }
 354: 
 355:     /**
 356:      * Get the [issue] column value.
 357:      *
 358:      * @return string
 359:      */
 360:     public function getIssue()
 361:     {
 362:         return $this->issue;
 363:     }
 364: 
 365:     /**
 366:      * Get the [pyear] column value.
 367:      *
 368:      * @return string
 369:      */
 370:     public function getPyear()
 371:     {
 372:         return $this->pyear;
 373:     }
 374: 
 375:     /**
 376:      * Get the [pages] column value.
 377:      *
 378:      * @return string
 379:      */
 380:     public function getPages()
 381:     {
 382:         return $this->pages;
 383:     }
 384: 
 385:     /**
 386:      * Get the [miniref] column value.
 387:      *
 388:      * @return string
 389:      */
 390:     public function getMiniref()
 391:     {
 392:         return $this->miniref;
 393:     }
 394: 
 395:     /**
 396:      * Get the [uniquename] column value.
 397:      *
 398:      * @return string
 399:      */
 400:     public function getUniquename()
 401:     {
 402:         return $this->uniquename;
 403:     }
 404: 
 405:     /**
 406:      * Get the [type_id] column value.
 407:      *
 408:      * @return int
 409:      */
 410:     public function getTypeId()
 411:     {
 412:         return $this->type_id;
 413:     }
 414: 
 415:     /**
 416:      * Get the [is_obsolete] column value.
 417:      *
 418:      * @return boolean
 419:      */
 420:     public function getIsObsolete()
 421:     {
 422:         return $this->is_obsolete;
 423:     }
 424: 
 425:     /**
 426:      * Get the [publisher] column value.
 427:      *
 428:      * @return string
 429:      */
 430:     public function getPublisher()
 431:     {
 432:         return $this->publisher;
 433:     }
 434: 
 435:     /**
 436:      * Get the [pubplace] column value.
 437:      *
 438:      * @return string
 439:      */
 440:     public function getPubplace()
 441:     {
 442:         return $this->pubplace;
 443:     }
 444: 
 445:     /**
 446:      * Set the value of [pub_id] column.
 447:      *
 448:      * @param int $v new value
 449:      * @return Pub The current object (for fluent API support)
 450:      */
 451:     public function setPubId($v)
 452:     {
 453:         if ($v !== null && is_numeric($v)) {
 454:             $v = (int) $v;
 455:         }
 456: 
 457:         if ($this->pub_id !== $v) {
 458:             $this->pub_id = $v;
 459:             $this->modifiedColumns[] = PubPeer::PUB_ID;
 460:         }
 461: 
 462: 
 463:         return $this;
 464:     } // setPubId()
 465: 
 466:     /**
 467:      * Set the value of [title] column.
 468:      *
 469:      * @param string $v new value
 470:      * @return Pub The current object (for fluent API support)
 471:      */
 472:     public function setTitle($v)
 473:     {
 474:         if ($v !== null && is_numeric($v)) {
 475:             $v = (string) $v;
 476:         }
 477: 
 478:         if ($this->title !== $v) {
 479:             $this->title = $v;
 480:             $this->modifiedColumns[] = PubPeer::TITLE;
 481:         }
 482: 
 483: 
 484:         return $this;
 485:     } // setTitle()
 486: 
 487:     /**
 488:      * Set the value of [volumetitle] column.
 489:      *
 490:      * @param string $v new value
 491:      * @return Pub The current object (for fluent API support)
 492:      */
 493:     public function setVolumetitle($v)
 494:     {
 495:         if ($v !== null && is_numeric($v)) {
 496:             $v = (string) $v;
 497:         }
 498: 
 499:         if ($this->volumetitle !== $v) {
 500:             $this->volumetitle = $v;
 501:             $this->modifiedColumns[] = PubPeer::VOLUMETITLE;
 502:         }
 503: 
 504: 
 505:         return $this;
 506:     } // setVolumetitle()
 507: 
 508:     /**
 509:      * Set the value of [volume] column.
 510:      *
 511:      * @param string $v new value
 512:      * @return Pub The current object (for fluent API support)
 513:      */
 514:     public function setVolume($v)
 515:     {
 516:         if ($v !== null && is_numeric($v)) {
 517:             $v = (string) $v;
 518:         }
 519: 
 520:         if ($this->volume !== $v) {
 521:             $this->volume = $v;
 522:             $this->modifiedColumns[] = PubPeer::VOLUME;
 523:         }
 524: 
 525: 
 526:         return $this;
 527:     } // setVolume()
 528: 
 529:     /**
 530:      * Set the value of [series_name] column.
 531:      *
 532:      * @param string $v new value
 533:      * @return Pub The current object (for fluent API support)
 534:      */
 535:     public function setSeriesName($v)
 536:     {
 537:         if ($v !== null && is_numeric($v)) {
 538:             $v = (string) $v;
 539:         }
 540: 
 541:         if ($this->series_name !== $v) {
 542:             $this->series_name = $v;
 543:             $this->modifiedColumns[] = PubPeer::SERIES_NAME;
 544:         }
 545: 
 546: 
 547:         return $this;
 548:     } // setSeriesName()
 549: 
 550:     /**
 551:      * Set the value of [issue] column.
 552:      *
 553:      * @param string $v new value
 554:      * @return Pub The current object (for fluent API support)
 555:      */
 556:     public function setIssue($v)
 557:     {
 558:         if ($v !== null && is_numeric($v)) {
 559:             $v = (string) $v;
 560:         }
 561: 
 562:         if ($this->issue !== $v) {
 563:             $this->issue = $v;
 564:             $this->modifiedColumns[] = PubPeer::ISSUE;
 565:         }
 566: 
 567: 
 568:         return $this;
 569:     } // setIssue()
 570: 
 571:     /**
 572:      * Set the value of [pyear] column.
 573:      *
 574:      * @param string $v new value
 575:      * @return Pub The current object (for fluent API support)
 576:      */
 577:     public function setPyear($v)
 578:     {
 579:         if ($v !== null && is_numeric($v)) {
 580:             $v = (string) $v;
 581:         }
 582: 
 583:         if ($this->pyear !== $v) {
 584:             $this->pyear = $v;
 585:             $this->modifiedColumns[] = PubPeer::PYEAR;
 586:         }
 587: 
 588: 
 589:         return $this;
 590:     } // setPyear()
 591: 
 592:     /**
 593:      * Set the value of [pages] column.
 594:      *
 595:      * @param string $v new value
 596:      * @return Pub The current object (for fluent API support)
 597:      */
 598:     public function setPages($v)
 599:     {
 600:         if ($v !== null && is_numeric($v)) {
 601:             $v = (string) $v;
 602:         }
 603: 
 604:         if ($this->pages !== $v) {
 605:             $this->pages = $v;
 606:             $this->modifiedColumns[] = PubPeer::PAGES;
 607:         }
 608: 
 609: 
 610:         return $this;
 611:     } // setPages()
 612: 
 613:     /**
 614:      * Set the value of [miniref] column.
 615:      *
 616:      * @param string $v new value
 617:      * @return Pub The current object (for fluent API support)
 618:      */
 619:     public function setMiniref($v)
 620:     {
 621:         if ($v !== null && is_numeric($v)) {
 622:             $v = (string) $v;
 623:         }
 624: 
 625:         if ($this->miniref !== $v) {
 626:             $this->miniref = $v;
 627:             $this->modifiedColumns[] = PubPeer::MINIREF;
 628:         }
 629: 
 630: 
 631:         return $this;
 632:     } // setMiniref()
 633: 
 634:     /**
 635:      * Set the value of [uniquename] column.
 636:      *
 637:      * @param string $v new value
 638:      * @return Pub The current object (for fluent API support)
 639:      */
 640:     public function setUniquename($v)
 641:     {
 642:         if ($v !== null && is_numeric($v)) {
 643:             $v = (string) $v;
 644:         }
 645: 
 646:         if ($this->uniquename !== $v) {
 647:             $this->uniquename = $v;
 648:             $this->modifiedColumns[] = PubPeer::UNIQUENAME;
 649:         }
 650: 
 651: 
 652:         return $this;
 653:     } // setUniquename()
 654: 
 655:     /**
 656:      * Set the value of [type_id] column.
 657:      *
 658:      * @param int $v new value
 659:      * @return Pub The current object (for fluent API support)
 660:      */
 661:     public function setTypeId($v)
 662:     {
 663:         if ($v !== null && is_numeric($v)) {
 664:             $v = (int) $v;
 665:         }
 666: 
 667:         if ($this->type_id !== $v) {
 668:             $this->type_id = $v;
 669:             $this->modifiedColumns[] = PubPeer::TYPE_ID;
 670:         }
 671: 
 672:         if ($this->aCvterm !== null && $this->aCvterm->getCvtermId() !== $v) {
 673:             $this->aCvterm = null;
 674:         }
 675: 
 676: 
 677:         return $this;
 678:     } // setTypeId()
 679: 
 680:     /**
 681:      * Sets the value of the [is_obsolete] column.
 682:      * Non-boolean arguments are converted using the following rules:
 683:      *   * 1, '1', 'true',  'on',  and 'yes' are converted to boolean true
 684:      *   * 0, '0', 'false', 'off', and 'no'  are converted to boolean false
 685:      * Check on string values is case insensitive (so 'FaLsE' is seen as 'false').
 686:      *
 687:      * @param boolean|integer|string $v The new value
 688:      * @return Pub The current object (for fluent API support)
 689:      */
 690:     public function setIsObsolete($v)
 691:     {
 692:         if ($v !== null) {
 693:             if (is_string($v)) {
 694:                 $v = in_array(strtolower($v), array('false', 'off', '-', 'no', 'n', '0', '')) ? false : true;
 695:             } else {
 696:                 $v = (boolean) $v;
 697:             }
 698:         }
 699: 
 700:         if ($this->is_obsolete !== $v) {
 701:             $this->is_obsolete = $v;
 702:             $this->modifiedColumns[] = PubPeer::IS_OBSOLETE;
 703:         }
 704: 
 705: 
 706:         return $this;
 707:     } // setIsObsolete()
 708: 
 709:     /**
 710:      * Set the value of [publisher] column.
 711:      *
 712:      * @param string $v new value
 713:      * @return Pub The current object (for fluent API support)
 714:      */
 715:     public function setPublisher($v)
 716:     {
 717:         if ($v !== null && is_numeric($v)) {
 718:             $v = (string) $v;
 719:         }
 720: 
 721:         if ($this->publisher !== $v) {
 722:             $this->publisher = $v;
 723:             $this->modifiedColumns[] = PubPeer::PUBLISHER;
 724:         }
 725: 
 726: 
 727:         return $this;
 728:     } // setPublisher()
 729: 
 730:     /**
 731:      * Set the value of [pubplace] column.
 732:      *
 733:      * @param string $v new value
 734:      * @return Pub The current object (for fluent API support)
 735:      */
 736:     public function setPubplace($v)
 737:     {
 738:         if ($v !== null && is_numeric($v)) {
 739:             $v = (string) $v;
 740:         }
 741: 
 742:         if ($this->pubplace !== $v) {
 743:             $this->pubplace = $v;
 744:             $this->modifiedColumns[] = PubPeer::PUBPLACE;
 745:         }
 746: 
 747: 
 748:         return $this;
 749:     } // setPubplace()
 750: 
 751:     /**
 752:      * Indicates whether the columns in this object are only set to default values.
 753:      *
 754:      * This method can be used in conjunction with isModified() to indicate whether an object is both
 755:      * modified _and_ has some values set which are non-default.
 756:      *
 757:      * @return boolean Whether the columns in this object are only been set with default values.
 758:      */
 759:     public function hasOnlyDefaultValues()
 760:     {
 761:             if ($this->is_obsolete !== false) {
 762:                 return false;
 763:             }
 764: 
 765:         // otherwise, everything was equal, so return true
 766:         return true;
 767:     } // hasOnlyDefaultValues()
 768: 
 769:     /**
 770:      * Hydrates (populates) the object variables with values from the database resultset.
 771:      *
 772:      * An offset (0-based "start column") is specified so that objects can be hydrated
 773:      * with a subset of the columns in the resultset rows.  This is needed, for example,
 774:      * for results of JOIN queries where the resultset row includes columns from two or
 775:      * more tables.
 776:      *
 777:      * @param array $row The row returned by PDOStatement->fetch(PDO::FETCH_NUM)
 778:      * @param int $startcol 0-based offset column which indicates which restultset column to start with.
 779:      * @param boolean $rehydrate Whether this object is being re-hydrated from the database.
 780:      * @return int             next starting column
 781:      * @throws PropelException - Any caught Exception will be rewrapped as a PropelException.
 782:      */
 783:     public function hydrate($row, $startcol = 0, $rehydrate = false)
 784:     {
 785:         try {
 786: 
 787:             $this->pub_id = ($row[$startcol + 0] !== null) ? (int) $row[$startcol + 0] : null;
 788:             $this->title = ($row[$startcol + 1] !== null) ? (string) $row[$startcol + 1] : null;
 789:             $this->volumetitle = ($row[$startcol + 2] !== null) ? (string) $row[$startcol + 2] : null;
 790:             $this->volume = ($row[$startcol + 3] !== null) ? (string) $row[$startcol + 3] : null;
 791:             $this->series_name = ($row[$startcol + 4] !== null) ? (string) $row[$startcol + 4] : null;
 792:             $this->issue = ($row[$startcol + 5] !== null) ? (string) $row[$startcol + 5] : null;
 793:             $this->pyear = ($row[$startcol + 6] !== null) ? (string) $row[$startcol + 6] : null;
 794:             $this->pages = ($row[$startcol + 7] !== null) ? (string) $row[$startcol + 7] : null;
 795:             $this->miniref = ($row[$startcol + 8] !== null) ? (string) $row[$startcol + 8] : null;
 796:             $this->uniquename = ($row[$startcol + 9] !== null) ? (string) $row[$startcol + 9] : null;
 797:             $this->type_id = ($row[$startcol + 10] !== null) ? (int) $row[$startcol + 10] : null;
 798:             $this->is_obsolete = ($row[$startcol + 11] !== null) ? (boolean) $row[$startcol + 11] : null;
 799:             $this->publisher = ($row[$startcol + 12] !== null) ? (string) $row[$startcol + 12] : null;
 800:             $this->pubplace = ($row[$startcol + 13] !== null) ? (string) $row[$startcol + 13] : null;
 801:             $this->resetModified();
 802: 
 803:             $this->setNew(false);
 804: 
 805:             if ($rehydrate) {
 806:                 $this->ensureConsistency();
 807:             }
 808:             $this->postHydrate($row, $startcol, $rehydrate);
 809:             return $startcol + 14; // 14 = PubPeer::NUM_HYDRATE_COLUMNS.
 810: 
 811:         } catch (Exception $e) {
 812:             throw new PropelException("Error populating Pub object", $e);
 813:         }
 814:     }
 815: 
 816:     /**
 817:      * Checks and repairs the internal consistency of the object.
 818:      *
 819:      * This method is executed after an already-instantiated object is re-hydrated
 820:      * from the database.  It exists to check any foreign keys to make sure that
 821:      * the objects related to the current object are correct based on foreign key.
 822:      *
 823:      * You can override this method in the stub class, but you should always invoke
 824:      * the base method from the overridden method (i.e. parent::ensureConsistency()),
 825:      * in case your model changes.
 826:      *
 827:      * @throws PropelException
 828:      */
 829:     public function ensureConsistency()
 830:     {
 831: 
 832:         if ($this->aCvterm !== null && $this->type_id !== $this->aCvterm->getCvtermId()) {
 833:             $this->aCvterm = null;
 834:         }
 835:     } // ensureConsistency
 836: 
 837:     /**
 838:      * Reloads this object from datastore based on primary key and (optionally) resets all associated objects.
 839:      *
 840:      * This will only work if the object has been saved and has a valid primary key set.
 841:      *
 842:      * @param boolean $deep (optional) Whether to also de-associated any related objects.
 843:      * @param PropelPDO $con (optional) The PropelPDO connection to use.
 844:      * @return void
 845:      * @throws PropelException - if this object is deleted, unsaved or doesn't have pk match in db
 846:      */
 847:     public function reload($deep = false, PropelPDO $con = null)
 848:     {
 849:         if ($this->isDeleted()) {
 850:             throw new PropelException("Cannot reload a deleted object.");
 851:         }
 852: 
 853:         if ($this->isNew()) {
 854:             throw new PropelException("Cannot reload an unsaved object.");
 855:         }
 856: 
 857:         if ($con === null) {
 858:             $con = Propel::getConnection(PubPeer::DATABASE_NAME, Propel::CONNECTION_READ);
 859:         }
 860: 
 861:         // We don't need to alter the object instance pool; we're just modifying this instance
 862:         // already in the pool.
 863: 
 864:         $stmt = PubPeer::doSelectStmt($this->buildPkeyCriteria(), $con);
 865:         $row = $stmt->fetch(PDO::FETCH_NUM);
 866:         $stmt->closeCursor();
 867:         if (!$row) {
 868:             throw new PropelException('Cannot find matching row in the database to reload object values.');
 869:         }
 870:         $this->hydrate($row, 0, true); // rehydrate
 871: 
 872:         if ($deep) {  // also de-associate any related objects?
 873: 
 874:             $this->aCvterm = null;
 875:             $this->collFeatureCvterms = null;
 876: 
 877:             $this->collFeatureCvtermPubs = null;
 878: 
 879:             $this->collFeaturePubs = null;
 880: 
 881:             $this->collFeatureSynonyms = null;
 882: 
 883:             $this->collPubDbxrefs = null;
 884: 
 885:             $this->collPubRelationshipsRelatedByObjectId = null;
 886: 
 887:             $this->collPubRelationshipsRelatedBySubjectId = null;
 888: 
 889:             $this->collPubauthors = null;
 890: 
 891:             $this->collPubprops = null;
 892: 
 893:         } // if (deep)
 894:     }
 895: 
 896:     /**
 897:      * Removes this object from datastore and sets delete attribute.
 898:      *
 899:      * @param PropelPDO $con
 900:      * @return void
 901:      * @throws PropelException
 902:      * @throws Exception
 903:      * @see        BaseObject::setDeleted()
 904:      * @see        BaseObject::isDeleted()
 905:      */
 906:     public function delete(PropelPDO $con = null)
 907:     {
 908:         if ($this->isDeleted()) {
 909:             throw new PropelException("This object has already been deleted.");
 910:         }
 911: 
 912:         if ($con === null) {
 913:             $con = Propel::getConnection(PubPeer::DATABASE_NAME, Propel::CONNECTION_WRITE);
 914:         }
 915: 
 916:         $con->beginTransaction();
 917:         try {
 918:             $deleteQuery = PubQuery::create()
 919:                 ->filterByPrimaryKey($this->getPrimaryKey());
 920:             $ret = $this->preDelete($con);
 921:             if ($ret) {
 922:                 $deleteQuery->delete($con);
 923:                 $this->postDelete($con);
 924:                 $con->commit();
 925:                 $this->setDeleted(true);
 926:             } else {
 927:                 $con->commit();
 928:             }
 929:         } catch (Exception $e) {
 930:             $con->rollBack();
 931:             throw $e;
 932:         }
 933:     }
 934: 
 935:     /**
 936:      * Persists this object to the database.
 937:      *
 938:      * If the object is new, it inserts it; otherwise an update is performed.
 939:      * All modified related objects will also be persisted in the doSave()
 940:      * method.  This method wraps all precipitate database operations in a
 941:      * single transaction.
 942:      *
 943:      * @param PropelPDO $con
 944:      * @return int             The number of rows affected by this insert/update and any referring fk objects' save() operations.
 945:      * @throws PropelException
 946:      * @throws Exception
 947:      * @see        doSave()
 948:      */
 949:     public function save(PropelPDO $con = null)
 950:     {
 951:         if ($this->isDeleted()) {
 952:             throw new PropelException("You cannot save an object that has been deleted.");
 953:         }
 954: 
 955:         if ($con === null) {
 956:             $con = Propel::getConnection(PubPeer::DATABASE_NAME, Propel::CONNECTION_WRITE);
 957:         }
 958: 
 959:         $con->beginTransaction();
 960:         $isInsert = $this->isNew();
 961:         try {
 962:             $ret = $this->preSave($con);
 963:             if ($isInsert) {
 964:                 $ret = $ret && $this->preInsert($con);
 965:             } else {
 966:                 $ret = $ret && $this->preUpdate($con);
 967:             }
 968:             if ($ret) {
 969:                 $affectedRows = $this->doSave($con);
 970:                 if ($isInsert) {
 971:                     $this->postInsert($con);
 972:                 } else {
 973:                     $this->postUpdate($con);
 974:                 }
 975:                 $this->postSave($con);
 976:                 PubPeer::addInstanceToPool($this);
 977:             } else {
 978:                 $affectedRows = 0;
 979:             }
 980:             $con->commit();
 981: 
 982:             return $affectedRows;
 983:         } catch (Exception $e) {
 984:             $con->rollBack();
 985:             throw $e;
 986:         }
 987:     }
 988: 
 989:     /**
 990:      * Performs the work of inserting or updating the row in the database.
 991:      *
 992:      * If the object is new, it inserts it; otherwise an update is performed.
 993:      * All related objects are also updated in this method.
 994:      *
 995:      * @param PropelPDO $con
 996:      * @return int             The number of rows affected by this insert/update and any referring fk objects' save() operations.
 997:      * @throws PropelException
 998:      * @see        save()
 999:      */
1000:     protected function doSave(PropelPDO $con)
1001:     {
1002:         $affectedRows = 0; // initialize var to track total num of affected rows
1003:         if (!$this->alreadyInSave) {
1004:             $this->alreadyInSave = true;
1005: 
1006:             // We call the save method on the following object(s) if they
1007:             // were passed to this object by their coresponding set
1008:             // method.  This object relates to these object(s) by a
1009:             // foreign key reference.
1010: 
1011:             if ($this->aCvterm !== null) {
1012:                 if ($this->aCvterm->isModified() || $this->aCvterm->isNew()) {
1013:                     $affectedRows += $this->aCvterm->save($con);
1014:                 }
1015:                 $this->setCvterm($this->aCvterm);
1016:             }
1017: 
1018:             if ($this->isNew() || $this->isModified()) {
1019:                 // persist changes
1020:                 if ($this->isNew()) {
1021:                     $this->doInsert($con);
1022:                 } else {
1023:                     $this->doUpdate($con);
1024:                 }
1025:                 $affectedRows += 1;
1026:                 $this->resetModified();
1027:             }
1028: 
1029:             if ($this->featureCvtermsScheduledForDeletion !== null) {
1030:                 if (!$this->featureCvtermsScheduledForDeletion->isEmpty()) {
1031:                     FeatureCvtermQuery::create()
1032:                         ->filterByPrimaryKeys($this->featureCvtermsScheduledForDeletion->getPrimaryKeys(false))
1033:                         ->delete($con);
1034:                     $this->featureCvtermsScheduledForDeletion = null;
1035:                 }
1036:             }
1037: 
1038:             if ($this->collFeatureCvterms !== null) {
1039:                 foreach ($this->collFeatureCvterms as $referrerFK) {
1040:                     if (!$referrerFK->isDeleted() && ($referrerFK->isNew() || $referrerFK->isModified())) {
1041:                         $affectedRows += $referrerFK->save($con);
1042:                     }
1043:                 }
1044:             }
1045: 
1046:             if ($this->featureCvtermPubsScheduledForDeletion !== null) {
1047:                 if (!$this->featureCvtermPubsScheduledForDeletion->isEmpty()) {
1048:                     FeatureCvtermPubQuery::create()
1049:                         ->filterByPrimaryKeys($this->featureCvtermPubsScheduledForDeletion->getPrimaryKeys(false))
1050:                         ->delete($con);
1051:                     $this->featureCvtermPubsScheduledForDeletion = null;
1052:                 }
1053:             }
1054: 
1055:             if ($this->collFeatureCvtermPubs !== null) {
1056:                 foreach ($this->collFeatureCvtermPubs as $referrerFK) {
1057:                     if (!$referrerFK->isDeleted() && ($referrerFK->isNew() || $referrerFK->isModified())) {
1058:                         $affectedRows += $referrerFK->save($con);
1059:                     }
1060:                 }
1061:             }
1062: 
1063:             if ($this->featurePubsScheduledForDeletion !== null) {
1064:                 if (!$this->featurePubsScheduledForDeletion->isEmpty()) {
1065:                     FeaturePubQuery::create()
1066:                         ->filterByPrimaryKeys($this->featurePubsScheduledForDeletion->getPrimaryKeys(false))
1067:                         ->delete($con);
1068:                     $this->featurePubsScheduledForDeletion = null;
1069:                 }
1070:             }
1071: 
1072:             if ($this->collFeaturePubs !== null) {
1073:                 foreach ($this->collFeaturePubs as $referrerFK) {
1074:                     if (!$referrerFK->isDeleted() && ($referrerFK->isNew() || $referrerFK->isModified())) {
1075:                         $affectedRows += $referrerFK->save($con);
1076:                     }
1077:                 }
1078:             }
1079: 
1080:             if ($this->featureSynonymsScheduledForDeletion !== null) {
1081:                 if (!$this->featureSynonymsScheduledForDeletion->isEmpty()) {
1082:                     FeatureSynonymQuery::create()
1083:                         ->filterByPrimaryKeys($this->featureSynonymsScheduledForDeletion->getPrimaryKeys(false))
1084:                         ->delete($con);
1085:                     $this->featureSynonymsScheduledForDeletion = null;
1086:                 }
1087:             }
1088: 
1089:             if ($this->collFeatureSynonyms !== null) {
1090:                 foreach ($this->collFeatureSynonyms as $referrerFK) {
1091:                     if (!$referrerFK->isDeleted() && ($referrerFK->isNew() || $referrerFK->isModified())) {
1092:                         $affectedRows += $referrerFK->save($con);
1093:                     }
1094:                 }
1095:             }
1096: 
1097:             if ($this->pubDbxrefsScheduledForDeletion !== null) {
1098:                 if (!$this->pubDbxrefsScheduledForDeletion->isEmpty()) {
1099:                     PubDbxrefQuery::create()
1100:                         ->filterByPrimaryKeys($this->pubDbxrefsScheduledForDeletion->getPrimaryKeys(false))
1101:                         ->delete($con);
1102:                     $this->pubDbxrefsScheduledForDeletion = null;
1103:                 }
1104:             }
1105: 
1106:             if ($this->collPubDbxrefs !== null) {
1107:                 foreach ($this->collPubDbxrefs as $referrerFK) {
1108:                     if (!$referrerFK->isDeleted() && ($referrerFK->isNew() || $referrerFK->isModified())) {
1109:                         $affectedRows += $referrerFK->save($con);
1110:                     }
1111:                 }
1112:             }
1113: 
1114:             if ($this->pubRelationshipsRelatedByObjectIdScheduledForDeletion !== null) {
1115:                 if (!$this->pubRelationshipsRelatedByObjectIdScheduledForDeletion->isEmpty()) {
1116:                     PubRelationshipQuery::create()
1117:                         ->filterByPrimaryKeys($this->pubRelationshipsRelatedByObjectIdScheduledForDeletion->getPrimaryKeys(false))
1118:                         ->delete($con);
1119:                     $this->pubRelationshipsRelatedByObjectIdScheduledForDeletion = null;
1120:                 }
1121:             }
1122: 
1123:             if ($this->collPubRelationshipsRelatedByObjectId !== null) {
1124:                 foreach ($this->collPubRelationshipsRelatedByObjectId as $referrerFK) {
1125:                     if (!$referrerFK->isDeleted() && ($referrerFK->isNew() || $referrerFK->isModified())) {
1126:                         $affectedRows += $referrerFK->save($con);
1127:                     }
1128:                 }
1129:             }
1130: 
1131:             if ($this->pubRelationshipsRelatedBySubjectIdScheduledForDeletion !== null) {
1132:                 if (!$this->pubRelationshipsRelatedBySubjectIdScheduledForDeletion->isEmpty()) {
1133:                     PubRelationshipQuery::create()
1134:                         ->filterByPrimaryKeys($this->pubRelationshipsRelatedBySubjectIdScheduledForDeletion->getPrimaryKeys(false))
1135:                         ->delete($con);
1136:                     $this->pubRelationshipsRelatedBySubjectIdScheduledForDeletion = null;
1137:                 }
1138:             }
1139: 
1140:             if ($this->collPubRelationshipsRelatedBySubjectId !== null) {
1141:                 foreach ($this->collPubRelationshipsRelatedBySubjectId as $referrerFK) {
1142:                     if (!$referrerFK->isDeleted() && ($referrerFK->isNew() || $referrerFK->isModified())) {
1143:                         $affectedRows += $referrerFK->save($con);
1144:                     }
1145:                 }
1146:             }
1147: 
1148:             if ($this->pubauthorsScheduledForDeletion !== null) {
1149:                 if (!$this->pubauthorsScheduledForDeletion->isEmpty()) {
1150:                     PubauthorQuery::create()
1151:                         ->filterByPrimaryKeys($this->pubauthorsScheduledForDeletion->getPrimaryKeys(false))
1152:                         ->delete($con);
1153:                     $this->pubauthorsScheduledForDeletion = null;
1154:                 }
1155:             }
1156: 
1157:             if ($this->collPubauthors !== null) {
1158:                 foreach ($this->collPubauthors as $referrerFK) {
1159:                     if (!$referrerFK->isDeleted() && ($referrerFK->isNew() || $referrerFK->isModified())) {
1160:                         $affectedRows += $referrerFK->save($con);
1161:                     }
1162:                 }
1163:             }
1164: 
1165:             if ($this->pubpropsScheduledForDeletion !== null) {
1166:                 if (!$this->pubpropsScheduledForDeletion->isEmpty()) {
1167:                     PubpropQuery::create()
1168:                         ->filterByPrimaryKeys($this->pubpropsScheduledForDeletion->getPrimaryKeys(false))
1169:                         ->delete($con);
1170:                     $this->pubpropsScheduledForDeletion = null;
1171:                 }
1172:             }
1173: 
1174:             if ($this->collPubprops !== null) {
1175:                 foreach ($this->collPubprops as $referrerFK) {
1176:                     if (!$referrerFK->isDeleted() && ($referrerFK->isNew() || $referrerFK->isModified())) {
1177:                         $affectedRows += $referrerFK->save($con);
1178:                     }
1179:                 }
1180:             }
1181: 
1182:             $this->alreadyInSave = false;
1183: 
1184:         }
1185: 
1186:         return $affectedRows;
1187:     } // doSave()
1188: 
1189:     /**
1190:      * Insert the row in the database.
1191:      *
1192:      * @param PropelPDO $con
1193:      *
1194:      * @throws PropelException
1195:      * @see        doSave()
1196:      */
1197:     protected function doInsert(PropelPDO $con)
1198:     {
1199:         $modifiedColumns = array();
1200:         $index = 0;
1201: 
1202:         $this->modifiedColumns[] = PubPeer::PUB_ID;
1203:         if (null !== $this->pub_id) {
1204:             throw new PropelException('Cannot insert a value for auto-increment primary key (' . PubPeer::PUB_ID . ')');
1205:         }
1206:         if (null === $this->pub_id) {
1207:             try {
1208:                 $stmt = $con->query("SELECT nextval('pub_pub_id_seq')");
1209:                 $row = $stmt->fetch(PDO::FETCH_NUM);
1210:                 $this->pub_id = $row[0];
1211:             } catch (Exception $e) {
1212:                 throw new PropelException('Unable to get sequence id.', $e);
1213:             }
1214:         }
1215: 
1216: 
1217:          // check the columns in natural order for more readable SQL queries
1218:         if ($this->isColumnModified(PubPeer::PUB_ID)) {
1219:             $modifiedColumns[':p' . $index++]  = '"pub_id"';
1220:         }
1221:         if ($this->isColumnModified(PubPeer::TITLE)) {
1222:             $modifiedColumns[':p' . $index++]  = '"title"';
1223:         }
1224:         if ($this->isColumnModified(PubPeer::VOLUMETITLE)) {
1225:             $modifiedColumns[':p' . $index++]  = '"volumetitle"';
1226:         }
1227:         if ($this->isColumnModified(PubPeer::VOLUME)) {
1228:             $modifiedColumns[':p' . $index++]  = '"volume"';
1229:         }
1230:         if ($this->isColumnModified(PubPeer::SERIES_NAME)) {
1231:             $modifiedColumns[':p' . $index++]  = '"series_name"';
1232:         }
1233:         if ($this->isColumnModified(PubPeer::ISSUE)) {
1234:             $modifiedColumns[':p' . $index++]  = '"issue"';
1235:         }
1236:         if ($this->isColumnModified(PubPeer::PYEAR)) {
1237:             $modifiedColumns[':p' . $index++]  = '"pyear"';
1238:         }
1239:         if ($this->isColumnModified(PubPeer::PAGES)) {
1240:             $modifiedColumns[':p' . $index++]  = '"pages"';
1241:         }
1242:         if ($this->isColumnModified(PubPeer::MINIREF)) {
1243:             $modifiedColumns[':p' . $index++]  = '"miniref"';
1244:         }
1245:         if ($this->isColumnModified(PubPeer::UNIQUENAME)) {
1246:             $modifiedColumns[':p' . $index++]  = '"uniquename"';
1247:         }
1248:         if ($this->isColumnModified(PubPeer::TYPE_ID)) {
1249:             $modifiedColumns[':p' . $index++]  = '"type_id"';
1250:         }
1251:         if ($this->isColumnModified(PubPeer::IS_OBSOLETE)) {
1252:             $modifiedColumns[':p' . $index++]  = '"is_obsolete"';
1253:         }
1254:         if ($this->isColumnModified(PubPeer::PUBLISHER)) {
1255:             $modifiedColumns[':p' . $index++]  = '"publisher"';
1256:         }
1257:         if ($this->isColumnModified(PubPeer::PUBPLACE)) {
1258:             $modifiedColumns[':p' . $index++]  = '"pubplace"';
1259:         }
1260: 
1261:         $sql = sprintf(
1262:             'INSERT INTO "pub" (%s) VALUES (%s)',
1263:             implode(', ', $modifiedColumns),
1264:             implode(', ', array_keys($modifiedColumns))
1265:         );
1266: 
1267:         try {
1268:             $stmt = $con->prepare($sql);
1269:             foreach ($modifiedColumns as $identifier => $columnName) {
1270:                 switch ($columnName) {
1271:                     case '"pub_id"':
1272:                         $stmt->bindValue($identifier, $this->pub_id, PDO::PARAM_INT);
1273:                         break;
1274:                     case '"title"':
1275:                         $stmt->bindValue($identifier, $this->title, PDO::PARAM_STR);
1276:                         break;
1277:                     case '"volumetitle"':
1278:                         $stmt->bindValue($identifier, $this->volumetitle, PDO::PARAM_STR);
1279:                         break;
1280:                     case '"volume"':
1281:                         $stmt->bindValue($identifier, $this->volume, PDO::PARAM_STR);
1282:                         break;
1283:                     case '"series_name"':
1284:                         $stmt->bindValue($identifier, $this->series_name, PDO::PARAM_STR);
1285:                         break;
1286:                     case '"issue"':
1287:                         $stmt->bindValue($identifier, $this->issue, PDO::PARAM_STR);
1288:                         break;
1289:                     case '"pyear"':
1290:                         $stmt->bindValue($identifier, $this->pyear, PDO::PARAM_STR);
1291:                         break;
1292:                     case '"pages"':
1293:                         $stmt->bindValue($identifier, $this->pages, PDO::PARAM_STR);
1294:                         break;
1295:                     case '"miniref"':
1296:                         $stmt->bindValue($identifier, $this->miniref, PDO::PARAM_STR);
1297:                         break;
1298:                     case '"uniquename"':
1299:                         $stmt->bindValue($identifier, $this->uniquename, PDO::PARAM_STR);
1300:                         break;
1301:                     case '"type_id"':
1302:                         $stmt->bindValue($identifier, $this->type_id, PDO::PARAM_INT);
1303:                         break;
1304:                     case '"is_obsolete"':
1305:                         $stmt->bindValue($identifier, $this->is_obsolete, PDO::PARAM_BOOL);
1306:                         break;
1307:                     case '"publisher"':
1308:                         $stmt->bindValue($identifier, $this->publisher, PDO::PARAM_STR);
1309:                         break;
1310:                     case '"pubplace"':
1311:                         $stmt->bindValue($identifier, $this->pubplace, PDO::PARAM_STR);
1312:                         break;
1313:                 }
1314:             }
1315:             $stmt->execute();
1316:         } catch (Exception $e) {
1317:             Propel::log($e->getMessage(), Propel::LOG_ERR);
1318:             throw new PropelException(sprintf('Unable to execute INSERT statement [%s]', $sql), $e);
1319:         }
1320: 
1321:         $this->setNew(false);
1322:     }
1323: 
1324:     /**
1325:      * Update the row in the database.
1326:      *
1327:      * @param PropelPDO $con
1328:      *
1329:      * @see        doSave()
1330:      */
1331:     protected function doUpdate(PropelPDO $con)
1332:     {
1333:         $selectCriteria = $this->buildPkeyCriteria();
1334:         $valuesCriteria = $this->buildCriteria();
1335:         BasePeer::doUpdate($selectCriteria, $valuesCriteria, $con);
1336:     }
1337: 
1338:     /**
1339:      * Array of ValidationFailed objects.
1340:      * @var        array ValidationFailed[]
1341:      */
1342:     protected $validationFailures = array();
1343: 
1344:     /**
1345:      * Gets any ValidationFailed objects that resulted from last call to validate().
1346:      *
1347:      *
1348:      * @return array ValidationFailed[]
1349:      * @see        validate()
1350:      */
1351:     public function getValidationFailures()
1352:     {
1353:         return $this->validationFailures;
1354:     }
1355: 
1356:     /**
1357:      * Validates the objects modified field values and all objects related to this table.
1358:      *
1359:      * If $columns is either a column name or an array of column names
1360:      * only those columns are validated.
1361:      *
1362:      * @param mixed $columns Column name or an array of column names.
1363:      * @return boolean Whether all columns pass validation.
1364:      * @see        doValidate()
1365:      * @see        getValidationFailures()
1366:      */
1367:     public function validate($columns = null)
1368:     {
1369:         $res = $this->doValidate($columns);
1370:         if ($res === true) {
1371:             $this->validationFailures = array();
1372: 
1373:             return true;
1374:         }
1375: 
1376:         $this->validationFailures = $res;
1377: 
1378:         return false;
1379:     }
1380: 
1381:     /**
1382:      * This function performs the validation work for complex object models.
1383:      *
1384:      * In addition to checking the current object, all related objects will
1385:      * also be validated.  If all pass then <code>true</code> is returned; otherwise
1386:      * an aggreagated array of ValidationFailed objects will be returned.
1387:      *
1388:      * @param array $columns Array of column names to validate.
1389:      * @return mixed <code>true</code> if all validations pass; array of <code>ValidationFailed</code> objets otherwise.
1390:      */
1391:     protected function doValidate($columns = null)
1392:     {
1393:         if (!$this->alreadyInValidation) {
1394:             $this->alreadyInValidation = true;
1395:             $retval = null;
1396: 
1397:             $failureMap = array();
1398: 
1399: 
1400:             // We call the validate method on the following object(s) if they
1401:             // were passed to this object by their coresponding set
1402:             // method.  This object relates to these object(s) by a
1403:             // foreign key reference.
1404: 
1405:             if ($this->aCvterm !== null) {
1406:                 if (!$this->aCvterm->validate($columns)) {
1407:                     $failureMap = array_merge($failureMap, $this->aCvterm->getValidationFailures());
1408:                 }
1409:             }
1410: 
1411: 
1412:             if (($retval = PubPeer::doValidate($this, $columns)) !== true) {
1413:                 $failureMap = array_merge($failureMap, $retval);
1414:             }
1415: 
1416: 
1417:                 if ($this->collFeatureCvterms !== null) {
1418:                     foreach ($this->collFeatureCvterms as $referrerFK) {
1419:                         if (!$referrerFK->validate($columns)) {
1420:                             $failureMap = array_merge($failureMap, $referrerFK->getValidationFailures());
1421:                         }
1422:                     }
1423:                 }
1424: 
1425:                 if ($this->collFeatureCvtermPubs !== null) {
1426:                     foreach ($this->collFeatureCvtermPubs as $referrerFK) {
1427:                         if (!$referrerFK->validate($columns)) {
1428:                             $failureMap = array_merge($failureMap, $referrerFK->getValidationFailures());
1429:                         }
1430:                     }
1431:                 }
1432: 
1433:                 if ($this->collFeaturePubs !== null) {
1434:                     foreach ($this->collFeaturePubs as $referrerFK) {
1435:                         if (!$referrerFK->validate($columns)) {
1436:                             $failureMap = array_merge($failureMap, $referrerFK->getValidationFailures());
1437:                         }
1438:                     }
1439:                 }
1440: 
1441:                 if ($this->collFeatureSynonyms !== null) {
1442:                     foreach ($this->collFeatureSynonyms as $referrerFK) {
1443:                         if (!$referrerFK->validate($columns)) {
1444:                             $failureMap = array_merge($failureMap, $referrerFK->getValidationFailures());
1445:                         }
1446:                     }
1447:                 }
1448: 
1449:                 if ($this->collPubDbxrefs !== null) {
1450:                     foreach ($this->collPubDbxrefs as $referrerFK) {
1451:                         if (!$referrerFK->validate($columns)) {
1452:                             $failureMap = array_merge($failureMap, $referrerFK->getValidationFailures());
1453:                         }
1454:                     }
1455:                 }
1456: 
1457:                 if ($this->collPubRelationshipsRelatedByObjectId !== null) {
1458:                     foreach ($this->collPubRelationshipsRelatedByObjectId as $referrerFK) {
1459:                         if (!$referrerFK->validate($columns)) {
1460:                             $failureMap = array_merge($failureMap, $referrerFK->getValidationFailures());
1461:                         }
1462:                     }
1463:                 }
1464: 
1465:                 if ($this->collPubRelationshipsRelatedBySubjectId !== null) {
1466:                     foreach ($this->collPubRelationshipsRelatedBySubjectId as $referrerFK) {
1467:                         if (!$referrerFK->validate($columns)) {
1468:                             $failureMap = array_merge($failureMap, $referrerFK->getValidationFailures());
1469:                         }
1470:                     }
1471:                 }
1472: 
1473:                 if ($this->collPubauthors !== null) {
1474:                     foreach ($this->collPubauthors as $referrerFK) {
1475:                         if (!$referrerFK->validate($columns)) {
1476:                             $failureMap = array_merge($failureMap, $referrerFK->getValidationFailures());
1477:                         }
1478:                     }
1479:                 }
1480: 
1481:                 if ($this->collPubprops !== null) {
1482:                     foreach ($this->collPubprops as $referrerFK) {
1483:                         if (!$referrerFK->validate($columns)) {
1484:                             $failureMap = array_merge($failureMap, $referrerFK->getValidationFailures());
1485:                         }
1486:                     }
1487:                 }
1488: 
1489: 
1490:             $this->alreadyInValidation = false;
1491:         }
1492: 
1493:         return (!empty($failureMap) ? $failureMap : true);
1494:     }
1495: 
1496:     /**
1497:      * Retrieves a field from the object by name passed in as a string.
1498:      *
1499:      * @param string $name name
1500:      * @param string $type The type of fieldname the $name is of:
1501:      *               one of the class type constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME
1502:      *               BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM.
1503:      *               Defaults to BasePeer::TYPE_PHPNAME
1504:      * @return mixed Value of field.
1505:      */
1506:     public function getByName($name, $type = BasePeer::TYPE_PHPNAME)
1507:     {
1508:         $pos = PubPeer::translateFieldName($name, $type, BasePeer::TYPE_NUM);
1509:         $field = $this->getByPosition($pos);
1510: 
1511:         return $field;
1512:     }
1513: 
1514:     /**
1515:      * Retrieves a field from the object by Position as specified in the xml schema.
1516:      * Zero-based.
1517:      *
1518:      * @param int $pos position in xml schema
1519:      * @return mixed Value of field at $pos
1520:      */
1521:     public function getByPosition($pos)
1522:     {
1523:         switch ($pos) {
1524:             case 0:
1525:                 return $this->getPubId();
1526:                 break;
1527:             case 1:
1528:                 return $this->getTitle();
1529:                 break;
1530:             case 2:
1531:                 return $this->getVolumetitle();
1532:                 break;
1533:             case 3:
1534:                 return $this->getVolume();
1535:                 break;
1536:             case 4:
1537:                 return $this->getSeriesName();
1538:                 break;
1539:             case 5:
1540:                 return $this->getIssue();
1541:                 break;
1542:             case 6:
1543:                 return $this->getPyear();
1544:                 break;
1545:             case 7:
1546:                 return $this->getPages();
1547:                 break;
1548:             case 8:
1549:                 return $this->getMiniref();
1550:                 break;
1551:             case 9:
1552:                 return $this->getUniquename();
1553:                 break;
1554:             case 10:
1555:                 return $this->getTypeId();
1556:                 break;
1557:             case 11:
1558:                 return $this->getIsObsolete();
1559:                 break;
1560:             case 12:
1561:                 return $this->getPublisher();
1562:                 break;
1563:             case 13:
1564:                 return $this->getPubplace();
1565:                 break;
1566:             default:
1567:                 return null;
1568:                 break;
1569:         } // switch()
1570:     }
1571: 
1572:     /**
1573:      * Exports the object as an array.
1574:      *
1575:      * You can specify the key type of the array by passing one of the class
1576:      * type constants.
1577:      *
1578:      * @param     string  $keyType (optional) One of the class type constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME,
1579:      *                    BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM.
1580:      *                    Defaults to BasePeer::TYPE_PHPNAME.
1581:      * @param     boolean $includeLazyLoadColumns (optional) Whether to include lazy loaded columns. Defaults to true.
1582:      * @param     array $alreadyDumpedObjects List of objects to skip to avoid recursion
1583:      * @param     boolean $includeForeignObjects (optional) Whether to include hydrated related objects. Default to FALSE.
1584:      *
1585:      * @return array an associative array containing the field names (as keys) and field values
1586:      */
1587:     public function toArray($keyType = BasePeer::TYPE_PHPNAME, $includeLazyLoadColumns = true, $alreadyDumpedObjects = array(), $includeForeignObjects = false)
1588:     {
1589:         if (isset($alreadyDumpedObjects['Pub'][$this->getPrimaryKey()])) {
1590:             return '*RECURSION*';
1591:         }
1592:         $alreadyDumpedObjects['Pub'][$this->getPrimaryKey()] = true;
1593:         $keys = PubPeer::getFieldNames($keyType);
1594:         $result = array(
1595:             $keys[0] => $this->getPubId(),
1596:             $keys[1] => $this->getTitle(),
1597:             $keys[2] => $this->getVolumetitle(),
1598:             $keys[3] => $this->getVolume(),
1599:             $keys[4] => $this->getSeriesName(),
1600:             $keys[5] => $this->getIssue(),
1601:             $keys[6] => $this->getPyear(),
1602:             $keys[7] => $this->getPages(),
1603:             $keys[8] => $this->getMiniref(),
1604:             $keys[9] => $this->getUniquename(),
1605:             $keys[10] => $this->getTypeId(),
1606:             $keys[11] => $this->getIsObsolete(),
1607:             $keys[12] => $this->getPublisher(),
1608:             $keys[13] => $this->getPubplace(),
1609:         );
1610:         if ($includeForeignObjects) {
1611:             if (null !== $this->aCvterm) {
1612:                 $result['Cvterm'] = $this->aCvterm->toArray($keyType, $includeLazyLoadColumns,  $alreadyDumpedObjects, true);
1613:             }
1614:             if (null !== $this->collFeatureCvterms) {
1615:                 $result['FeatureCvterms'] = $this->collFeatureCvterms->toArray(null, true, $keyType, $includeLazyLoadColumns, $alreadyDumpedObjects);
1616:             }
1617:             if (null !== $this->collFeatureCvtermPubs) {
1618:                 $result['FeatureCvtermPubs'] = $this->collFeatureCvtermPubs->toArray(null, true, $keyType, $includeLazyLoadColumns, $alreadyDumpedObjects);
1619:             }
1620:             if (null !== $this->collFeaturePubs) {
1621:                 $result['FeaturePubs'] = $this->collFeaturePubs->toArray(null, true, $keyType, $includeLazyLoadColumns, $alreadyDumpedObjects);
1622:             }
1623:             if (null !== $this->collFeatureSynonyms) {
1624:                 $result['FeatureSynonyms'] = $this->collFeatureSynonyms->toArray(null, true, $keyType, $includeLazyLoadColumns, $alreadyDumpedObjects);
1625:             }
1626:             if (null !== $this->collPubDbxrefs) {
1627:                 $result['PubDbxrefs'] = $this->collPubDbxrefs->toArray(null, true, $keyType, $includeLazyLoadColumns, $alreadyDumpedObjects);
1628:             }
1629:             if (null !== $this->collPubRelationshipsRelatedByObjectId) {
1630:                 $result['PubRelationshipsRelatedByObjectId'] = $this->collPubRelationshipsRelatedByObjectId->toArray(null, true, $keyType, $includeLazyLoadColumns, $alreadyDumpedObjects);
1631:             }
1632:             if (null !== $this->collPubRelationshipsRelatedBySubjectId) {
1633:                 $result['PubRelationshipsRelatedBySubjectId'] = $this->collPubRelationshipsRelatedBySubjectId->toArray(null, true, $keyType, $includeLazyLoadColumns, $alreadyDumpedObjects);
1634:             }
1635:             if (null !== $this->collPubauthors) {
1636:                 $result['Pubauthors'] = $this->collPubauthors->toArray(null, true, $keyType, $includeLazyLoadColumns, $alreadyDumpedObjects);
1637:             }
1638:             if (null !== $this->collPubprops) {
1639:                 $result['Pubprops'] = $this->collPubprops->toArray(null, true, $keyType, $includeLazyLoadColumns, $alreadyDumpedObjects);
1640:             }
1641:         }
1642: 
1643:         return $result;
1644:     }
1645: 
1646:     /**
1647:      * Sets a field from the object by name passed in as a string.
1648:      *
1649:      * @param string $name peer name
1650:      * @param mixed $value field value
1651:      * @param string $type The type of fieldname the $name is of:
1652:      *                     one of the class type constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME
1653:      *                     BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM.
1654:      *                     Defaults to BasePeer::TYPE_PHPNAME
1655:      * @return void
1656:      */
1657:     public function setByName($name, $value, $type = BasePeer::TYPE_PHPNAME)
1658:     {
1659:         $pos = PubPeer::translateFieldName($name, $type, BasePeer::TYPE_NUM);
1660: 
1661:         $this->setByPosition($pos, $value);
1662:     }
1663: 
1664:     /**
1665:      * Sets a field from the object by Position as specified in the xml schema.
1666:      * Zero-based.
1667:      *
1668:      * @param int $pos position in xml schema
1669:      * @param mixed $value field value
1670:      * @return void
1671:      */
1672:     public function setByPosition($pos, $value)
1673:     {
1674:         switch ($pos) {
1675:             case 0:
1676:                 $this->setPubId($value);
1677:                 break;
1678:             case 1:
1679:                 $this->setTitle($value);
1680:                 break;
1681:             case 2:
1682:                 $this->setVolumetitle($value);
1683:                 break;
1684:             case 3:
1685:                 $this->setVolume($value);
1686:                 break;
1687:             case 4:
1688:                 $this->setSeriesName($value);
1689:                 break;
1690:             case 5:
1691:                 $this->setIssue($value);
1692:                 break;
1693:             case 6:
1694:                 $this->setPyear($value);
1695:                 break;
1696:             case 7:
1697:                 $this->setPages($value);
1698:                 break;
1699:             case 8:
1700:                 $this->setMiniref($value);
1701:                 break;
1702:             case 9:
1703:                 $this->setUniquename($value);
1704:                 break;
1705:             case 10:
1706:                 $this->setTypeId($value);
1707:                 break;
1708:             case 11:
1709:                 $this->setIsObsolete($value);
1710:                 break;
1711:             case 12:
1712:                 $this->setPublisher($value);
1713:                 break;
1714:             case 13:
1715:                 $this->setPubplace($value);
1716:                 break;
1717:         } // switch()
1718:     }
1719: 
1720:     /**
1721:      * Populates the object using an array.
1722:      *
1723:      * This is particularly useful when populating an object from one of the
1724:      * request arrays (e.g. $_POST).  This method goes through the column
1725:      * names, checking to see whether a matching key exists in populated
1726:      * array. If so the setByName() method is called for that column.
1727:      *
1728:      * You can specify the key type of the array by additionally passing one
1729:      * of the class type constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME,
1730:      * BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM.
1731:      * The default key type is the column's BasePeer::TYPE_PHPNAME
1732:      *
1733:      * @param array  $arr     An array to populate the object from.
1734:      * @param string $keyType The type of keys the array uses.
1735:      * @return void
1736:      */
1737:     public function fromArray($arr, $keyType = BasePeer::TYPE_PHPNAME)
1738:     {
1739:         $keys = PubPeer::getFieldNames($keyType);
1740: 
1741:         if (array_key_exists($keys[0], $arr)) $this->setPubId($arr[$keys[0]]);
1742:         if (array_key_exists($keys[1], $arr)) $this->setTitle($arr[$keys[1]]);
1743:         if (array_key_exists($keys[2], $arr)) $this->setVolumetitle($arr[$keys[2]]);
1744:         if (array_key_exists($keys[3], $arr)) $this->setVolume($arr[$keys[3]]);
1745:         if (array_key_exists($keys[4], $arr)) $this->setSeriesName($arr[$keys[4]]);
1746:         if (array_key_exists($keys[5], $arr)) $this->setIssue($arr[$keys[5]]);
1747:         if (array_key_exists($keys[6], $arr)) $this->setPyear($arr[$keys[6]]);
1748:         if (array_key_exists($keys[7], $arr)) $this->setPages($arr[$keys[7]]);
1749:         if (array_key_exists($keys[8], $arr)) $this->setMiniref($arr[$keys[8]]);
1750:         if (array_key_exists($keys[9], $arr)) $this->setUniquename($arr[$keys[9]]);
1751:         if (array_key_exists($keys[10], $arr)) $this->setTypeId($arr[$keys[10]]);
1752:         if (array_key_exists($keys[11], $arr)) $this->setIsObsolete($arr[$keys[11]]);
1753:         if (array_key_exists($keys[12], $arr)) $this->setPublisher($arr[$keys[12]]);
1754:         if (array_key_exists($keys[13], $arr)) $this->setPubplace($arr[$keys[13]]);
1755:     }
1756: 
1757:     /**
1758:      * Build a Criteria object containing the values of all modified columns in this object.
1759:      *
1760:      * @return Criteria The Criteria object containing all modified values.
1761:      */
1762:     public function buildCriteria()
1763:     {
1764:         $criteria = new Criteria(PubPeer::DATABASE_NAME);
1765: 
1766:         if ($this->isColumnModified(PubPeer::PUB_ID)) $criteria->add(PubPeer::PUB_ID, $this->pub_id);
1767:         if ($this->isColumnModified(PubPeer::TITLE)) $criteria->add(PubPeer::TITLE, $this->title);
1768:         if ($this->isColumnModified(PubPeer::VOLUMETITLE)) $criteria->add(PubPeer::VOLUMETITLE, $this->volumetitle);
1769:         if ($this->isColumnModified(PubPeer::VOLUME)) $criteria->add(PubPeer::VOLUME, $this->volume);
1770:         if ($this->isColumnModified(PubPeer::SERIES_NAME)) $criteria->add(PubPeer::SERIES_NAME, $this->series_name);
1771:         if ($this->isColumnModified(PubPeer::ISSUE)) $criteria->add(PubPeer::ISSUE, $this->issue);
1772:         if ($this->isColumnModified(PubPeer::PYEAR)) $criteria->add(PubPeer::PYEAR, $this->pyear);
1773:         if ($this->isColumnModified(PubPeer::PAGES)) $criteria->add(PubPeer::PAGES, $this->pages);
1774:         if ($this->isColumnModified(PubPeer::MINIREF)) $criteria->add(PubPeer::MINIREF, $this->miniref);
1775:         if ($this->isColumnModified(PubPeer::UNIQUENAME)) $criteria->add(PubPeer::UNIQUENAME, $this->uniquename);
1776:         if ($this->isColumnModified(PubPeer::TYPE_ID)) $criteria->add(PubPeer::TYPE_ID, $this->type_id);
1777:         if ($this->isColumnModified(PubPeer::IS_OBSOLETE)) $criteria->add(PubPeer::IS_OBSOLETE, $this->is_obsolete);
1778:         if ($this->isColumnModified(PubPeer::PUBLISHER)) $criteria->add(PubPeer::PUBLISHER, $this->publisher);
1779:         if ($this->isColumnModified(PubPeer::PUBPLACE)) $criteria->add(PubPeer::PUBPLACE, $this->pubplace);
1780: 
1781:         return $criteria;
1782:     }
1783: 
1784:     /**
1785:      * Builds a Criteria object containing the primary key for this object.
1786:      *
1787:      * Unlike buildCriteria() this method includes the primary key values regardless
1788:      * of whether or not they have been modified.
1789:      *
1790:      * @return Criteria The Criteria object containing value(s) for primary key(s).
1791:      */
1792:     public function buildPkeyCriteria()
1793:     {
1794:         $criteria = new Criteria(PubPeer::DATABASE_NAME);
1795:         $criteria->add(PubPeer::PUB_ID, $this->pub_id);
1796: 
1797:         return $criteria;
1798:     }
1799: 
1800:     /**
1801:      * Returns the primary key for this object (row).
1802:      * @return int
1803:      */
1804:     public function getPrimaryKey()
1805:     {
1806:         return $this->getPubId();
1807:     }
1808: 
1809:     /**
1810:      * Generic method to set the primary key (pub_id column).
1811:      *
1812:      * @param  int $key Primary key.
1813:      * @return void
1814:      */
1815:     public function setPrimaryKey($key)
1816:     {
1817:         $this->setPubId($key);
1818:     }
1819: 
1820:     /**
1821:      * Returns true if the primary key for this object is null.
1822:      * @return boolean
1823:      */
1824:     public function isPrimaryKeyNull()
1825:     {
1826: 
1827:         return null === $this->getPubId();
1828:     }
1829: 
1830:     /**
1831:      * Sets contents of passed object to values from current object.
1832:      *
1833:      * If desired, this method can also make copies of all associated (fkey referrers)
1834:      * objects.
1835:      *
1836:      * @param object $copyObj An object of Pub (or compatible) type.
1837:      * @param boolean $deepCopy Whether to also copy all rows that refer (by fkey) to the current row.
1838:      * @param boolean $makeNew Whether to reset autoincrement PKs and make the object new.
1839:      * @throws PropelException
1840:      */
1841:     public function copyInto($copyObj, $deepCopy = false, $makeNew = true)
1842:     {
1843:         $copyObj->setTitle($this->getTitle());
1844:         $copyObj->setVolumetitle($this->getVolumetitle());
1845:         $copyObj->setVolume($this->getVolume());
1846:         $copyObj->setSeriesName($this->getSeriesName());
1847:         $copyObj->setIssue($this->getIssue());
1848:         $copyObj->setPyear($this->getPyear());
1849:         $copyObj->setPages($this->getPages());
1850:         $copyObj->setMiniref($this->getMiniref());
1851:         $copyObj->setUniquename($this->getUniquename());
1852:         $copyObj->setTypeId($this->getTypeId());
1853:         $copyObj->setIsObsolete($this->getIsObsolete());
1854:         $copyObj->setPublisher($this->getPublisher());
1855:         $copyObj->setPubplace($this->getPubplace());
1856: 
1857:         if ($deepCopy && !$this->startCopy) {
1858:             // important: temporarily setNew(false) because this affects the behavior of
1859:             // the getter/setter methods for fkey referrer objects.
1860:             $copyObj->setNew(false);
1861:             // store object hash to prevent cycle
1862:             $this->startCopy = true;
1863: 
1864:             foreach ($this->getFeatureCvterms() as $relObj) {
1865:                 if ($relObj !== $this) {  // ensure that we don't try to copy a reference to ourselves
1866:                     $copyObj->addFeatureCvterm($relObj->copy($deepCopy));
1867:                 }
1868:             }
1869: 
1870:             foreach ($this->getFeatureCvtermPubs() as $relObj) {
1871:                 if ($relObj !== $this) {  // ensure that we don't try to copy a reference to ourselves
1872:                     $copyObj->addFeatureCvtermPub($relObj->copy($deepCopy));
1873:                 }
1874:             }
1875: 
1876:             foreach ($this->getFeaturePubs() as $relObj) {
1877:                 if ($relObj !== $this) {  // ensure that we don't try to copy a reference to ourselves
1878:                     $copyObj->addFeaturePub($relObj->copy($deepCopy));
1879:                 }
1880:             }
1881: 
1882:             foreach ($this->getFeatureSynonyms() as $relObj) {
1883:                 if ($relObj !== $this) {  // ensure that we don't try to copy a reference to ourselves
1884:                     $copyObj->addFeatureSynonym($relObj->copy($deepCopy));
1885:                 }
1886:             }
1887: 
1888:             foreach ($this->getPubDbxrefs() as $relObj) {
1889:                 if ($relObj !== $this) {  // ensure that we don't try to copy a reference to ourselves
1890:                     $copyObj->addPubDbxref($relObj->copy($deepCopy));
1891:                 }
1892:             }
1893: 
1894:             foreach ($this->getPubRelationshipsRelatedByObjectId() as $relObj) {
1895:                 if ($relObj !== $this) {  // ensure that we don't try to copy a reference to ourselves
1896:                     $copyObj->addPubRelationshipRelatedByObjectId($relObj->copy($deepCopy));
1897:                 }
1898:             }
1899: 
1900:             foreach ($this->getPubRelationshipsRelatedBySubjectId() as $relObj) {
1901:                 if ($relObj !== $this) {  // ensure that we don't try to copy a reference to ourselves
1902:                     $copyObj->addPubRelationshipRelatedBySubjectId($relObj->copy($deepCopy));
1903:                 }
1904:             }
1905: 
1906:             foreach ($this->getPubauthors() as $relObj) {
1907:                 if ($relObj !== $this) {  // ensure that we don't try to copy a reference to ourselves
1908:                     $copyObj->addPubauthor($relObj->copy($deepCopy));
1909:                 }
1910:             }
1911: 
1912:             foreach ($this->getPubprops() as $relObj) {
1913:                 if ($relObj !== $this) {  // ensure that we don't try to copy a reference to ourselves
1914:                     $copyObj->addPubprop($relObj->copy($deepCopy));
1915:                 }
1916:             }
1917: 
1918:             //unflag object copy
1919:             $this->startCopy = false;
1920:         } // if ($deepCopy)
1921: 
1922:         if ($makeNew) {
1923:             $copyObj->setNew(true);
1924:             $copyObj->setPubId(NULL); // this is a auto-increment column, so set to default value
1925:         }
1926:     }
1927: 
1928:     /**
1929:      * Makes a copy of this object that will be inserted as a new row in table when saved.
1930:      * It creates a new object filling in the simple attributes, but skipping any primary
1931:      * keys that are defined for the table.
1932:      *
1933:      * If desired, this method can also make copies of all associated (fkey referrers)
1934:      * objects.
1935:      *
1936:      * @param boolean $deepCopy Whether to also copy all rows that refer (by fkey) to the current row.
1937:      * @return Pub Clone of current object.
1938:      * @throws PropelException
1939:      */
1940:     public function copy($deepCopy = false)
1941:     {
1942:         // we use get_class(), because this might be a subclass
1943:         $clazz = get_class($this);
1944:         $copyObj = new $clazz();
1945:         $this->copyInto($copyObj, $deepCopy);
1946: 
1947:         return $copyObj;
1948:     }
1949: 
1950:     /**
1951:      * Returns a peer instance associated with this om.
1952:      *
1953:      * Since Peer classes are not to have any instance attributes, this method returns the
1954:      * same instance for all member of this class. The method could therefore
1955:      * be static, but this would prevent one from overriding the behavior.
1956:      *
1957:      * @return PubPeer
1958:      */
1959:     public function getPeer()
1960:     {
1961:         if (self::$peer === null) {
1962:             self::$peer = new PubPeer();
1963:         }
1964: 
1965:         return self::$peer;
1966:     }
1967: 
1968:     /**
1969:      * Declares an association between this object and a Cvterm object.
1970:      *
1971:      * @param             Cvterm $v
1972:      * @return Pub The current object (for fluent API support)
1973:      * @throws PropelException
1974:      */
1975:     public function setCvterm(Cvterm $v = null)
1976:     {
1977:         if ($v === null) {
1978:             $this->setTypeId(NULL);
1979:         } else {
1980:             $this->setTypeId($v->getCvtermId());
1981:         }
1982: 
1983:         $this->aCvterm = $v;
1984: 
1985:         // Add binding for other direction of this n:n relationship.
1986:         // If this object has already been added to the Cvterm object, it will not be re-added.
1987:         if ($v !== null) {
1988:             $v->addPub($this);
1989:         }
1990: 
1991: 
1992:         return $this;
1993:     }
1994: 
1995: 
1996:     /**
1997:      * Get the associated Cvterm object
1998:      *
1999:      * @param PropelPDO $con Optional Connection object.
2000:      * @param $doQuery Executes a query to get the object if required
2001:      * @return Cvterm The associated Cvterm object.
2002:      * @throws PropelException
2003:      */
2004:     public function getCvterm(PropelPDO $con = null, $doQuery = true)
2005:     {
2006:         if ($this->aCvterm === null && ($this->type_id !== null) && $doQuery) {
2007:             $this->aCvterm = CvtermQuery::create()->findPk($this->type_id, $con);
2008:             /* The following can be used additionally to
2009:                 guarantee the related object contains a reference
2010:                 to this object.  This level of coupling may, however, be
2011:                 undesirable since it could result in an only partially populated collection
2012:                 in the referenced object.
2013:                 $this->aCvterm->addPubs($this);
2014:              */
2015:         }
2016: 
2017:         return $this->aCvterm;
2018:     }
2019: 
2020: 
2021:     /**
2022:      * Initializes a collection based on the name of a relation.
2023:      * Avoids crafting an 'init[$relationName]s' method name
2024:      * that wouldn't work when StandardEnglishPluralizer is used.
2025:      *
2026:      * @param string $relationName The name of the relation to initialize
2027:      * @return void
2028:      */
2029:     public function initRelation($relationName)
2030:     {
2031:         if ('FeatureCvterm' == $relationName) {
2032:             $this->initFeatureCvterms();
2033:         }
2034:         if ('FeatureCvtermPub' == $relationName) {
2035:             $this->initFeatureCvtermPubs();
2036:         }
2037:         if ('FeaturePub' == $relationName) {
2038:             $this->initFeaturePubs();
2039:         }
2040:         if ('FeatureSynonym' == $relationName) {
2041:             $this->initFeatureSynonyms();
2042:         }
2043:         if ('PubDbxref' == $relationName) {
2044:             $this->initPubDbxrefs();
2045:         }
2046:         if ('PubRelationshipRelatedByObjectId' == $relationName) {
2047:             $this->initPubRelationshipsRelatedByObjectId();
2048:         }
2049:         if ('PubRelationshipRelatedBySubjectId' == $relationName) {
2050:             $this->initPubRelationshipsRelatedBySubjectId();
2051:         }
2052:         if ('Pubauthor' == $relationName) {
2053:             $this->initPubauthors();
2054:         }
2055:         if ('Pubprop' == $relationName) {
2056:             $this->initPubprops();
2057:         }
2058:     }
2059: 
2060:     /**
2061:      * Clears out the collFeatureCvterms collection
2062:      *
2063:      * This does not modify the database; however, it will remove any associated objects, causing
2064:      * them to be refetched by subsequent calls to accessor method.
2065:      *
2066:      * @return Pub The current object (for fluent API support)
2067:      * @see        addFeatureCvterms()
2068:      */
2069:     public function clearFeatureCvterms()
2070:     {
2071:         $this->collFeatureCvterms = null; // important to set this to null since that means it is uninitialized
2072:         $this->collFeatureCvtermsPartial = null;
2073: 
2074:         return $this;
2075:     }
2076: 
2077:     /**
2078:      * reset is the collFeatureCvterms collection loaded partially
2079:      *
2080:      * @return void
2081:      */
2082:     public function resetPartialFeatureCvterms($v = true)
2083:     {
2084:         $this->collFeatureCvtermsPartial = $v;
2085:     }
2086: 
2087:     /**
2088:      * Initializes the collFeatureCvterms collection.
2089:      *
2090:      * By default this just sets the collFeatureCvterms collection to an empty array (like clearcollFeatureCvterms());
2091:      * however, you may wish to override this method in your stub class to provide setting appropriate
2092:      * to your application -- for example, setting the initial array to the values stored in database.
2093:      *
2094:      * @param boolean $overrideExisting If set to true, the method call initializes
2095:      *                                        the collection even if it is not empty
2096:      *
2097:      * @return void
2098:      */
2099:     public function initFeatureCvterms($overrideExisting = true)
2100:     {
2101:         if (null !== $this->collFeatureCvterms && !$overrideExisting) {
2102:             return;
2103:         }
2104:         $this->collFeatureCvterms = new PropelObjectCollection();
2105:         $this->collFeatureCvterms->setModel('FeatureCvterm');
2106:     }
2107: 
2108:     /**
2109:      * Gets an array of FeatureCvterm objects which contain a foreign key that references this object.
2110:      *
2111:      * If the $criteria is not null, it is used to always fetch the results from the database.
2112:      * Otherwise the results are fetched from the database the first time, then cached.
2113:      * Next time the same method is called without $criteria, the cached collection is returned.
2114:      * If this Pub is new, it will return
2115:      * an empty collection or the current collection; the criteria is ignored on a new object.
2116:      *
2117:      * @param Criteria $criteria optional Criteria object to narrow the query
2118:      * @param PropelPDO $con optional connection object
2119:      * @return PropelObjectCollection|FeatureCvterm[] List of FeatureCvterm objects
2120:      * @throws PropelException
2121:      */
2122:     public function getFeatureCvterms($criteria = null, PropelPDO $con = null)
2123:     {
2124:         $partial = $this->collFeatureCvtermsPartial && !$this->isNew();
2125:         if (null === $this->collFeatureCvterms || null !== $criteria  || $partial) {
2126:             if ($this->isNew() && null === $this->collFeatureCvterms) {
2127:                 // return empty collection
2128:                 $this->initFeatureCvterms();
2129:             } else {
2130:                 $collFeatureCvterms = FeatureCvtermQuery::create(null, $criteria)
2131:                     ->filterByPub($this)
2132:                     ->find($con);
2133:                 if (null !== $criteria) {
2134:                     if (false !== $this->collFeatureCvtermsPartial && count($collFeatureCvterms)) {
2135:                       $this->initFeatureCvterms(false);
2136: 
2137:                       foreach($collFeatureCvterms as $obj) {
2138:                         if (false == $this->collFeatureCvterms->contains($obj)) {
2139:                           $this->collFeatureCvterms->append($obj);
2140:                         }
2141:                       }
2142: 
2143:                       $this->collFeatureCvtermsPartial = true;
2144:                     }
2145: 
2146:                     $collFeatureCvterms->getInternalIterator()->rewind();
2147:                     return $collFeatureCvterms;
2148:                 }
2149: 
2150:                 if($partial && $this->collFeatureCvterms) {
2151:                     foreach($this->collFeatureCvterms as $obj) {
2152:                         if($obj->isNew()) {
2153:                             $collFeatureCvterms[] = $obj;
2154:                         }
2155:                     }
2156:                 }
2157: 
2158:                 $this->collFeatureCvterms = $collFeatureCvterms;
2159:                 $this->collFeatureCvtermsPartial = false;
2160:             }
2161:         }
2162: 
2163:         return $this->collFeatureCvterms;
2164:     }
2165: 
2166:     /**
2167:      * Sets a collection of FeatureCvterm objects related by a one-to-many relationship
2168:      * to the current object.
2169:      * It will also schedule objects for deletion based on a diff between old objects (aka persisted)
2170:      * and new objects from the given Propel collection.
2171:      *
2172:      * @param PropelCollection $featureCvterms A Propel collection.
2173:      * @param PropelPDO $con Optional connection object
2174:      * @return Pub The current object (for fluent API support)
2175:      */
2176:     public function setFeatureCvterms(PropelCollection $featureCvterms, PropelPDO $con = null)
2177:     {
2178:         $featureCvtermsToDelete = $this->getFeatureCvterms(new Criteria(), $con)->diff($featureCvterms);
2179: 
2180:         $this->featureCvtermsScheduledForDeletion = unserialize(serialize($featureCvtermsToDelete));
2181: 
2182:         foreach ($featureCvtermsToDelete as $featureCvtermRemoved) {
2183:             $featureCvtermRemoved->setPub(null);
2184:         }
2185: 
2186:         $this->collFeatureCvterms = null;
2187:         foreach ($featureCvterms as $featureCvterm) {
2188:             $this->addFeatureCvterm($featureCvterm);
2189:         }
2190: 
2191:         $this->collFeatureCvterms = $featureCvterms;
2192:         $this->collFeatureCvtermsPartial = false;
2193: 
2194:         return $this;
2195:     }
2196: 
2197:     /**
2198:      * Returns the number of related FeatureCvterm objects.
2199:      *
2200:      * @param Criteria $criteria
2201:      * @param boolean $distinct
2202:      * @param PropelPDO $con
2203:      * @return int             Count of related FeatureCvterm objects.
2204:      * @throws PropelException
2205:      */
2206:     public function countFeatureCvterms(Criteria $criteria = null, $distinct = false, PropelPDO $con = null)
2207:     {
2208:         $partial = $this->collFeatureCvtermsPartial && !$this->isNew();
2209:         if (null === $this->collFeatureCvterms || null !== $criteria || $partial) {
2210:             if ($this->isNew() && null === $this->collFeatureCvterms) {
2211:                 return 0;
2212:             }
2213: 
2214:             if($partial && !$criteria) {
2215:                 return count($this->getFeatureCvterms());
2216:             }
2217:             $query = FeatureCvtermQuery::create(null, $criteria);
2218:             if ($distinct) {
2219:                 $query->distinct();
2220:             }
2221: 
2222:             return $query
2223:                 ->filterByPub($this)
2224:                 ->count($con);
2225:         }
2226: 
2227:         return count($this->collFeatureCvterms);
2228:     }
2229: 
2230:     /**
2231:      * Method called to associate a FeatureCvterm object to this object
2232:      * through the FeatureCvterm foreign key attribute.
2233:      *
2234:      * @param    FeatureCvterm $l FeatureCvterm
2235:      * @return Pub The current object (for fluent API support)
2236:      */
2237:     public function addFeatureCvterm(FeatureCvterm $l)
2238:     {
2239:         if ($this->collFeatureCvterms === null) {
2240:             $this->initFeatureCvterms();
2241:             $this->collFeatureCvtermsPartial = true;
2242:         }
2243:         if (!in_array($l, $this->collFeatureCvterms->getArrayCopy(), true)) { // only add it if the **same** object is not already associated
2244:             $this->doAddFeatureCvterm($l);
2245:         }
2246: 
2247:         return $this;
2248:     }
2249: 
2250:     /**
2251:      * @param   FeatureCvterm $featureCvterm The featureCvterm object to add.
2252:      */
2253:     protected function doAddFeatureCvterm($featureCvterm)
2254:     {
2255:         $this->collFeatureCvterms[]= $featureCvterm;
2256:         $featureCvterm->setPub($this);
2257:     }
2258: 
2259:     /**
2260:      * @param   FeatureCvterm $featureCvterm The featureCvterm object to remove.
2261:      * @return Pub The current object (for fluent API support)
2262:      */
2263:     public function removeFeatureCvterm($featureCvterm)
2264:     {
2265:         if ($this->getFeatureCvterms()->contains($featureCvterm)) {
2266:             $this->collFeatureCvterms->remove($this->collFeatureCvterms->search($featureCvterm));
2267:             if (null === $this->featureCvtermsScheduledForDeletion) {
2268:                 $this->featureCvtermsScheduledForDeletion = clone $this->collFeatureCvterms;
2269:                 $this->featureCvtermsScheduledForDeletion->clear();
2270:             }
2271:             $this->featureCvtermsScheduledForDeletion[]= clone $featureCvterm;
2272:             $featureCvterm->setPub(null);
2273:         }
2274: 
2275:         return $this;
2276:     }
2277: 
2278: 
2279:     /**
2280:      * If this collection has already been initialized with
2281:      * an identical criteria, it returns the collection.
2282:      * Otherwise if this Pub is new, it will return
2283:      * an empty collection; or if this Pub has previously
2284:      * been saved, it will retrieve related FeatureCvterms from storage.
2285:      *
2286:      * This method is protected by default in order to keep the public
2287:      * api reasonable.  You can provide public methods for those you
2288:      * actually need in Pub.
2289:      *
2290:      * @param Criteria $criteria optional Criteria object to narrow the query
2291:      * @param PropelPDO $con optional connection object
2292:      * @param string $join_behavior optional join type to use (defaults to Criteria::LEFT_JOIN)
2293:      * @return PropelObjectCollection|FeatureCvterm[] List of FeatureCvterm objects
2294:      */
2295:     public function getFeatureCvtermsJoinCvterm($criteria = null, $con = null, $join_behavior = Criteria::LEFT_JOIN)
2296:     {
2297:         $query = FeatureCvtermQuery::create(null, $criteria);
2298:         $query->joinWith('Cvterm', $join_behavior);
2299: 
2300:         return $this->getFeatureCvterms($query, $con);
2301:     }
2302: 
2303: 
2304:     /**
2305:      * If this collection has already been initialized with
2306:      * an identical criteria, it returns the collection.
2307:      * Otherwise if this Pub is new, it will return
2308:      * an empty collection; or if this Pub has previously
2309:      * been saved, it will retrieve related FeatureCvterms from storage.
2310:      *
2311:      * This method is protected by default in order to keep the public
2312:      * api reasonable.  You can provide public methods for those you
2313:      * actually need in Pub.
2314:      *
2315:      * @param Criteria $criteria optional Criteria object to narrow the query
2316:      * @param PropelPDO $con optional connection object
2317:      * @param string $join_behavior optional join type to use (defaults to Criteria::LEFT_JOIN)
2318:      * @return PropelObjectCollection|FeatureCvterm[] List of FeatureCvterm objects
2319:      */
2320:     public function getFeatureCvtermsJoinFeature($criteria = null, $con = null, $join_behavior = Criteria::LEFT_JOIN)
2321:     {
2322:         $query = FeatureCvtermQuery::create(null, $criteria);
2323:         $query->joinWith('Feature', $join_behavior);
2324: 
2325:         return $this->getFeatureCvterms($query, $con);
2326:     }
2327: 
2328:     /**
2329:      * Clears out the collFeatureCvtermPubs collection
2330:      *
2331:      * This does not modify the database; however, it will remove any associated objects, causing
2332:      * them to be refetched by subsequent calls to accessor method.
2333:      *
2334:      * @return Pub The current object (for fluent API support)
2335:      * @see        addFeatureCvtermPubs()
2336:      */
2337:     public function clearFeatureCvtermPubs()
2338:     {
2339:         $this->collFeatureCvtermPubs = null; // important to set this to null since that means it is uninitialized
2340:         $this->collFeatureCvtermPubsPartial = null;
2341: 
2342:         return $this;
2343:     }
2344: 
2345:     /**
2346:      * reset is the collFeatureCvtermPubs collection loaded partially
2347:      *
2348:      * @return void
2349:      */
2350:     public function resetPartialFeatureCvtermPubs($v = true)
2351:     {
2352:         $this->collFeatureCvtermPubsPartial = $v;
2353:     }
2354: 
2355:     /**
2356:      * Initializes the collFeatureCvtermPubs collection.
2357:      *
2358:      * By default this just sets the collFeatureCvtermPubs collection to an empty array (like clearcollFeatureCvtermPubs());
2359:      * however, you may wish to override this method in your stub class to provide setting appropriate
2360:      * to your application -- for example, setting the initial array to the values stored in database.
2361:      *
2362:      * @param boolean $overrideExisting If set to true, the method call initializes
2363:      *                                        the collection even if it is not empty
2364:      *
2365:      * @return void
2366:      */
2367:     public function initFeatureCvtermPubs($overrideExisting = true)
2368:     {
2369:         if (null !== $this->collFeatureCvtermPubs && !$overrideExisting) {
2370:             return;
2371:         }
2372:         $this->collFeatureCvtermPubs = new PropelObjectCollection();
2373:         $this->collFeatureCvtermPubs->setModel('FeatureCvtermPub');
2374:     }
2375: 
2376:     /**
2377:      * Gets an array of FeatureCvtermPub objects which contain a foreign key that references this object.
2378:      *
2379:      * If the $criteria is not null, it is used to always fetch the results from the database.
2380:      * Otherwise the results are fetched from the database the first time, then cached.
2381:      * Next time the same method is called without $criteria, the cached collection is returned.
2382:      * If this Pub is new, it will return
2383:      * an empty collection or the current collection; the criteria is ignored on a new object.
2384:      *
2385:      * @param Criteria $criteria optional Criteria object to narrow the query
2386:      * @param PropelPDO $con optional connection object
2387:      * @return PropelObjectCollection|FeatureCvtermPub[] List of FeatureCvtermPub objects
2388:      * @throws PropelException
2389:      */
2390:     public function getFeatureCvtermPubs($criteria = null, PropelPDO $con = null)
2391:     {
2392:         $partial = $this->collFeatureCvtermPubsPartial && !$this->isNew();
2393:         if (null === $this->collFeatureCvtermPubs || null !== $criteria  || $partial) {
2394:             if ($this->isNew() && null === $this->collFeatureCvtermPubs) {
2395:                 // return empty collection
2396:                 $this->initFeatureCvtermPubs();
2397:             } else {
2398:                 $collFeatureCvtermPubs = FeatureCvtermPubQuery::create(null, $criteria)
2399:                     ->filterByPub($this)
2400:                     ->find($con);
2401:                 if (null !== $criteria) {
2402:                     if (false !== $this->collFeatureCvtermPubsPartial && count($collFeatureCvtermPubs)) {
2403:                       $this->initFeatureCvtermPubs(false);
2404: 
2405:                       foreach($collFeatureCvtermPubs as $obj) {
2406:                         if (false == $this->collFeatureCvtermPubs->contains($obj)) {
2407:                           $this->collFeatureCvtermPubs->append($obj);
2408:                         }
2409:                       }
2410: 
2411:                       $this->collFeatureCvtermPubsPartial = true;
2412:                     }
2413: 
2414:                     $collFeatureCvtermPubs->getInternalIterator()->rewind();
2415:                     return $collFeatureCvtermPubs;
2416:                 }
2417: 
2418:                 if($partial && $this->collFeatureCvtermPubs) {
2419:                     foreach($this->collFeatureCvtermPubs as $obj) {
2420:                         if($obj->isNew()) {
2421:                             $collFeatureCvtermPubs[] = $obj;
2422:                         }
2423:                     }
2424:                 }
2425: 
2426:                 $this->collFeatureCvtermPubs = $collFeatureCvtermPubs;
2427:                 $this->collFeatureCvtermPubsPartial = false;
2428:             }
2429:         }
2430: 
2431:         return $this->collFeatureCvtermPubs;
2432:     }
2433: 
2434:     /**
2435:      * Sets a collection of FeatureCvtermPub objects related by a one-to-many relationship
2436:      * to the current object.
2437:      * It will also schedule objects for deletion based on a diff between old objects (aka persisted)
2438:      * and new objects from the given Propel collection.
2439:      *
2440:      * @param PropelCollection $featureCvtermPubs A Propel collection.
2441:      * @param PropelPDO $con Optional connection object
2442:      * @return Pub The current object (for fluent API support)
2443:      */
2444:     public function setFeatureCvtermPubs(PropelCollection $featureCvtermPubs, PropelPDO $con = null)
2445:     {
2446:         $featureCvtermPubsToDelete = $this->getFeatureCvtermPubs(new Criteria(), $con)->diff($featureCvtermPubs);
2447: 
2448:         $this->featureCvtermPubsScheduledForDeletion = unserialize(serialize($featureCvtermPubsToDelete));
2449: 
2450:         foreach ($featureCvtermPubsToDelete as $featureCvtermPubRemoved) {
2451:             $featureCvtermPubRemoved->setPub(null);
2452:         }
2453: 
2454:         $this->collFeatureCvtermPubs = null;
2455:         foreach ($featureCvtermPubs as $featureCvtermPub) {
2456:             $this->addFeatureCvtermPub($featureCvtermPub);
2457:         }
2458: 
2459:         $this->collFeatureCvtermPubs = $featureCvtermPubs;
2460:         $this->collFeatureCvtermPubsPartial = false;
2461: 
2462:         return $this;
2463:     }
2464: 
2465:     /**
2466:      * Returns the number of related FeatureCvtermPub objects.
2467:      *
2468:      * @param Criteria $criteria
2469:      * @param boolean $distinct
2470:      * @param PropelPDO $con
2471:      * @return int             Count of related FeatureCvtermPub objects.
2472:      * @throws PropelException
2473:      */
2474:     public function countFeatureCvtermPubs(Criteria $criteria = null, $distinct = false, PropelPDO $con = null)
2475:     {
2476:         $partial = $this->collFeatureCvtermPubsPartial && !$this->isNew();
2477:         if (null === $this->collFeatureCvtermPubs || null !== $criteria || $partial) {
2478:             if ($this->isNew() && null === $this->collFeatureCvtermPubs) {
2479:                 return 0;
2480:             }
2481: 
2482:             if($partial && !$criteria) {
2483:                 return count($this->getFeatureCvtermPubs());
2484:             }
2485:             $query = FeatureCvtermPubQuery::create(null, $criteria);
2486:             if ($distinct) {
2487:                 $query->distinct();
2488:             }
2489: 
2490:             return $query
2491:                 ->filterByPub($this)
2492:                 ->count($con);
2493:         }
2494: 
2495:         return count($this->collFeatureCvtermPubs);
2496:     }
2497: 
2498:     /**
2499:      * Method called to associate a FeatureCvtermPub object to this object
2500:      * through the FeatureCvtermPub foreign key attribute.
2501:      *
2502:      * @param    FeatureCvtermPub $l FeatureCvtermPub
2503:      * @return Pub The current object (for fluent API support)
2504:      */
2505:     public function addFeatureCvtermPub(FeatureCvtermPub $l)
2506:     {
2507:         if ($this->collFeatureCvtermPubs === null) {
2508:             $this->initFeatureCvtermPubs();
2509:             $this->collFeatureCvtermPubsPartial = true;
2510:         }
2511:         if (!in_array($l, $this->collFeatureCvtermPubs->getArrayCopy(), true)) { // only add it if the **same** object is not already associated
2512:             $this->doAddFeatureCvtermPub($l);
2513:         }
2514: 
2515:         return $this;
2516:     }
2517: 
2518:     /**
2519:      * @param   FeatureCvtermPub $featureCvtermPub The featureCvtermPub object to add.
2520:      */
2521:     protected function doAddFeatureCvtermPub($featureCvtermPub)
2522:     {
2523:         $this->collFeatureCvtermPubs[]= $featureCvtermPub;
2524:         $featureCvtermPub->setPub($this);
2525:     }
2526: 
2527:     /**
2528:      * @param   FeatureCvtermPub $featureCvtermPub The featureCvtermPub object to remove.
2529:      * @return Pub The current object (for fluent API support)
2530:      */
2531:     public function removeFeatureCvtermPub($featureCvtermPub)
2532:     {
2533:         if ($this->getFeatureCvtermPubs()->contains($featureCvtermPub)) {
2534:             $this->collFeatureCvtermPubs->remove($this->collFeatureCvtermPubs->search($featureCvtermPub));
2535:             if (null === $this->featureCvtermPubsScheduledForDeletion) {
2536:                 $this->featureCvtermPubsScheduledForDeletion = clone $this->collFeatureCvtermPubs;
2537:                 $this->featureCvtermPubsScheduledForDeletion->clear();
2538:             }
2539:             $this->featureCvtermPubsScheduledForDeletion[]= clone $featureCvtermPub;
2540:             $featureCvtermPub->setPub(null);
2541:         }
2542: 
2543:         return $this;
2544:     }
2545: 
2546: 
2547:     /**
2548:      * If this collection has already been initialized with
2549:      * an identical criteria, it returns the collection.
2550:      * Otherwise if this Pub is new, it will return
2551:      * an empty collection; or if this Pub has previously
2552:      * been saved, it will retrieve related FeatureCvtermPubs from storage.
2553:      *
2554:      * This method is protected by default in order to keep the public
2555:      * api reasonable.  You can provide public methods for those you
2556:      * actually need in Pub.
2557:      *
2558:      * @param Criteria $criteria optional Criteria object to narrow the query
2559:      * @param PropelPDO $con optional connection object
2560:      * @param string $join_behavior optional join type to use (defaults to Criteria::LEFT_JOIN)
2561:      * @return PropelObjectCollection|FeatureCvtermPub[] List of FeatureCvtermPub objects
2562:      */
2563:     public function getFeatureCvtermPubsJoinFeatureCvterm($criteria = null, $con = null, $join_behavior = Criteria::LEFT_JOIN)
2564:     {
2565:         $query = FeatureCvtermPubQuery::create(null, $criteria);
2566:         $query->joinWith('FeatureCvterm', $join_behavior);
2567: 
2568:         return $this->getFeatureCvtermPubs($query, $con);
2569:     }
2570: 
2571:     /**
2572:      * Clears out the collFeaturePubs collection
2573:      *
2574:      * This does not modify the database; however, it will remove any associated objects, causing
2575:      * them to be refetched by subsequent calls to accessor method.
2576:      *
2577:      * @return Pub The current object (for fluent API support)
2578:      * @see        addFeaturePubs()
2579:      */
2580:     public function clearFeaturePubs()
2581:     {
2582:         $this->collFeaturePubs = null; // important to set this to null since that means it is uninitialized
2583:         $this->collFeaturePubsPartial = null;
2584: 
2585:         return $this;
2586:     }
2587: 
2588:     /**
2589:      * reset is the collFeaturePubs collection loaded partially
2590:      *
2591:      * @return void
2592:      */
2593:     public function resetPartialFeaturePubs($v = true)
2594:     {
2595:         $this->collFeaturePubsPartial = $v;
2596:     }
2597: 
2598:     /**
2599:      * Initializes the collFeaturePubs collection.
2600:      *
2601:      * By default this just sets the collFeaturePubs collection to an empty array (like clearcollFeaturePubs());
2602:      * however, you may wish to override this method in your stub class to provide setting appropriate
2603:      * to your application -- for example, setting the initial array to the values stored in database.
2604:      *
2605:      * @param boolean $overrideExisting If set to true, the method call initializes
2606:      *                                        the collection even if it is not empty
2607:      *
2608:      * @return void
2609:      */
2610:     public function initFeaturePubs($overrideExisting = true)
2611:     {
2612:         if (null !== $this->collFeaturePubs && !$overrideExisting) {
2613:             return;
2614:         }
2615:         $this->collFeaturePubs = new PropelObjectCollection();
2616:         $this->collFeaturePubs->setModel('FeaturePub');
2617:     }
2618: 
2619:     /**
2620:      * Gets an array of FeaturePub objects which contain a foreign key that references this object.
2621:      *
2622:      * If the $criteria is not null, it is used to always fetch the results from the database.
2623:      * Otherwise the results are fetched from the database the first time, then cached.
2624:      * Next time the same method is called without $criteria, the cached collection is returned.
2625:      * If this Pub is new, it will return
2626:      * an empty collection or the current collection; the criteria is ignored on a new object.
2627:      *
2628:      * @param Criteria $criteria optional Criteria object to narrow the query
2629:      * @param PropelPDO $con optional connection object
2630:      * @return PropelObjectCollection|FeaturePub[] List of FeaturePub objects
2631:      * @throws PropelException
2632:      */
2633:     public function getFeaturePubs($criteria = null, PropelPDO $con = null)
2634:     {
2635:         $partial = $this->collFeaturePubsPartial && !$this->isNew();
2636:         if (null === $this->collFeaturePubs || null !== $criteria  || $partial) {
2637:             if ($this->isNew() && null === $this->collFeaturePubs) {
2638:                 // return empty collection
2639:                 $this->initFeaturePubs();
2640:             } else {
2641:                 $collFeaturePubs = FeaturePubQuery::create(null, $criteria)
2642:                     ->filterByPub($this)
2643:                     ->find($con);
2644:                 if (null !== $criteria) {
2645:                     if (false !== $this->collFeaturePubsPartial && count($collFeaturePubs)) {
2646:                       $this->initFeaturePubs(false);
2647: 
2648:                       foreach($collFeaturePubs as $obj) {
2649:                         if (false == $this->collFeaturePubs->contains($obj)) {
2650:                           $this->collFeaturePubs->append($obj);
2651:                         }
2652:                       }
2653: 
2654:                       $this->collFeaturePubsPartial = true;
2655:                     }
2656: 
2657:                     $collFeaturePubs->getInternalIterator()->rewind();
2658:                     return $collFeaturePubs;
2659:                 }
2660: 
2661:                 if($partial && $this->collFeaturePubs) {
2662:                     foreach($this->collFeaturePubs as $obj) {
2663:                         if($obj->isNew()) {
2664:                             $collFeaturePubs[] = $obj;
2665:                         }
2666:                     }
2667:                 }
2668: 
2669:                 $this->collFeaturePubs = $collFeaturePubs;
2670:                 $this->collFeaturePubsPartial = false;
2671:             }
2672:         }
2673: 
2674:         return $this->collFeaturePubs;
2675:     }
2676: 
2677:     /**
2678:      * Sets a collection of FeaturePub objects related by a one-to-many relationship
2679:      * to the current object.
2680:      * It will also schedule objects for deletion based on a diff between old objects (aka persisted)
2681:      * and new objects from the given Propel collection.
2682:      *
2683:      * @param PropelCollection $featurePubs A Propel collection.
2684:      * @param PropelPDO $con Optional connection object
2685:      * @return Pub The current object (for fluent API support)
2686:      */
2687:     public function setFeaturePubs(PropelCollection $featurePubs, PropelPDO $con = null)
2688:     {
2689:         $featurePubsToDelete = $this->getFeaturePubs(new Criteria(), $con)->diff($featurePubs);
2690: 
2691:         $this->featurePubsScheduledForDeletion = unserialize(serialize($featurePubsToDelete));
2692: 
2693:         foreach ($featurePubsToDelete as $featurePubRemoved) {
2694:             $featurePubRemoved->setPub(null);
2695:         }
2696: 
2697:         $this->collFeaturePubs = null;
2698:         foreach ($featurePubs as $featurePub) {
2699:             $this->addFeaturePub($featurePub);
2700:         }
2701: 
2702:         $this->collFeaturePubs = $featurePubs;
2703:         $this->collFeaturePubsPartial = false;
2704: 
2705:         return $this;
2706:     }
2707: 
2708:     /**
2709:      * Returns the number of related FeaturePub objects.
2710:      *
2711:      * @param Criteria $criteria
2712:      * @param boolean $distinct
2713:      * @param PropelPDO $con
2714:      * @return int             Count of related FeaturePub objects.
2715:      * @throws PropelException
2716:      */
2717:     public function countFeaturePubs(Criteria $criteria = null, $distinct = false, PropelPDO $con = null)
2718:     {
2719:         $partial = $this->collFeaturePubsPartial && !$this->isNew();
2720:         if (null === $this->collFeaturePubs || null !== $criteria || $partial) {
2721:             if ($this->isNew() && null === $this->collFeaturePubs) {
2722:                 return 0;
2723:             }
2724: 
2725:             if($partial && !$criteria) {
2726:                 return count($this->getFeaturePubs());
2727:             }
2728:             $query = FeaturePubQuery::create(null, $criteria);
2729:             if ($distinct) {
2730:                 $query->distinct();
2731:             }
2732: 
2733:             return $query
2734:                 ->filterByPub($this)
2735:                 ->count($con);
2736:         }
2737: 
2738:         return count($this->collFeaturePubs);
2739:     }
2740: 
2741:     /**
2742:      * Method called to associate a FeaturePub object to this object
2743:      * through the FeaturePub foreign key attribute.
2744:      *
2745:      * @param    FeaturePub $l FeaturePub
2746:      * @return Pub The current object (for fluent API support)
2747:      */
2748:     public function addFeaturePub(FeaturePub $l)
2749:     {
2750:         if ($this->collFeaturePubs === null) {
2751:             $this->initFeaturePubs();
2752:             $this->collFeaturePubsPartial = true;
2753:         }
2754:         if (!in_array($l, $this->collFeaturePubs->getArrayCopy(), true)) { // only add it if the **same** object is not already associated
2755:             $this->doAddFeaturePub($l);
2756:         }
2757: 
2758:         return $this;
2759:     }
2760: 
2761:     /**
2762:      * @param   FeaturePub $featurePub The featurePub object to add.
2763:      */
2764:     protected function doAddFeaturePub($featurePub)
2765:     {
2766:         $this->collFeaturePubs[]= $featurePub;
2767:         $featurePub->setPub($this);
2768:     }
2769: 
2770:     /**
2771:      * @param   FeaturePub $featurePub The featurePub object to remove.
2772:      * @return Pub The current object (for fluent API support)
2773:      */
2774:     public function removeFeaturePub($featurePub)
2775:     {
2776:         if ($this->getFeaturePubs()->contains($featurePub)) {
2777:             $this->collFeaturePubs->remove($this->collFeaturePubs->search($featurePub));
2778:             if (null === $this->featurePubsScheduledForDeletion) {
2779:                 $this->featurePubsScheduledForDeletion = clone $this->collFeaturePubs;
2780:                 $this->featurePubsScheduledForDeletion->clear();
2781:             }
2782:             $this->featurePubsScheduledForDeletion[]= clone $featurePub;
2783:             $featurePub->setPub(null);
2784:         }
2785: 
2786:         return $this;
2787:     }
2788: 
2789: 
2790:     /**
2791:      * If this collection has already been initialized with
2792:      * an identical criteria, it returns the collection.
2793:      * Otherwise if this Pub is new, it will return
2794:      * an empty collection; or if this Pub has previously
2795:      * been saved, it will retrieve related FeaturePubs from storage.
2796:      *
2797:      * This method is protected by default in order to keep the public
2798:      * api reasonable.  You can provide public methods for those you
2799:      * actually need in Pub.
2800:      *
2801:      * @param Criteria $criteria optional Criteria object to narrow the query
2802:      * @param PropelPDO $con optional connection object
2803:      * @param string $join_behavior optional join type to use (defaults to Criteria::LEFT_JOIN)
2804:      * @return PropelObjectCollection|FeaturePub[] List of FeaturePub objects
2805:      */
2806:     public function getFeaturePubsJoinFeature($criteria = null, $con = null, $join_behavior = Criteria::LEFT_JOIN)
2807:     {
2808:         $query = FeaturePubQuery::create(null, $criteria);
2809:         $query->joinWith('Feature', $join_behavior);
2810: 
2811:         return $this->getFeaturePubs($query, $con);
2812:     }
2813: 
2814:     /**
2815:      * Clears out the collFeatureSynonyms collection
2816:      *
2817:      * This does not modify the database; however, it will remove any associated objects, causing
2818:      * them to be refetched by subsequent calls to accessor method.
2819:      *
2820:      * @return Pub The current object (for fluent API support)
2821:      * @see        addFeatureSynonyms()
2822:      */
2823:     public function clearFeatureSynonyms()
2824:     {
2825:         $this->collFeatureSynonyms = null; // important to set this to null since that means it is uninitialized
2826:         $this->collFeatureSynonymsPartial = null;
2827: 
2828:         return $this;
2829:     }
2830: 
2831:     /**
2832:      * reset is the collFeatureSynonyms collection loaded partially
2833:      *
2834:      * @return void
2835:      */
2836:     public function resetPartialFeatureSynonyms($v = true)
2837:     {
2838:         $this->collFeatureSynonymsPartial = $v;
2839:     }
2840: 
2841:     /**
2842:      * Initializes the collFeatureSynonyms collection.
2843:      *
2844:      * By default this just sets the collFeatureSynonyms collection to an empty array (like clearcollFeatureSynonyms());
2845:      * however, you may wish to override this method in your stub class to provide setting appropriate
2846:      * to your application -- for example, setting the initial array to the values stored in database.
2847:      *
2848:      * @param boolean $overrideExisting If set to true, the method call initializes
2849:      *                                        the collection even if it is not empty
2850:      *
2851:      * @return void
2852:      */
2853:     public function initFeatureSynonyms($overrideExisting = true)
2854:     {
2855:         if (null !== $this->collFeatureSynonyms && !$overrideExisting) {
2856:             return;
2857:         }
2858:         $this->collFeatureSynonyms = new PropelObjectCollection();
2859:         $this->collFeatureSynonyms->setModel('FeatureSynonym');
2860:     }
2861: 
2862:     /**
2863:      * Gets an array of FeatureSynonym objects which contain a foreign key that references this object.
2864:      *
2865:      * If the $criteria is not null, it is used to always fetch the results from the database.
2866:      * Otherwise the results are fetched from the database the first time, then cached.
2867:      * Next time the same method is called without $criteria, the cached collection is returned.
2868:      * If this Pub is new, it will return
2869:      * an empty collection or the current collection; the criteria is ignored on a new object.
2870:      *
2871:      * @param Criteria $criteria optional Criteria object to narrow the query
2872:      * @param PropelPDO $con optional connection object
2873:      * @return PropelObjectCollection|FeatureSynonym[] List of FeatureSynonym objects
2874:      * @throws PropelException
2875:      */
2876:     public function getFeatureSynonyms($criteria = null, PropelPDO $con = null)
2877:     {
2878:         $partial = $this->collFeatureSynonymsPartial && !$this->isNew();
2879:         if (null === $this->collFeatureSynonyms || null !== $criteria  || $partial) {
2880:             if ($this->isNew() && null === $this->collFeatureSynonyms) {
2881:                 // return empty collection
2882:                 $this->initFeatureSynonyms();
2883:             } else {
2884:                 $collFeatureSynonyms = FeatureSynonymQuery::create(null, $criteria)
2885:                     ->filterByPub($this)
2886:                     ->find($con);
2887:                 if (null !== $criteria) {
2888:                     if (false !== $this->collFeatureSynonymsPartial && count($collFeatureSynonyms)) {
2889:                       $this->initFeatureSynonyms(false);
2890: 
2891:                       foreach($collFeatureSynonyms as $obj) {
2892:                         if (false == $this->collFeatureSynonyms->contains($obj)) {
2893:                           $this->collFeatureSynonyms->append($obj);
2894:                         }
2895:                       }
2896: 
2897:                       $this->collFeatureSynonymsPartial = true;
2898:                     }
2899: 
2900:                     $collFeatureSynonyms->getInternalIterator()->rewind();
2901:                     return $collFeatureSynonyms;
2902:                 }
2903: 
2904:                 if($partial && $this->collFeatureSynonyms) {
2905:                     foreach($this->collFeatureSynonyms as $obj) {
2906:                         if($obj->isNew()) {
2907:                             $collFeatureSynonyms[] = $obj;
2908:                         }
2909:                     }
2910:                 }
2911: 
2912:                 $this->collFeatureSynonyms = $collFeatureSynonyms;
2913:                 $this->collFeatureSynonymsPartial = false;
2914:             }
2915:         }
2916: 
2917:         return $this->collFeatureSynonyms;
2918:     }
2919: 
2920:     /**
2921:      * Sets a collection of FeatureSynonym objects related by a one-to-many relationship
2922:      * to the current object.
2923:      * It will also schedule objects for deletion based on a diff between old objects (aka persisted)
2924:      * and new objects from the given Propel collection.
2925:      *
2926:      * @param PropelCollection $featureSynonyms A Propel collection.
2927:      * @param PropelPDO $con Optional connection object
2928:      * @return Pub The current object (for fluent API support)
2929:      */
2930:     public function setFeatureSynonyms(PropelCollection $featureSynonyms, PropelPDO $con = null)
2931:     {
2932:         $featureSynonymsToDelete = $this->getFeatureSynonyms(new Criteria(), $con)->diff($featureSynonyms);
2933: 
2934:         $this->featureSynonymsScheduledForDeletion = unserialize(serialize($featureSynonymsToDelete));
2935: 
2936:         foreach ($featureSynonymsToDelete as $featureSynonymRemoved) {
2937:             $featureSynonymRemoved->setPub(null);
2938:         }
2939: 
2940:         $this->collFeatureSynonyms = null;
2941:         foreach ($featureSynonyms as $featureSynonym) {
2942:             $this->addFeatureSynonym($featureSynonym);
2943:         }
2944: 
2945:         $this->collFeatureSynonyms = $featureSynonyms;
2946:         $this->collFeatureSynonymsPartial = false;
2947: 
2948:         return $this;
2949:     }
2950: 
2951:     /**
2952:      * Returns the number of related FeatureSynonym objects.
2953:      *
2954:      * @param Criteria $criteria
2955:      * @param boolean $distinct
2956:      * @param PropelPDO $con
2957:      * @return int             Count of related FeatureSynonym objects.
2958:      * @throws PropelException
2959:      */
2960:     public function countFeatureSynonyms(Criteria $criteria = null, $distinct = false, PropelPDO $con = null)
2961:     {
2962:         $partial = $this->collFeatureSynonymsPartial && !$this->isNew();
2963:         if (null === $this->collFeatureSynonyms || null !== $criteria || $partial) {
2964:             if ($this->isNew() && null === $this->collFeatureSynonyms) {
2965:                 return 0;
2966:             }
2967: 
2968:             if($partial && !$criteria) {
2969:                 return count($this->getFeatureSynonyms());
2970:             }
2971:             $query = FeatureSynonymQuery::create(null, $criteria);
2972:             if ($distinct) {
2973:                 $query->distinct();
2974:             }
2975: 
2976:             return $query
2977:                 ->filterByPub($this)
2978:                 ->count($con);
2979:         }
2980: 
2981:         return count($this->collFeatureSynonyms);
2982:     }
2983: 
2984:     /**
2985:      * Method called to associate a FeatureSynonym object to this object
2986:      * through the FeatureSynonym foreign key attribute.
2987:      *
2988:      * @param    FeatureSynonym $l FeatureSynonym
2989:      * @return Pub The current object (for fluent API support)
2990:      */
2991:     public function addFeatureSynonym(FeatureSynonym $l)
2992:     {
2993:         if ($this->collFeatureSynonyms === null) {
2994:             $this->initFeatureSynonyms();
2995:             $this->collFeatureSynonymsPartial = true;
2996:         }
2997:         if (!in_array($l, $this->collFeatureSynonyms->getArrayCopy(), true)) { // only add it if the **same** object is not already associated
2998:             $this->doAddFeatureSynonym($l);
2999:         }
3000: 
3001:         return $this;
3002:     }
3003: 
3004:     /**
3005:      * @param   FeatureSynonym $featureSynonym The featureSynonym object to add.
3006:      */
3007:     protected function doAddFeatureSynonym($featureSynonym)
3008:     {
3009:         $this->collFeatureSynonyms[]= $featureSynonym;
3010:         $featureSynonym->setPub($this);
3011:     }
3012: 
3013:     /**
3014:      * @param   FeatureSynonym $featureSynonym The featureSynonym object to remove.
3015:      * @return Pub The current object (for fluent API support)
3016:      */
3017:     public function removeFeatureSynonym($featureSynonym)
3018:     {
3019:         if ($this->getFeatureSynonyms()->contains($featureSynonym)) {
3020:             $this->collFeatureSynonyms->remove($this->collFeatureSynonyms->search($featureSynonym));
3021:             if (null === $this->featureSynonymsScheduledForDeletion) {
3022:                 $this->featureSynonymsScheduledForDeletion = clone $this->collFeatureSynonyms;
3023:                 $this->featureSynonymsScheduledForDeletion->clear();
3024:             }
3025:             $this->featureSynonymsScheduledForDeletion[]= clone $featureSynonym;
3026:             $featureSynonym->setPub(null);
3027:         }
3028: 
3029:         return $this;
3030:     }
3031: 
3032: 
3033:     /**
3034:      * If this collection has already been initialized with
3035:      * an identical criteria, it returns the collection.
3036:      * Otherwise if this Pub is new, it will return
3037:      * an empty collection; or if this Pub has previously
3038:      * been saved, it will retrieve related FeatureSynonyms from storage.
3039:      *
3040:      * This method is protected by default in order to keep the public
3041:      * api reasonable.  You can provide public methods for those you
3042:      * actually need in Pub.
3043:      *
3044:      * @param Criteria $criteria optional Criteria object to narrow the query
3045:      * @param PropelPDO $con optional connection object
3046:      * @param string $join_behavior optional join type to use (defaults to Criteria::LEFT_JOIN)
3047:      * @return PropelObjectCollection|FeatureSynonym[] List of FeatureSynonym objects
3048:      */
3049:     public function getFeatureSynonymsJoinFeature($criteria = null, $con = null, $join_behavior = Criteria::LEFT_JOIN)
3050:     {
3051:         $query = FeatureSynonymQuery::create(null, $criteria);
3052:         $query->joinWith('Feature', $join_behavior);
3053: 
3054:         return $this->getFeatureSynonyms($query, $con);
3055:     }
3056: 
3057: 
3058:     /**
3059:      * If this collection has already been initialized with
3060:      * an identical criteria, it returns the collection.
3061:      * Otherwise if this Pub is new, it will return
3062:      * an empty collection; or if this Pub has previously
3063:      * been saved, it will retrieve related FeatureSynonyms from storage.
3064:      *
3065:      * This method is protected by default in order to keep the public
3066:      * api reasonable.  You can provide public methods for those you
3067:      * actually need in Pub.
3068:      *
3069:      * @param Criteria $criteria optional Criteria object to narrow the query
3070:      * @param PropelPDO $con optional connection object
3071:      * @param string $join_behavior optional join type to use (defaults to Criteria::LEFT_JOIN)
3072:      * @return PropelObjectCollection|FeatureSynonym[] List of FeatureSynonym objects
3073:      */
3074:     public function getFeatureSynonymsJoinSynonym($criteria = null, $con = null, $join_behavior = Criteria::LEFT_JOIN)
3075:     {
3076:         $query = FeatureSynonymQuery::create(null, $criteria);
3077:         $query->joinWith('Synonym', $join_behavior);
3078: 
3079:         return $this->getFeatureSynonyms($query, $con);
3080:     }
3081: 
3082:     /**
3083:      * Clears out the collPubDbxrefs collection
3084:      *
3085:      * This does not modify the database; however, it will remove any associated objects, causing
3086:      * them to be refetched by subsequent calls to accessor method.
3087:      *
3088:      * @return Pub The current object (for fluent API support)
3089:      * @see        addPubDbxrefs()
3090:      */
3091:     public function clearPubDbxrefs()
3092:     {
3093:         $this->collPubDbxrefs = null; // important to set this to null since that means it is uninitialized
3094:         $this->collPubDbxrefsPartial = null;
3095: 
3096:         return $this;
3097:     }
3098: 
3099:     /**
3100:      * reset is the collPubDbxrefs collection loaded partially
3101:      *
3102:      * @return void
3103:      */
3104:     public function resetPartialPubDbxrefs($v = true)
3105:     {
3106:         $this->collPubDbxrefsPartial = $v;
3107:     }
3108: 
3109:     /**
3110:      * Initializes the collPubDbxrefs collection.
3111:      *
3112:      * By default this just sets the collPubDbxrefs collection to an empty array (like clearcollPubDbxrefs());
3113:      * however, you may wish to override this method in your stub class to provide setting appropriate
3114:      * to your application -- for example, setting the initial array to the values stored in database.
3115:      *
3116:      * @param boolean $overrideExisting If set to true, the method call initializes
3117:      *                                        the collection even if it is not empty
3118:      *
3119:      * @return void
3120:      */
3121:     public function initPubDbxrefs($overrideExisting = true)
3122:     {
3123:         if (null !== $this->collPubDbxrefs && !$overrideExisting) {
3124:             return;
3125:         }
3126:         $this->collPubDbxrefs = new PropelObjectCollection();
3127:         $this->collPubDbxrefs->setModel('PubDbxref');
3128:     }
3129: 
3130:     /**
3131:      * Gets an array of PubDbxref objects which contain a foreign key that references this object.
3132:      *
3133:      * If the $criteria is not null, it is used to always fetch the results from the database.
3134:      * Otherwise the results are fetched from the database the first time, then cached.
3135:      * Next time the same method is called without $criteria, the cached collection is returned.
3136:      * If this Pub is new, it will return
3137:      * an empty collection or the current collection; the criteria is ignored on a new object.
3138:      *
3139:      * @param Criteria $criteria optional Criteria object to narrow the query
3140:      * @param PropelPDO $con optional connection object
3141:      * @return PropelObjectCollection|PubDbxref[] List of PubDbxref objects
3142:      * @throws PropelException
3143:      */
3144:     public function getPubDbxrefs($criteria = null, PropelPDO $con = null)
3145:     {
3146:         $partial = $this->collPubDbxrefsPartial && !$this->isNew();
3147:         if (null === $this->collPubDbxrefs || null !== $criteria  || $partial) {
3148:             if ($this->isNew() && null === $this->collPubDbxrefs) {
3149:                 // return empty collection
3150:                 $this->initPubDbxrefs();
3151:             } else {
3152:                 $collPubDbxrefs = PubDbxrefQuery::create(null, $criteria)
3153:                     ->filterByPub($this)
3154:                     ->find($con);
3155:                 if (null !== $criteria) {
3156:                     if (false !== $this->collPubDbxrefsPartial && count($collPubDbxrefs)) {
3157:                       $this->initPubDbxrefs(false);
3158: 
3159:                       foreach($collPubDbxrefs as $obj) {
3160:                         if (false == $this->collPubDbxrefs->contains($obj)) {
3161:                           $this->collPubDbxrefs->append($obj);
3162:                         }
3163:                       }
3164: 
3165:                       $this->collPubDbxrefsPartial = true;
3166:                     }
3167: 
3168:                     $collPubDbxrefs->getInternalIterator()->rewind();
3169:                     return $collPubDbxrefs;
3170:                 }
3171: 
3172:                 if($partial && $this->collPubDbxrefs) {
3173:                     foreach($this->collPubDbxrefs as $obj) {
3174:                         if($obj->isNew()) {
3175:                             $collPubDbxrefs[] = $obj;
3176:                         }
3177:                     }
3178:                 }
3179: 
3180:                 $this->collPubDbxrefs = $collPubDbxrefs;
3181:                 $this->collPubDbxrefsPartial = false;
3182:             }
3183:         }
3184: 
3185:         return $this->collPubDbxrefs;
3186:     }
3187: 
3188:     /**
3189:      * Sets a collection of PubDbxref objects related by a one-to-many relationship
3190:      * to the current object.
3191:      * It will also schedule objects for deletion based on a diff between old objects (aka persisted)
3192:      * and new objects from the given Propel collection.
3193:      *
3194:      * @param PropelCollection $pubDbxrefs A Propel collection.
3195:      * @param PropelPDO $con Optional connection object
3196:      * @return Pub The current object (for fluent API support)
3197:      */
3198:     public function setPubDbxrefs(PropelCollection $pubDbxrefs, PropelPDO $con = null)
3199:     {
3200:         $pubDbxrefsToDelete = $this->getPubDbxrefs(new Criteria(), $con)->diff($pubDbxrefs);
3201: 
3202:         $this->pubDbxrefsScheduledForDeletion = unserialize(serialize($pubDbxrefsToDelete));
3203: 
3204:         foreach ($pubDbxrefsToDelete as $pubDbxrefRemoved) {
3205:             $pubDbxrefRemoved->setPub(null);
3206:         }
3207: 
3208:         $this->collPubDbxrefs = null;
3209:         foreach ($pubDbxrefs as $pubDbxref) {
3210:             $this->addPubDbxref($pubDbxref);
3211:         }
3212: 
3213:         $this->collPubDbxrefs = $pubDbxrefs;
3214:         $this->collPubDbxrefsPartial = false;
3215: 
3216:         return $this;
3217:     }
3218: 
3219:     /**
3220:      * Returns the number of related PubDbxref objects.
3221:      *
3222:      * @param Criteria $criteria
3223:      * @param boolean $distinct
3224:      * @param PropelPDO $con
3225:      * @return int             Count of related PubDbxref objects.
3226:      * @throws PropelException
3227:      */
3228:     public function countPubDbxrefs(Criteria $criteria = null, $distinct = false, PropelPDO $con = null)
3229:     {
3230:         $partial = $this->collPubDbxrefsPartial && !$this->isNew();
3231:         if (null === $this->collPubDbxrefs || null !== $criteria || $partial) {
3232:             if ($this->isNew() && null === $this->collPubDbxrefs) {
3233:                 return 0;
3234:             }
3235: 
3236:             if($partial && !$criteria) {
3237:                 return count($this->getPubDbxrefs());
3238:             }
3239:             $query = PubDbxrefQuery::create(null, $criteria);
3240:             if ($distinct) {
3241:                 $query->distinct();
3242:             }
3243: 
3244:             return $query
3245:                 ->filterByPub($this)
3246:                 ->count($con);
3247:         }
3248: 
3249:         return count($this->collPubDbxrefs);
3250:     }
3251: 
3252:     /**
3253:      * Method called to associate a PubDbxref object to this object
3254:      * through the PubDbxref foreign key attribute.
3255:      *
3256:      * @param    PubDbxref $l PubDbxref
3257:      * @return Pub The current object (for fluent API support)
3258:      */
3259:     public function addPubDbxref(PubDbxref $l)
3260:     {
3261:         if ($this->collPubDbxrefs === null) {
3262:             $this->initPubDbxrefs();
3263:             $this->collPubDbxrefsPartial = true;
3264:         }
3265:         if (!in_array($l, $this->collPubDbxrefs->getArrayCopy(), true)) { // only add it if the **same** object is not already associated
3266:             $this->doAddPubDbxref($l);
3267:         }
3268: 
3269:         return $this;
3270:     }
3271: 
3272:     /**
3273:      * @param   PubDbxref $pubDbxref The pubDbxref object to add.
3274:      */
3275:     protected function doAddPubDbxref($pubDbxref)
3276:     {
3277:         $this->collPubDbxrefs[]= $pubDbxref;
3278:         $pubDbxref->setPub($this);
3279:     }
3280: 
3281:     /**
3282:      * @param   PubDbxref $pubDbxref The pubDbxref object to remove.
3283:      * @return Pub The current object (for fluent API support)
3284:      */
3285:     public function removePubDbxref($pubDbxref)
3286:     {
3287:         if ($this->getPubDbxrefs()->contains($pubDbxref)) {
3288:             $this->collPubDbxrefs->remove($this->collPubDbxrefs->search($pubDbxref));
3289:             if (null === $this->pubDbxrefsScheduledForDeletion) {
3290:                 $this->pubDbxrefsScheduledForDeletion = clone $this->collPubDbxrefs;
3291:                 $this->pubDbxrefsScheduledForDeletion->clear();
3292:             }
3293:             $this->pubDbxrefsScheduledForDeletion[]= clone $pubDbxref;
3294:             $pubDbxref->setPub(null);
3295:         }
3296: 
3297:         return $this;
3298:     }
3299: 
3300: 
3301:     /**
3302:      * If this collection has already been initialized with
3303:      * an identical criteria, it returns the collection.
3304:      * Otherwise if this Pub is new, it will return
3305:      * an empty collection; or if this Pub has previously
3306:      * been saved, it will retrieve related PubDbxrefs from storage.
3307:      *
3308:      * This method is protected by default in order to keep the public
3309:      * api reasonable.  You can provide public methods for those you
3310:      * actually need in Pub.
3311:      *
3312:      * @param Criteria $criteria optional Criteria object to narrow the query
3313:      * @param PropelPDO $con optional connection object
3314:      * @param string $join_behavior optional join type to use (defaults to Criteria::LEFT_JOIN)
3315:      * @return PropelObjectCollection|PubDbxref[] List of PubDbxref objects
3316:      */
3317:     public function getPubDbxrefsJoinDbxref($criteria = null, $con = null, $join_behavior = Criteria::LEFT_JOIN)
3318:     {
3319:         $query = PubDbxrefQuery::create(null, $criteria);
3320:         $query->joinWith('Dbxref', $join_behavior);
3321: 
3322:         return $this->getPubDbxrefs($query, $con);
3323:     }
3324: 
3325:     /**
3326:      * Clears out the collPubRelationshipsRelatedByObjectId collection
3327:      *
3328:      * This does not modify the database; however, it will remove any associated objects, causing
3329:      * them to be refetched by subsequent calls to accessor method.
3330:      *
3331:      * @return Pub The current object (for fluent API support)
3332:      * @see        addPubRelationshipsRelatedByObjectId()
3333:      */
3334:     public function clearPubRelationshipsRelatedByObjectId()
3335:     {
3336:         $this->collPubRelationshipsRelatedByObjectId = null; // important to set this to null since that means it is uninitialized
3337:         $this->collPubRelationshipsRelatedByObjectIdPartial = null;
3338: 
3339:         return $this;
3340:     }
3341: 
3342:     /**
3343:      * reset is the collPubRelationshipsRelatedByObjectId collection loaded partially
3344:      *
3345:      * @return void
3346:      */
3347:     public function resetPartialPubRelationshipsRelatedByObjectId($v = true)
3348:     {
3349:         $this->collPubRelationshipsRelatedByObjectIdPartial = $v;
3350:     }
3351: 
3352:     /**
3353:      * Initializes the collPubRelationshipsRelatedByObjectId collection.
3354:      *
3355:      * By default this just sets the collPubRelationshipsRelatedByObjectId collection to an empty array (like clearcollPubRelationshipsRelatedByObjectId());
3356:      * however, you may wish to override this method in your stub class to provide setting appropriate
3357:      * to your application -- for example, setting the initial array to the values stored in database.
3358:      *
3359:      * @param boolean $overrideExisting If set to true, the method call initializes
3360:      *                                        the collection even if it is not empty
3361:      *
3362:      * @return void
3363:      */
3364:     public function initPubRelationshipsRelatedByObjectId($overrideExisting = true)
3365:     {
3366:         if (null !== $this->collPubRelationshipsRelatedByObjectId && !$overrideExisting) {
3367:             return;
3368:         }
3369:         $this->collPubRelationshipsRelatedByObjectId = new PropelObjectCollection();
3370:         $this->collPubRelationshipsRelatedByObjectId->setModel('PubRelationship');
3371:     }
3372: 
3373:     /**
3374:      * Gets an array of PubRelationship objects which contain a foreign key that references this object.
3375:      *
3376:      * If the $criteria is not null, it is used to always fetch the results from the database.
3377:      * Otherwise the results are fetched from the database the first time, then cached.
3378:      * Next time the same method is called without $criteria, the cached collection is returned.
3379:      * If this Pub is new, it will return
3380:      * an empty collection or the current collection; the criteria is ignored on a new object.
3381:      *
3382:      * @param Criteria $criteria optional Criteria object to narrow the query
3383:      * @param PropelPDO $con optional connection object
3384:      * @return PropelObjectCollection|PubRelationship[] List of PubRelationship objects
3385:      * @throws PropelException
3386:      */
3387:     public function getPubRelationshipsRelatedByObjectId($criteria = null, PropelPDO $con = null)
3388:     {
3389:         $partial = $this->collPubRelationshipsRelatedByObjectIdPartial && !$this->isNew();
3390:         if (null === $this->collPubRelationshipsRelatedByObjectId || null !== $criteria  || $partial) {
3391:             if ($this->isNew() && null === $this->collPubRelationshipsRelatedByObjectId) {
3392:                 // return empty collection
3393:                 $this->initPubRelationshipsRelatedByObjectId();
3394:             } else {
3395:                 $collPubRelationshipsRelatedByObjectId = PubRelationshipQuery::create(null, $criteria)
3396:                     ->filterByPubRelatedByObjectId($this)
3397:                     ->find($con);
3398:                 if (null !== $criteria) {
3399:                     if (false !== $this->collPubRelationshipsRelatedByObjectIdPartial && count($collPubRelationshipsRelatedByObjectId)) {
3400:                       $this->initPubRelationshipsRelatedByObjectId(false);
3401: 
3402:                       foreach($collPubRelationshipsRelatedByObjectId as $obj) {
3403:                         if (false == $this->collPubRelationshipsRelatedByObjectId->contains($obj)) {
3404:                           $this->collPubRelationshipsRelatedByObjectId->append($obj);
3405:                         }
3406:                       }
3407: 
3408:                       $this->collPubRelationshipsRelatedByObjectIdPartial = true;
3409:                     }
3410: 
3411:                     $collPubRelationshipsRelatedByObjectId->getInternalIterator()->rewind();
3412:                     return $collPubRelationshipsRelatedByObjectId;
3413:                 }
3414: 
3415:                 if($partial && $this->collPubRelationshipsRelatedByObjectId) {
3416:                     foreach($this->collPubRelationshipsRelatedByObjectId as $obj) {
3417:                         if($obj->isNew()) {
3418:                             $collPubRelationshipsRelatedByObjectId[] = $obj;
3419:                         }
3420:                     }
3421:                 }
3422: 
3423:                 $this->collPubRelationshipsRelatedByObjectId = $collPubRelationshipsRelatedByObjectId;
3424:                 $this->collPubRelationshipsRelatedByObjectIdPartial = false;
3425:             }
3426:         }
3427: 
3428:         return $this->collPubRelationshipsRelatedByObjectId;
3429:     }
3430: 
3431:     /**
3432:      * Sets a collection of PubRelationshipRelatedByObjectId objects related by a one-to-many relationship
3433:      * to the current object.
3434:      * It will also schedule objects for deletion based on a diff between old objects (aka persisted)
3435:      * and new objects from the given Propel collection.
3436:      *
3437:      * @param PropelCollection $pubRelationshipsRelatedByObjectId A Propel collection.
3438:      * @param PropelPDO $con Optional connection object
3439:      * @return Pub The current object (for fluent API support)
3440:      */
3441:     public function setPubRelationshipsRelatedByObjectId(PropelCollection $pubRelationshipsRelatedByObjectId, PropelPDO $con = null)
3442:     {
3443:         $pubRelationshipsRelatedByObjectIdToDelete = $this->getPubRelationshipsRelatedByObjectId(new Criteria(), $con)->diff($pubRelationshipsRelatedByObjectId);
3444: 
3445:         $this->pubRelationshipsRelatedByObjectIdScheduledForDeletion = unserialize(serialize($pubRelationshipsRelatedByObjectIdToDelete));
3446: 
3447:         foreach ($pubRelationshipsRelatedByObjectIdToDelete as $pubRelationshipRelatedByObjectIdRemoved) {
3448:             $pubRelationshipRelatedByObjectIdRemoved->setPubRelatedByObjectId(null);
3449:         }
3450: 
3451:         $this->collPubRelationshipsRelatedByObjectId = null;
3452:         foreach ($pubRelationshipsRelatedByObjectId as $pubRelationshipRelatedByObjectId) {
3453:             $this->addPubRelationshipRelatedByObjectId($pubRelationshipRelatedByObjectId);
3454:         }
3455: 
3456:         $this->collPubRelationshipsRelatedByObjectId = $pubRelationshipsRelatedByObjectId;
3457:         $this->collPubRelationshipsRelatedByObjectIdPartial = false;
3458: 
3459:         return $this;
3460:     }
3461: 
3462:     /**
3463:      * Returns the number of related PubRelationship objects.
3464:      *
3465:      * @param Criteria $criteria
3466:      * @param boolean $distinct
3467:      * @param PropelPDO $con
3468:      * @return int             Count of related PubRelationship objects.
3469:      * @throws PropelException
3470:      */
3471:     public function countPubRelationshipsRelatedByObjectId(Criteria $criteria = null, $distinct = false, PropelPDO $con = null)
3472:     {
3473:         $partial = $this->collPubRelationshipsRelatedByObjectIdPartial && !$this->isNew();
3474:         if (null === $this->collPubRelationshipsRelatedByObjectId || null !== $criteria || $partial) {
3475:             if ($this->isNew() && null === $this->collPubRelationshipsRelatedByObjectId) {
3476:                 return 0;
3477:             }
3478: 
3479:             if($partial && !$criteria) {
3480:                 return count($this->getPubRelationshipsRelatedByObjectId());
3481:             }
3482:             $query = PubRelationshipQuery::create(null, $criteria);
3483:             if ($distinct) {
3484:                 $query->distinct();
3485:             }
3486: 
3487:             return $query
3488:                 ->filterByPubRelatedByObjectId($this)
3489:                 ->count($con);
3490:         }
3491: 
3492:         return count($this->collPubRelationshipsRelatedByObjectId);
3493:     }
3494: 
3495:     /**
3496:      * Method called to associate a PubRelationship object to this object
3497:      * through the PubRelationship foreign key attribute.
3498:      *
3499:      * @param    PubRelationship $l PubRelationship
3500:      * @return Pub The current object (for fluent API support)
3501:      */
3502:     public function addPubRelationshipRelatedByObjectId(PubRelationship $l)
3503:     {
3504:         if ($this->collPubRelationshipsRelatedByObjectId === null) {
3505:             $this->initPubRelationshipsRelatedByObjectId();
3506:             $this->collPubRelationshipsRelatedByObjectIdPartial = true;
3507:         }
3508:         if (!in_array($l, $this->collPubRelationshipsRelatedByObjectId->getArrayCopy(), true)) { // only add it if the **same** object is not already associated
3509:             $this->doAddPubRelationshipRelatedByObjectId($l);
3510:         }
3511: 
3512:         return $this;
3513:     }
3514: 
3515:     /**
3516:      * @param   PubRelationshipRelatedByObjectId $pubRelationshipRelatedByObjectId The pubRelationshipRelatedByObjectId object to add.
3517:      */
3518:     protected function doAddPubRelationshipRelatedByObjectId($pubRelationshipRelatedByObjectId)
3519:     {
3520:         $this->collPubRelationshipsRelatedByObjectId[]= $pubRelationshipRelatedByObjectId;
3521:         $pubRelationshipRelatedByObjectId->setPubRelatedByObjectId($this);
3522:     }
3523: 
3524:     /**
3525:      * @param   PubRelationshipRelatedByObjectId $pubRelationshipRelatedByObjectId The pubRelationshipRelatedByObjectId object to remove.
3526:      * @return Pub The current object (for fluent API support)
3527:      */
3528:     public function removePubRelationshipRelatedByObjectId($pubRelationshipRelatedByObjectId)
3529:     {
3530:         if ($this->getPubRelationshipsRelatedByObjectId()->contains($pubRelationshipRelatedByObjectId)) {
3531:             $this->collPubRelationshipsRelatedByObjectId->remove($this->collPubRelationshipsRelatedByObjectId->search($pubRelationshipRelatedByObjectId));
3532:             if (null === $this->pubRelationshipsRelatedByObjectIdScheduledForDeletion) {
3533:                 $this->pubRelationshipsRelatedByObjectIdScheduledForDeletion = clone $this->collPubRelationshipsRelatedByObjectId;
3534:                 $this->pubRelationshipsRelatedByObjectIdScheduledForDeletion->clear();
3535:             }
3536:             $this->pubRelationshipsRelatedByObjectIdScheduledForDeletion[]= clone $pubRelationshipRelatedByObjectId;
3537:             $pubRelationshipRelatedByObjectId->setPubRelatedByObjectId(null);
3538:         }
3539: 
3540:         return $this;
3541:     }
3542: 
3543: 
3544:     /**
3545:      * If this collection has already been initialized with
3546:      * an identical criteria, it returns the collection.
3547:      * Otherwise if this Pub is new, it will return
3548:      * an empty collection; or if this Pub has previously
3549:      * been saved, it will retrieve related PubRelationshipsRelatedByObjectId from storage.
3550:      *
3551:      * This method is protected by default in order to keep the public
3552:      * api reasonable.  You can provide public methods for those you
3553:      * actually need in Pub.
3554:      *
3555:      * @param Criteria $criteria optional Criteria object to narrow the query
3556:      * @param PropelPDO $con optional connection object
3557:      * @param string $join_behavior optional join type to use (defaults to Criteria::LEFT_JOIN)
3558:      * @return PropelObjectCollection|PubRelationship[] List of PubRelationship objects
3559:      */
3560:     public function getPubRelationshipsRelatedByObjectIdJoinCvterm($criteria = null, $con = null, $join_behavior = Criteria::LEFT_JOIN)
3561:     {
3562:         $query = PubRelationshipQuery::create(null, $criteria);
3563:         $query->joinWith('Cvterm', $join_behavior);
3564: 
3565:         return $this->getPubRelationshipsRelatedByObjectId($query, $con);
3566:     }
3567: 
3568:     /**
3569:      * Clears out the collPubRelationshipsRelatedBySubjectId collection
3570:      *
3571:      * This does not modify the database; however, it will remove any associated objects, causing
3572:      * them to be refetched by subsequent calls to accessor method.
3573:      *
3574:      * @return Pub The current object (for fluent API support)
3575:      * @see        addPubRelationshipsRelatedBySubjectId()
3576:      */
3577:     public function clearPubRelationshipsRelatedBySubjectId()
3578:     {
3579:         $this->collPubRelationshipsRelatedBySubjectId = null; // important to set this to null since that means it is uninitialized
3580:         $this->collPubRelationshipsRelatedBySubjectIdPartial = null;
3581: 
3582:         return $this;
3583:     }
3584: 
3585:     /**
3586:      * reset is the collPubRelationshipsRelatedBySubjectId collection loaded partially
3587:      *
3588:      * @return void
3589:      */
3590:     public function resetPartialPubRelationshipsRelatedBySubjectId($v = true)
3591:     {
3592:         $this->collPubRelationshipsRelatedBySubjectIdPartial = $v;
3593:     }
3594: 
3595:     /**
3596:      * Initializes the collPubRelationshipsRelatedBySubjectId collection.
3597:      *
3598:      * By default this just sets the collPubRelationshipsRelatedBySubjectId collection to an empty array (like clearcollPubRelationshipsRelatedBySubjectId());
3599:      * however, you may wish to override this method in your stub class to provide setting appropriate
3600:      * to your application -- for example, setting the initial array to the values stored in database.
3601:      *
3602:      * @param boolean $overrideExisting If set to true, the method call initializes
3603:      *                                        the collection even if it is not empty
3604:      *
3605:      * @return void
3606:      */
3607:     public function initPubRelationshipsRelatedBySubjectId($overrideExisting = true)
3608:     {
3609:         if (null !== $this->collPubRelationshipsRelatedBySubjectId && !$overrideExisting) {
3610:             return;
3611:         }
3612:         $this->collPubRelationshipsRelatedBySubjectId = new PropelObjectCollection();
3613:         $this->collPubRelationshipsRelatedBySubjectId->setModel('PubRelationship');
3614:     }
3615: 
3616:     /**
3617:      * Gets an array of PubRelationship objects which contain a foreign key that references this object.
3618:      *
3619:      * If the $criteria is not null, it is used to always fetch the results from the database.
3620:      * Otherwise the results are fetched from the database the first time, then cached.
3621:      * Next time the same method is called without $criteria, the cached collection is returned.
3622:      * If this Pub is new, it will return
3623:      * an empty collection or the current collection; the criteria is ignored on a new object.
3624:      *
3625:      * @param Criteria $criteria optional Criteria object to narrow the query
3626:      * @param PropelPDO $con optional connection object
3627:      * @return PropelObjectCollection|PubRelationship[] List of PubRelationship objects
3628:      * @throws PropelException
3629:      */
3630:     public function getPubRelationshipsRelatedBySubjectId($criteria = null, PropelPDO $con = null)
3631:     {
3632:         $partial = $this->collPubRelationshipsRelatedBySubjectIdPartial && !$this->isNew();
3633:         if (null === $this->collPubRelationshipsRelatedBySubjectId || null !== $criteria  || $partial) {
3634:             if ($this->isNew() && null === $this->collPubRelationshipsRelatedBySubjectId) {
3635:                 // return empty collection
3636:                 $this->initPubRelationshipsRelatedBySubjectId();
3637:             } else {
3638:                 $collPubRelationshipsRelatedBySubjectId = PubRelationshipQuery::create(null, $criteria)
3639:                     ->filterByPubRelatedBySubjectId($this)
3640:                     ->find($con);
3641:                 if (null !== $criteria) {
3642:                     if (false !== $this->collPubRelationshipsRelatedBySubjectIdPartial && count($collPubRelationshipsRelatedBySubjectId)) {
3643:                       $this->initPubRelationshipsRelatedBySubjectId(false);
3644: 
3645:                       foreach($collPubRelationshipsRelatedBySubjectId as $obj) {
3646:                         if (false == $this->collPubRelationshipsRelatedBySubjectId->contains($obj)) {
3647:                           $this->collPubRelationshipsRelatedBySubjectId->append($obj);
3648:                         }
3649:                       }
3650: 
3651:                       $this->collPubRelationshipsRelatedBySubjectIdPartial = true;
3652:                     }
3653: 
3654:                     $collPubRelationshipsRelatedBySubjectId->getInternalIterator()->rewind();
3655:                     return $collPubRelationshipsRelatedBySubjectId;
3656:                 }
3657: 
3658:                 if($partial && $this->collPubRelationshipsRelatedBySubjectId) {
3659:                     foreach($this->collPubRelationshipsRelatedBySubjectId as $obj) {
3660:                         if($obj->isNew()) {
3661:                             $collPubRelationshipsRelatedBySubjectId[] = $obj;
3662:                         }
3663:                     }
3664:                 }
3665: 
3666:                 $this->collPubRelationshipsRelatedBySubjectId = $collPubRelationshipsRelatedBySubjectId;
3667:                 $this->collPubRelationshipsRelatedBySubjectIdPartial = false;
3668:             }
3669:         }
3670: 
3671:         return $this->collPubRelationshipsRelatedBySubjectId;
3672:     }
3673: 
3674:     /**
3675:      * Sets a collection of PubRelationshipRelatedBySubjectId objects related by a one-to-many relationship
3676:      * to the current object.
3677:      * It will also schedule objects for deletion based on a diff between old objects (aka persisted)
3678:      * and new objects from the given Propel collection.
3679:      *
3680:      * @param PropelCollection $pubRelationshipsRelatedBySubjectId A Propel collection.
3681:      * @param PropelPDO $con Optional connection object
3682:      * @return Pub The current object (for fluent API support)
3683:      */
3684:     public function setPubRelationshipsRelatedBySubjectId(PropelCollection $pubRelationshipsRelatedBySubjectId, PropelPDO $con = null)
3685:     {
3686:         $pubRelationshipsRelatedBySubjectIdToDelete = $this->getPubRelationshipsRelatedBySubjectId(new Criteria(), $con)->diff($pubRelationshipsRelatedBySubjectId);
3687: 
3688:         $this->pubRelationshipsRelatedBySubjectIdScheduledForDeletion = unserialize(serialize($pubRelationshipsRelatedBySubjectIdToDelete));
3689: 
3690:         foreach ($pubRelationshipsRelatedBySubjectIdToDelete as $pubRelationshipRelatedBySubjectIdRemoved) {
3691:             $pubRelationshipRelatedBySubjectIdRemoved->setPubRelatedBySubjectId(null);
3692:         }
3693: 
3694:         $this->collPubRelationshipsRelatedBySubjectId = null;
3695:         foreach ($pubRelationshipsRelatedBySubjectId as $pubRelationshipRelatedBySubjectId) {
3696:             $this->addPubRelationshipRelatedBySubjectId($pubRelationshipRelatedBySubjectId);
3697:         }
3698: 
3699:         $this->collPubRelationshipsRelatedBySubjectId = $pubRelationshipsRelatedBySubjectId;
3700:         $this->collPubRelationshipsRelatedBySubjectIdPartial = false;
3701: 
3702:         return $this;
3703:     }
3704: 
3705:     /**
3706:      * Returns the number of related PubRelationship objects.
3707:      *
3708:      * @param Criteria $criteria
3709:      * @param boolean $distinct
3710:      * @param PropelPDO $con
3711:      * @return int             Count of related PubRelationship objects.
3712:      * @throws PropelException
3713:      */
3714:     public function countPubRelationshipsRelatedBySubjectId(Criteria $criteria = null, $distinct = false, PropelPDO $con = null)
3715:     {
3716:         $partial = $this->collPubRelationshipsRelatedBySubjectIdPartial && !$this->isNew();
3717:         if (null === $this->collPubRelationshipsRelatedBySubjectId || null !== $criteria || $partial) {
3718:             if ($this->isNew() && null === $this->collPubRelationshipsRelatedBySubjectId) {
3719:                 return 0;
3720:             }
3721: 
3722:             if($partial && !$criteria) {
3723:                 return count($this->getPubRelationshipsRelatedBySubjectId());
3724:             }
3725:             $query = PubRelationshipQuery::create(null, $criteria);
3726:             if ($distinct) {
3727:                 $query->distinct();
3728:             }
3729: 
3730:             return $query
3731:                 ->filterByPubRelatedBySubjectId($this)
3732:                 ->count($con);
3733:         }
3734: 
3735:         return count($this->collPubRelationshipsRelatedBySubjectId);
3736:     }
3737: 
3738:     /**
3739:      * Method called to associate a PubRelationship object to this object
3740:      * through the PubRelationship foreign key attribute.
3741:      *
3742:      * @param    PubRelationship $l PubRelationship
3743:      * @return Pub The current object (for fluent API support)
3744:      */
3745:     public function addPubRelationshipRelatedBySubjectId(PubRelationship $l)
3746:     {
3747:         if ($this->collPubRelationshipsRelatedBySubjectId === null) {
3748:             $this->initPubRelationshipsRelatedBySubjectId();
3749:             $this->collPubRelationshipsRelatedBySubjectIdPartial = true;
3750:         }
3751:         if (!in_array($l, $this->collPubRelationshipsRelatedBySubjectId->getArrayCopy(), true)) { // only add it if the **same** object is not already associated
3752:             $this->doAddPubRelationshipRelatedBySubjectId($l);
3753:         }
3754: 
3755:         return $this;
3756:     }
3757: 
3758:     /**
3759:      * @param   PubRelationshipRelatedBySubjectId $pubRelationshipRelatedBySubjectId The pubRelationshipRelatedBySubjectId object to add.
3760:      */
3761:     protected function doAddPubRelationshipRelatedBySubjectId($pubRelationshipRelatedBySubjectId)
3762:     {
3763:         $this->collPubRelationshipsRelatedBySubjectId[]= $pubRelationshipRelatedBySubjectId;
3764:         $pubRelationshipRelatedBySubjectId->setPubRelatedBySubjectId($this);
3765:     }
3766: 
3767:     /**
3768:      * @param   PubRelationshipRelatedBySubjectId $pubRelationshipRelatedBySubjectId The pubRelationshipRelatedBySubjectId object to remove.
3769:      * @return Pub The current object (for fluent API support)
3770:      */
3771:     public function removePubRelationshipRelatedBySubjectId($pubRelationshipRelatedBySubjectId)
3772:     {
3773:         if ($this->getPubRelationshipsRelatedBySubjectId()->contains($pubRelationshipRelatedBySubjectId)) {
3774:             $this->collPubRelationshipsRelatedBySubjectId->remove($this->collPubRelationshipsRelatedBySubjectId->search($pubRelationshipRelatedBySubjectId));
3775:             if (null === $this->pubRelationshipsRelatedBySubjectIdScheduledForDeletion) {
3776:                 $this->pubRelationshipsRelatedBySubjectIdScheduledForDeletion = clone $this->collPubRelationshipsRelatedBySubjectId;
3777:                 $this->pubRelationshipsRelatedBySubjectIdScheduledForDeletion->clear();
3778:             }
3779:             $this->pubRelationshipsRelatedBySubjectIdScheduledForDeletion[]= clone $pubRelationshipRelatedBySubjectId;
3780:             $pubRelationshipRelatedBySubjectId->setPubRelatedBySubjectId(null);
3781:         }
3782: 
3783:         return $this;
3784:     }
3785: 
3786: 
3787:     /**
3788:      * If this collection has already been initialized with
3789:      * an identical criteria, it returns the collection.
3790:      * Otherwise if this Pub is new, it will return
3791:      * an empty collection; or if this Pub has previously
3792:      * been saved, it will retrieve related PubRelationshipsRelatedBySubjectId from storage.
3793:      *
3794:      * This method is protected by default in order to keep the public
3795:      * api reasonable.  You can provide public methods for those you
3796:      * actually need in Pub.
3797:      *
3798:      * @param Criteria $criteria optional Criteria object to narrow the query
3799:      * @param PropelPDO $con optional connection object
3800:      * @param string $join_behavior optional join type to use (defaults to Criteria::LEFT_JOIN)
3801:      * @return PropelObjectCollection|PubRelationship[] List of PubRelationship objects
3802:      */
3803:     public function getPubRelationshipsRelatedBySubjectIdJoinCvterm($criteria = null, $con = null, $join_behavior = Criteria::LEFT_JOIN)
3804:     {
3805:         $query = PubRelationshipQuery::create(null, $criteria);
3806:         $query->joinWith('Cvterm', $join_behavior);
3807: 
3808:         return $this->getPubRelationshipsRelatedBySubjectId($query, $con);
3809:     }
3810: 
3811:     /**
3812:      * Clears out the collPubauthors collection
3813:      *
3814:      * This does not modify the database; however, it will remove any associated objects, causing
3815:      * them to be refetched by subsequent calls to accessor method.
3816:      *
3817:      * @return Pub The current object (for fluent API support)
3818:      * @see        addPubauthors()
3819:      */
3820:     public function clearPubauthors()
3821:     {
3822:         $this->collPubauthors = null; // important to set this to null since that means it is uninitialized
3823:         $this->collPubauthorsPartial = null;
3824: 
3825:         return $this;
3826:     }
3827: 
3828:     /**
3829:      * reset is the collPubauthors collection loaded partially
3830:      *
3831:      * @return void
3832:      */
3833:     public function resetPartialPubauthors($v = true)
3834:     {
3835:         $this->collPubauthorsPartial = $v;
3836:     }
3837: 
3838:     /**
3839:      * Initializes the collPubauthors collection.
3840:      *
3841:      * By default this just sets the collPubauthors collection to an empty array (like clearcollPubauthors());
3842:      * however, you may wish to override this method in your stub class to provide setting appropriate
3843:      * to your application -- for example, setting the initial array to the values stored in database.
3844:      *
3845:      * @param boolean $overrideExisting If set to true, the method call initializes
3846:      *                                        the collection even if it is not empty
3847:      *
3848:      * @return void
3849:      */
3850:     public function initPubauthors($overrideExisting = true)
3851:     {
3852:         if (null !== $this->collPubauthors && !$overrideExisting) {
3853:             return;
3854:         }
3855:         $this->collPubauthors = new PropelObjectCollection();
3856:         $this->collPubauthors->setModel('Pubauthor');
3857:     }
3858: 
3859:     /**
3860:      * Gets an array of Pubauthor objects which contain a foreign key that references this object.
3861:      *
3862:      * If the $criteria is not null, it is used to always fetch the results from the database.
3863:      * Otherwise the results are fetched from the database the first time, then cached.
3864:      * Next time the same method is called without $criteria, the cached collection is returned.
3865:      * If this Pub is new, it will return
3866:      * an empty collection or the current collection; the criteria is ignored on a new object.
3867:      *
3868:      * @param Criteria $criteria optional Criteria object to narrow the query
3869:      * @param PropelPDO $con optional connection object
3870:      * @return PropelObjectCollection|Pubauthor[] List of Pubauthor objects
3871:      * @throws PropelException
3872:      */
3873:     public function getPubauthors($criteria = null, PropelPDO $con = null)
3874:     {
3875:         $partial = $this->collPubauthorsPartial && !$this->isNew();
3876:         if (null === $this->collPubauthors || null !== $criteria  || $partial) {
3877:             if ($this->isNew() && null === $this->collPubauthors) {
3878:                 // return empty collection
3879:                 $this->initPubauthors();
3880:             } else {
3881:                 $collPubauthors = PubauthorQuery::create(null, $criteria)
3882:                     ->filterByPub($this)
3883:                     ->find($con);
3884:                 if (null !== $criteria) {
3885:                     if (false !== $this->collPubauthorsPartial && count($collPubauthors)) {
3886:                       $this->initPubauthors(false);
3887: 
3888:                       foreach($collPubauthors as $obj) {
3889:                         if (false == $this->collPubauthors->contains($obj)) {
3890:                           $this->collPubauthors->append($obj);
3891:                         }
3892:                       }
3893: 
3894:                       $this->collPubauthorsPartial = true;
3895:                     }
3896: 
3897:                     $collPubauthors->getInternalIterator()->rewind();
3898:                     return $collPubauthors;
3899:                 }
3900: 
3901:                 if($partial && $this->collPubauthors) {
3902:                     foreach($this->collPubauthors as $obj) {
3903:                         if($obj->isNew()) {
3904:                             $collPubauthors[] = $obj;
3905:                         }
3906:                     }
3907:                 }
3908: 
3909:                 $this->collPubauthors = $collPubauthors;
3910:                 $this->collPubauthorsPartial = false;
3911:             }
3912:         }
3913: 
3914:         return $this->collPubauthors;
3915:     }
3916: 
3917:     /**
3918:      * Sets a collection of Pubauthor objects related by a one-to-many relationship
3919:      * to the current object.
3920:      * It will also schedule objects for deletion based on a diff between old objects (aka persisted)
3921:      * and new objects from the given Propel collection.
3922:      *
3923:      * @param PropelCollection $pubauthors A Propel collection.
3924:      * @param PropelPDO $con Optional connection object
3925:      * @return Pub The current object (for fluent API support)
3926:      */
3927:     public function setPubauthors(PropelCollection $pubauthors, PropelPDO $con = null)
3928:     {
3929:         $pubauthorsToDelete = $this->getPubauthors(new Criteria(), $con)->diff($pubauthors);
3930: 
3931:         $this->pubauthorsScheduledForDeletion = unserialize(serialize($pubauthorsToDelete));
3932: 
3933:         foreach ($pubauthorsToDelete as $pubauthorRemoved) {
3934:             $pubauthorRemoved->setPub(null);
3935:         }
3936: 
3937:         $this->collPubauthors = null;
3938:         foreach ($pubauthors as $pubauthor) {
3939:             $this->addPubauthor($pubauthor);
3940:         }
3941: 
3942:         $this->collPubauthors = $pubauthors;
3943:         $this->collPubauthorsPartial = false;
3944: 
3945:         return $this;
3946:     }
3947: 
3948:     /**
3949:      * Returns the number of related Pubauthor objects.
3950:      *
3951:      * @param Criteria $criteria
3952:      * @param boolean $distinct
3953:      * @param PropelPDO $con
3954:      * @return int             Count of related Pubauthor objects.
3955:      * @throws PropelException
3956:      */
3957:     public function countPubauthors(Criteria $criteria = null, $distinct = false, PropelPDO $con = null)
3958:     {
3959:         $partial = $this->collPubauthorsPartial && !$this->isNew();
3960:         if (null === $this->collPubauthors || null !== $criteria || $partial) {
3961:             if ($this->isNew() && null === $this->collPubauthors) {
3962:                 return 0;
3963:             }
3964: 
3965:             if($partial && !$criteria) {
3966:                 return count($this->getPubauthors());
3967:             }
3968:             $query = PubauthorQuery::create(null, $criteria);
3969:             if ($distinct) {
3970:                 $query->distinct();
3971:             }
3972: 
3973:             return $query
3974:                 ->filterByPub($this)
3975:                 ->count($con);
3976:         }
3977: 
3978:         return count($this->collPubauthors);
3979:     }
3980: 
3981:     /**
3982:      * Method called to associate a Pubauthor object to this object
3983:      * through the Pubauthor foreign key attribute.
3984:      *
3985:      * @param    Pubauthor $l Pubauthor
3986:      * @return Pub The current object (for fluent API support)
3987:      */
3988:     public function addPubauthor(Pubauthor $l)
3989:     {
3990:         if ($this->collPubauthors === null) {
3991:             $this->initPubauthors();
3992:             $this->collPubauthorsPartial = true;
3993:         }
3994:         if (!in_array($l, $this->collPubauthors->getArrayCopy(), true)) { // only add it if the **same** object is not already associated
3995:             $this->doAddPubauthor($l);
3996:         }
3997: 
3998:         return $this;
3999:     }
4000: 
4001:     /**
4002:      * @param   Pubauthor $pubauthor The pubauthor object to add.
4003:      */
4004:     protected function doAddPubauthor($pubauthor)
4005:     {
4006:         $this->collPubauthors[]= $pubauthor;
4007:         $pubauthor->setPub($this);
4008:     }
4009: 
4010:     /**
4011:      * @param   Pubauthor $pubauthor The pubauthor object to remove.
4012:      * @return Pub The current object (for fluent API support)
4013:      */
4014:     public function removePubauthor($pubauthor)
4015:     {
4016:         if ($this->getPubauthors()->contains($pubauthor)) {
4017:             $this->collPubauthors->remove($this->collPubauthors->search($pubauthor));
4018:             if (null === $this->pubauthorsScheduledForDeletion) {
4019:                 $this->pubauthorsScheduledForDeletion = clone $this->collPubauthors;
4020:                 $this->pubauthorsScheduledForDeletion->clear();
4021:             }
4022:             $this->pubauthorsScheduledForDeletion[]= clone $pubauthor;
4023:             $pubauthor->setPub(null);
4024:         }
4025: 
4026:         return $this;
4027:     }
4028: 
4029:     /**
4030:      * Clears out the collPubprops collection
4031:      *
4032:      * This does not modify the database; however, it will remove any associated objects, causing
4033:      * them to be refetched by subsequent calls to accessor method.
4034:      *
4035:      * @return Pub The current object (for fluent API support)
4036:      * @see        addPubprops()
4037:      */
4038:     public function clearPubprops()
4039:     {
4040:         $this->collPubprops = null; // important to set this to null since that means it is uninitialized
4041:         $this->collPubpropsPartial = null;
4042: 
4043:         return $this;
4044:     }
4045: 
4046:     /**
4047:      * reset is the collPubprops collection loaded partially
4048:      *
4049:      * @return void
4050:      */
4051:     public function resetPartialPubprops($v = true)
4052:     {
4053:         $this->collPubpropsPartial = $v;
4054:     }
4055: 
4056:     /**
4057:      * Initializes the collPubprops collection.
4058:      *
4059:      * By default this just sets the collPubprops collection to an empty array (like clearcollPubprops());
4060:      * however, you may wish to override this method in your stub class to provide setting appropriate
4061:      * to your application -- for example, setting the initial array to the values stored in database.
4062:      *
4063:      * @param boolean $overrideExisting If set to true, the method call initializes
4064:      *                                        the collection even if it is not empty
4065:      *
4066:      * @return void
4067:      */
4068:     public function initPubprops($overrideExisting = true)
4069:     {
4070:         if (null !== $this->collPubprops && !$overrideExisting) {
4071:             return;
4072:         }
4073:         $this->collPubprops = new PropelObjectCollection();
4074:         $this->collPubprops->setModel('Pubprop');
4075:     }
4076: 
4077:     /**
4078:      * Gets an array of Pubprop objects which contain a foreign key that references this object.
4079:      *
4080:      * If the $criteria is not null, it is used to always fetch the results from the database.
4081:      * Otherwise the results are fetched from the database the first time, then cached.
4082:      * Next time the same method is called without $criteria, the cached collection is returned.
4083:      * If this Pub is new, it will return
4084:      * an empty collection or the current collection; the criteria is ignored on a new object.
4085:      *
4086:      * @param Criteria $criteria optional Criteria object to narrow the query
4087:      * @param PropelPDO $con optional connection object
4088:      * @return PropelObjectCollection|Pubprop[] List of Pubprop objects
4089:      * @throws PropelException
4090:      */
4091:     public function getPubprops($criteria = null, PropelPDO $con = null)
4092:     {
4093:         $partial = $this->collPubpropsPartial && !$this->isNew();
4094:         if (null === $this->collPubprops || null !== $criteria  || $partial) {
4095:             if ($this->isNew() && null === $this->collPubprops) {
4096:                 // return empty collection
4097:                 $this->initPubprops();
4098:             } else {
4099:                 $collPubprops = PubpropQuery::create(null, $criteria)
4100:                     ->filterByPub($this)
4101:                     ->find($con);
4102:                 if (null !== $criteria) {
4103:                     if (false !== $this->collPubpropsPartial && count($collPubprops)) {
4104:                       $this->initPubprops(false);
4105: 
4106:                       foreach($collPubprops as $obj) {
4107:                         if (false == $this->collPubprops->contains($obj)) {
4108:                           $this->collPubprops->append($obj);
4109:                         }
4110:                       }
4111: 
4112:                       $this->collPubpropsPartial = true;
4113:                     }
4114: 
4115:                     $collPubprops->getInternalIterator()->rewind();
4116:                     return $collPubprops;
4117:                 }
4118: 
4119:                 if($partial && $this->collPubprops) {
4120:                     foreach($this->collPubprops as $obj) {
4121:                         if($obj->isNew()) {
4122:                             $collPubprops[] = $obj;
4123:                         }
4124:                     }
4125:                 }
4126: 
4127:                 $this->collPubprops = $collPubprops;
4128:                 $this->collPubpropsPartial = false;
4129:             }
4130:         }
4131: 
4132:         return $this->collPubprops;
4133:     }
4134: 
4135:     /**
4136:      * Sets a collection of Pubprop objects related by a one-to-many relationship
4137:      * to the current object.
4138:      * It will also schedule objects for deletion based on a diff between old objects (aka persisted)
4139:      * and new objects from the given Propel collection.
4140:      *
4141:      * @param PropelCollection $pubprops A Propel collection.
4142:      * @param PropelPDO $con Optional connection object
4143:      * @return Pub The current object (for fluent API support)
4144:      */
4145:     public function setPubprops(PropelCollection $pubprops, PropelPDO $con = null)
4146:     {
4147:         $pubpropsToDelete = $this->getPubprops(new Criteria(), $con)->diff($pubprops);
4148: 
4149:         $this->pubpropsScheduledForDeletion = unserialize(serialize($pubpropsToDelete));
4150: 
4151:         foreach ($pubpropsToDelete as $pubpropRemoved) {
4152:             $pubpropRemoved->setPub(null);
4153:         }
4154: 
4155:         $this->collPubprops = null;
4156:         foreach ($pubprops as $pubprop) {
4157:             $this->addPubprop($pubprop);
4158:         }
4159: 
4160:         $this->collPubprops = $pubprops;
4161:         $this->collPubpropsPartial = false;
4162: 
4163:         return $this;
4164:     }
4165: 
4166:     /**
4167:      * Returns the number of related Pubprop objects.
4168:      *
4169:      * @param Criteria $criteria
4170:      * @param boolean $distinct
4171:      * @param PropelPDO $con
4172:      * @return int             Count of related Pubprop objects.
4173:      * @throws PropelException
4174:      */
4175:     public function countPubprops(Criteria $criteria = null, $distinct = false, PropelPDO $con = null)
4176:     {
4177:         $partial = $this->collPubpropsPartial && !$this->isNew();
4178:         if (null === $this->collPubprops || null !== $criteria || $partial) {
4179:             if ($this->isNew() && null === $this->collPubprops) {
4180:                 return 0;
4181:             }
4182: 
4183:             if($partial && !$criteria) {
4184:                 return count($this->getPubprops());
4185:             }
4186:             $query = PubpropQuery::create(null, $criteria);
4187:             if ($distinct) {
4188:                 $query->distinct();
4189:             }
4190: 
4191:             return $query
4192:                 ->filterByPub($this)
4193:                 ->count($con);
4194:         }
4195: 
4196:         return count($this->collPubprops);
4197:     }
4198: 
4199:     /**
4200:      * Method called to associate a Pubprop object to this object
4201:      * through the Pubprop foreign key attribute.
4202:      *
4203:      * @param    Pubprop $l Pubprop
4204:      * @return Pub The current object (for fluent API support)
4205:      */
4206:     public function addPubprop(Pubprop $l)
4207:     {
4208:         if ($this->collPubprops === null) {
4209:             $this->initPubprops();
4210:             $this->collPubpropsPartial = true;
4211:         }
4212:         if (!in_array($l, $this->collPubprops->getArrayCopy(), true)) { // only add it if the **same** object is not already associated
4213:             $this->doAddPubprop($l);
4214:         }
4215: 
4216:         return $this;
4217:     }
4218: 
4219:     /**
4220:      * @param   Pubprop $pubprop The pubprop object to add.
4221:      */
4222:     protected function doAddPubprop($pubprop)
4223:     {
4224:         $this->collPubprops[]= $pubprop;
4225:         $pubprop->setPub($this);
4226:     }
4227: 
4228:     /**
4229:      * @param   Pubprop $pubprop The pubprop object to remove.
4230:      * @return Pub The current object (for fluent API support)
4231:      */
4232:     public function removePubprop($pubprop)
4233:     {
4234:         if ($this->getPubprops()->contains($pubprop)) {
4235:             $this->collPubprops->remove($this->collPubprops->search($pubprop));
4236:             if (null === $this->pubpropsScheduledForDeletion) {
4237:                 $this->pubpropsScheduledForDeletion = clone $this->collPubprops;
4238:                 $this->pubpropsScheduledForDeletion->clear();
4239:             }
4240:             $this->pubpropsScheduledForDeletion[]= clone $pubprop;
4241:             $pubprop->setPub(null);
4242:         }
4243: 
4244:         return $this;
4245:     }
4246: 
4247: 
4248:     /**
4249:      * If this collection has already been initialized with
4250:      * an identical criteria, it returns the collection.
4251:      * Otherwise if this Pub is new, it will return
4252:      * an empty collection; or if this Pub has previously
4253:      * been saved, it will retrieve related Pubprops from storage.
4254:      *
4255:      * This method is protected by default in order to keep the public
4256:      * api reasonable.  You can provide public methods for those you
4257:      * actually need in Pub.
4258:      *
4259:      * @param Criteria $criteria optional Criteria object to narrow the query
4260:      * @param PropelPDO $con optional connection object
4261:      * @param string $join_behavior optional join type to use (defaults to Criteria::LEFT_JOIN)
4262:      * @return PropelObjectCollection|Pubprop[] List of Pubprop objects
4263:      */
4264:     public function getPubpropsJoinCvterm($criteria = null, $con = null, $join_behavior = Criteria::LEFT_JOIN)
4265:     {
4266:         $query = PubpropQuery::create(null, $criteria);
4267:         $query->joinWith('Cvterm', $join_behavior);
4268: 
4269:         return $this->getPubprops($query, $con);
4270:     }
4271: 
4272:     /**
4273:      * Clears the current object and sets all attributes to their default values
4274:      */
4275:     public function clear()
4276:     {
4277:         $this->pub_id = null;
4278:         $this->title = null;
4279:         $this->volumetitle = null;
4280:         $this->volume = null;
4281:         $this->series_name = null;
4282:         $this->issue = null;
4283:         $this->pyear = null;
4284:         $this->pages = null;
4285:         $this->miniref = null;
4286:         $this->uniquename = null;
4287:         $this->type_id = null;
4288:         $this->is_obsolete = null;
4289:         $this->publisher = null;
4290:         $this->pubplace = null;
4291:         $this->alreadyInSave = false;
4292:         $this->alreadyInValidation = false;
4293:         $this->alreadyInClearAllReferencesDeep = false;
4294:         $this->clearAllReferences();
4295:         $this->applyDefaultValues();
4296:         $this->resetModified();
4297:         $this->setNew(true);
4298:         $this->setDeleted(false);
4299:     }
4300: 
4301:     /**
4302:      * Resets all references to other model objects or collections of model objects.
4303:      *
4304:      * This method is a user-space workaround for PHP's inability to garbage collect
4305:      * objects with circular references (even in PHP 5.3). This is currently necessary
4306:      * when using Propel in certain daemon or large-volumne/high-memory operations.
4307:      *
4308:      * @param boolean $deep Whether to also clear the references on all referrer objects.
4309:      */
4310:     public function clearAllReferences($deep = false)
4311:     {
4312:         if ($deep && !$this->alreadyInClearAllReferencesDeep) {
4313:             $this->alreadyInClearAllReferencesDeep = true;
4314:             if ($this->collFeatureCvterms) {
4315:                 foreach ($this->collFeatureCvterms as $o) {
4316:                     $o->clearAllReferences($deep);
4317:                 }
4318:             }
4319:             if ($this->collFeatureCvtermPubs) {
4320:                 foreach ($this->collFeatureCvtermPubs as $o) {
4321:                     $o->clearAllReferences($deep);
4322:                 }
4323:             }
4324:             if ($this->collFeaturePubs) {
4325:                 foreach ($this->collFeaturePubs as $o) {
4326:                     $o->clearAllReferences($deep);
4327:                 }
4328:             }
4329:             if ($this->collFeatureSynonyms) {
4330:                 foreach ($this->collFeatureSynonyms as $o) {
4331:                     $o->clearAllReferences($deep);
4332:                 }
4333:             }
4334:             if ($this->collPubDbxrefs) {
4335:                 foreach ($this->collPubDbxrefs as $o) {
4336:                     $o->clearAllReferences($deep);
4337:                 }
4338:             }
4339:             if ($this->collPubRelationshipsRelatedByObjectId) {
4340:                 foreach ($this->collPubRelationshipsRelatedByObjectId as $o) {
4341:                     $o->clearAllReferences($deep);
4342:                 }
4343:             }
4344:             if ($this->collPubRelationshipsRelatedBySubjectId) {
4345:                 foreach ($this->collPubRelationshipsRelatedBySubjectId as $o) {
4346:                     $o->clearAllReferences($deep);
4347:                 }
4348:             }
4349:             if ($this->collPubauthors) {
4350:                 foreach ($this->collPubauthors as $o) {
4351:                     $o->clearAllReferences($deep);
4352:                 }
4353:             }
4354:             if ($this->collPubprops) {
4355:                 foreach ($this->collPubprops as $o) {
4356:                     $o->clearAllReferences($deep);
4357:                 }
4358:             }
4359:             if ($this->aCvterm instanceof Persistent) {
4360:               $this->aCvterm->clearAllReferences($deep);
4361:             }
4362: 
4363:             $this->alreadyInClearAllReferencesDeep = false;
4364:         } // if ($deep)
4365: 
4366:         if ($this->collFeatureCvterms instanceof PropelCollection) {
4367:             $this->collFeatureCvterms->clearIterator();
4368:         }
4369:         $this->collFeatureCvterms = null;
4370:         if ($this->collFeatureCvtermPubs instanceof PropelCollection) {
4371:             $this->collFeatureCvtermPubs->clearIterator();
4372:         }
4373:         $this->collFeatureCvtermPubs = null;
4374:         if ($this->collFeaturePubs instanceof PropelCollection) {
4375:             $this->collFeaturePubs->clearIterator();
4376:         }
4377:         $this->collFeaturePubs = null;
4378:         if ($this->collFeatureSynonyms instanceof PropelCollection) {
4379:             $this->collFeatureSynonyms->clearIterator();
4380:         }
4381:         $this->collFeatureSynonyms = null;
4382:         if ($this->collPubDbxrefs instanceof PropelCollection) {
4383:             $this->collPubDbxrefs->clearIterator();
4384:         }
4385:         $this->collPubDbxrefs = null;
4386:         if ($this->collPubRelationshipsRelatedByObjectId instanceof PropelCollection) {
4387:             $this->collPubRelationshipsRelatedByObjectId->clearIterator();
4388:         }
4389:         $this->collPubRelationshipsRelatedByObjectId = null;
4390:         if ($this->collPubRelationshipsRelatedBySubjectId instanceof PropelCollection) {
4391:             $this->collPubRelationshipsRelatedBySubjectId->clearIterator();
4392:         }
4393:         $this->collPubRelationshipsRelatedBySubjectId = null;
4394:         if ($this->collPubauthors instanceof PropelCollection) {
4395:             $this->collPubauthors->clearIterator();
4396:         }
4397:         $this->collPubauthors = null;
4398:         if ($this->collPubprops instanceof PropelCollection) {
4399:             $this->collPubprops->clearIterator();
4400:         }
4401:         $this->collPubprops = null;
4402:         $this->aCvterm = null;
4403:     }
4404: 
4405:     /**
4406:      * return the string representation of this object
4407:      *
4408:      * @return string
4409:      */
4410:     public function __toString()
4411:     {
4412:         return (string) $this->exportTo(PubPeer::DEFAULT_STRING_FORMAT);
4413:     }
4414: 
4415:     /**
4416:      * return true is the object is in saving state
4417:      *
4418:      * @return boolean
4419:      */
4420:     public function isAlreadyInSave()
4421:     {
4422:         return $this->alreadyInSave;
4423:     }
4424: 
4425: }
4426: 
tbro API documentation generated by ApiGen 2.8.0