1: <?php
2:
3: namespace cli_db\propel\om;
4:
5: use \BaseObject;
6: use \BasePeer;
7: use \Criteria;
8: use \DateTime;
9: use \Exception;
10: use \PDO;
11: use \Persistent;
12: use \Propel;
13: use \PropelCollection;
14: use \PropelDateTime;
15: use \PropelException;
16: use \PropelObjectCollection;
17: use \PropelPDO;
18: use cli_db\propel\Cvterm;
19: use cli_db\propel\CvtermQuery;
20: use cli_db\propel\Dbxref;
21: use cli_db\propel\DbxrefQuery;
22: use cli_db\propel\Feature;
23: use cli_db\propel\FeatureCvterm;
24: use cli_db\propel\FeatureCvtermQuery;
25: use cli_db\propel\FeatureDbxref;
26: use cli_db\propel\FeatureDbxrefQuery;
27: use cli_db\propel\FeaturePeer;
28: use cli_db\propel\FeaturePub;
29: use cli_db\propel\FeaturePubQuery;
30: use cli_db\propel\FeatureQuery;
31: use cli_db\propel\FeatureSynonym;
32: use cli_db\propel\FeatureSynonymQuery;
33: use cli_db\propel\Organism;
34: use cli_db\propel\OrganismQuery;
35:
36: 37: 38: 39: 40: 41: 42:
43: abstract class BaseFeature extends BaseObject implements Persistent
44: {
45: 46: 47:
48: const PEER = 'cli_db\\propel\\FeaturePeer';
49:
50: 51: 52: 53: 54: 55:
56: protected static $peer;
57:
58: 59: 60: 61:
62: protected $startCopy = false;
63:
64: 65: 66: 67:
68: protected $feature_id;
69:
70: 71: 72: 73:
74: protected $dbxref_id;
75:
76: 77: 78: 79:
80: protected $organism_id;
81:
82: 83: 84: 85:
86: protected $name;
87:
88: 89: 90: 91:
92: protected $uniquename;
93:
94: 95: 96: 97:
98: protected $residues;
99:
100: 101: 102: 103:
104: protected $seqlen;
105:
106: 107: 108: 109:
110: protected $md5checksum;
111:
112: 113: 114: 115:
116: protected $type_id;
117:
118: 119: 120: 121: 122:
123: protected $is_analysis;
124:
125: 126: 127: 128: 129:
130: protected $is_obsolete;
131:
132: 133: 134: 135: 136:
137: protected $timeaccessioned;
138:
139: 140: 141: 142: 143:
144: protected $timelastmodified;
145:
146: 147: 148:
149: protected $aDbxref;
150:
151: 152: 153:
154: protected $aOrganism;
155:
156: 157: 158:
159: protected $aCvterm;
160:
161: 162: 163:
164: protected $collFeatureCvterms;
165: protected $collFeatureCvtermsPartial;
166:
167: 168: 169:
170: protected $collFeatureDbxrefs;
171: protected $collFeatureDbxrefsPartial;
172:
173: 174: 175:
176: protected $collFeaturePubs;
177: protected $collFeaturePubsPartial;
178:
179: 180: 181:
182: protected $collFeatureSynonyms;
183: protected $collFeatureSynonymsPartial;
184:
185: 186: 187: 188: 189:
190: protected $alreadyInSave = false;
191:
192: 193: 194: 195: 196:
197: protected $alreadyInValidation = false;
198:
199: 200: 201: 202:
203: protected $alreadyInClearAllReferencesDeep = false;
204:
205: 206: 207: 208:
209: protected $featureCvtermsScheduledForDeletion = null;
210:
211: 212: 213: 214:
215: protected $featureDbxrefsScheduledForDeletion = null;
216:
217: 218: 219: 220:
221: protected $featurePubsScheduledForDeletion = null;
222:
223: 224: 225: 226:
227: protected $featureSynonymsScheduledForDeletion = null;
228:
229: 230: 231: 232: 233: 234:
235: public function applyDefaultValues()
236: {
237: $this->is_analysis = false;
238: $this->is_obsolete = false;
239: }
240:
241: 242: 243: 244:
245: public function __construct()
246: {
247: parent::__construct();
248: $this->applyDefaultValues();
249: }
250:
251: 252: 253: 254: 255:
256: public function getFeatureId()
257: {
258: return $this->feature_id;
259: }
260:
261: 262: 263: 264: 265:
266: public function getDbxrefId()
267: {
268: return $this->dbxref_id;
269: }
270:
271: 272: 273: 274: 275:
276: public function getOrganismId()
277: {
278: return $this->organism_id;
279: }
280:
281: 282: 283: 284: 285:
286: public function getName()
287: {
288: return $this->name;
289: }
290:
291: 292: 293: 294: 295:
296: public function getUniquename()
297: {
298: return $this->uniquename;
299: }
300:
301: 302: 303: 304: 305:
306: public function getResidues()
307: {
308: return $this->residues;
309: }
310:
311: 312: 313: 314: 315:
316: public function getSeqlen()
317: {
318: return $this->seqlen;
319: }
320:
321: 322: 323: 324: 325:
326: public function getMd5checksum()
327: {
328: return $this->md5checksum;
329: }
330:
331: 332: 333: 334: 335:
336: public function getTypeId()
337: {
338: return $this->type_id;
339: }
340:
341: 342: 343: 344: 345:
346: public function getIsAnalysis()
347: {
348: return $this->is_analysis;
349: }
350:
351: 352: 353: 354: 355:
356: public function getIsObsolete()
357: {
358: return $this->is_obsolete;
359: }
360:
361: 362: 363: 364: 365: 366: 367: 368: 369:
370: public function getTimeaccessioned($format = 'Y-m-d H:i:s')
371: {
372: if ($this->timeaccessioned === null) {
373: return null;
374: }
375:
376:
377: try {
378: $dt = new DateTime($this->timeaccessioned);
379: } catch (Exception $x) {
380: throw new PropelException("Internally stored date/time/timestamp value could not be converted to DateTime: " . var_export($this->timeaccessioned, true), $x);
381: }
382:
383: if ($format === null) {
384:
385: return $dt;
386: }
387:
388: if (strpos($format, '%') !== false) {
389: return strftime($format, $dt->format('U'));
390: }
391:
392: return $dt->format($format);
393:
394: }
395:
396: 397: 398: 399: 400: 401: 402: 403: 404:
405: public function getTimelastmodified($format = 'Y-m-d H:i:s')
406: {
407: if ($this->timelastmodified === null) {
408: return null;
409: }
410:
411:
412: try {
413: $dt = new DateTime($this->timelastmodified);
414: } catch (Exception $x) {
415: throw new PropelException("Internally stored date/time/timestamp value could not be converted to DateTime: " . var_export($this->timelastmodified, true), $x);
416: }
417:
418: if ($format === null) {
419:
420: return $dt;
421: }
422:
423: if (strpos($format, '%') !== false) {
424: return strftime($format, $dt->format('U'));
425: }
426:
427: return $dt->format($format);
428:
429: }
430:
431: 432: 433: 434: 435: 436:
437: public function setFeatureId($v)
438: {
439: if ($v !== null && is_numeric($v)) {
440: $v = (int) $v;
441: }
442:
443: if ($this->feature_id !== $v) {
444: $this->feature_id = $v;
445: $this->modifiedColumns[] = FeaturePeer::FEATURE_ID;
446: }
447:
448:
449: return $this;
450: }
451:
452: 453: 454: 455: 456: 457:
458: public function setDbxrefId($v)
459: {
460: if ($v !== null && is_numeric($v)) {
461: $v = (int) $v;
462: }
463:
464: if ($this->dbxref_id !== $v) {
465: $this->dbxref_id = $v;
466: $this->modifiedColumns[] = FeaturePeer::DBXREF_ID;
467: }
468:
469: if ($this->aDbxref !== null && $this->aDbxref->getDbxrefId() !== $v) {
470: $this->aDbxref = null;
471: }
472:
473:
474: return $this;
475: }
476:
477: 478: 479: 480: 481: 482:
483: public function setOrganismId($v)
484: {
485: if ($v !== null && is_numeric($v)) {
486: $v = (int) $v;
487: }
488:
489: if ($this->organism_id !== $v) {
490: $this->organism_id = $v;
491: $this->modifiedColumns[] = FeaturePeer::ORGANISM_ID;
492: }
493:
494: if ($this->aOrganism !== null && $this->aOrganism->getOrganismId() !== $v) {
495: $this->aOrganism = null;
496: }
497:
498:
499: return $this;
500: }
501:
502: 503: 504: 505: 506: 507:
508: public function setName($v)
509: {
510: if ($v !== null && is_numeric($v)) {
511: $v = (string) $v;
512: }
513:
514: if ($this->name !== $v) {
515: $this->name = $v;
516: $this->modifiedColumns[] = FeaturePeer::NAME;
517: }
518:
519:
520: return $this;
521: }
522:
523: 524: 525: 526: 527: 528:
529: public function setUniquename($v)
530: {
531: if ($v !== null && is_numeric($v)) {
532: $v = (string) $v;
533: }
534:
535: if ($this->uniquename !== $v) {
536: $this->uniquename = $v;
537: $this->modifiedColumns[] = FeaturePeer::UNIQUENAME;
538: }
539:
540:
541: return $this;
542: }
543:
544: 545: 546: 547: 548: 549:
550: public function setResidues($v)
551: {
552: if ($v !== null && is_numeric($v)) {
553: $v = (string) $v;
554: }
555:
556: if ($this->residues !== $v) {
557: $this->residues = $v;
558: $this->modifiedColumns[] = FeaturePeer::RESIDUES;
559: }
560:
561:
562: return $this;
563: }
564:
565: 566: 567: 568: 569: 570:
571: public function setSeqlen($v)
572: {
573: if ($v !== null && is_numeric($v)) {
574: $v = (int) $v;
575: }
576:
577: if ($this->seqlen !== $v) {
578: $this->seqlen = $v;
579: $this->modifiedColumns[] = FeaturePeer::SEQLEN;
580: }
581:
582:
583: return $this;
584: }
585:
586: 587: 588: 589: 590: 591:
592: public function setMd5checksum($v)
593: {
594: if ($v !== null && is_numeric($v)) {
595: $v = (string) $v;
596: }
597:
598: if ($this->md5checksum !== $v) {
599: $this->md5checksum = $v;
600: $this->modifiedColumns[] = FeaturePeer::MD5CHECKSUM;
601: }
602:
603:
604: return $this;
605: }
606:
607: 608: 609: 610: 611: 612:
613: public function setTypeId($v)
614: {
615: if ($v !== null && is_numeric($v)) {
616: $v = (int) $v;
617: }
618:
619: if ($this->type_id !== $v) {
620: $this->type_id = $v;
621: $this->modifiedColumns[] = FeaturePeer::TYPE_ID;
622: }
623:
624: if ($this->aCvterm !== null && $this->aCvterm->getCvtermId() !== $v) {
625: $this->aCvterm = null;
626: }
627:
628:
629: return $this;
630: }
631:
632: 633: 634: 635: 636: 637: 638: 639: 640: 641:
642: public function setIsAnalysis($v)
643: {
644: if ($v !== null) {
645: if (is_string($v)) {
646: $v = in_array(strtolower($v), array('false', 'off', '-', 'no', 'n', '0', '')) ? false : true;
647: } else {
648: $v = (boolean) $v;
649: }
650: }
651:
652: if ($this->is_analysis !== $v) {
653: $this->is_analysis = $v;
654: $this->modifiedColumns[] = FeaturePeer::IS_ANALYSIS;
655: }
656:
657:
658: return $this;
659: }
660:
661: 662: 663: 664: 665: 666: 667: 668: 669: 670:
671: public function setIsObsolete($v)
672: {
673: if ($v !== null) {
674: if (is_string($v)) {
675: $v = in_array(strtolower($v), array('false', 'off', '-', 'no', 'n', '0', '')) ? false : true;
676: } else {
677: $v = (boolean) $v;
678: }
679: }
680:
681: if ($this->is_obsolete !== $v) {
682: $this->is_obsolete = $v;
683: $this->modifiedColumns[] = FeaturePeer::IS_OBSOLETE;
684: }
685:
686:
687: return $this;
688: }
689:
690: 691: 692: 693: 694: 695: 696:
697: public function setTimeaccessioned($v)
698: {
699: $dt = PropelDateTime::newInstance($v, null, 'DateTime');
700: if ($this->timeaccessioned !== null || $dt !== null) {
701: $currentDateAsString = ($this->timeaccessioned !== null && $tmpDt = new DateTime($this->timeaccessioned)) ? $tmpDt->format('Y-m-d H:i:s') : null;
702: $newDateAsString = $dt ? $dt->format('Y-m-d H:i:s') : null;
703: if ($currentDateAsString !== $newDateAsString) {
704: $this->timeaccessioned = $newDateAsString;
705: $this->modifiedColumns[] = FeaturePeer::TIMEACCESSIONED;
706: }
707: }
708:
709:
710: return $this;
711: }
712:
713: 714: 715: 716: 717: 718: 719:
720: public function setTimelastmodified($v)
721: {
722: $dt = PropelDateTime::newInstance($v, null, 'DateTime');
723: if ($this->timelastmodified !== null || $dt !== null) {
724: $currentDateAsString = ($this->timelastmodified !== null && $tmpDt = new DateTime($this->timelastmodified)) ? $tmpDt->format('Y-m-d H:i:s') : null;
725: $newDateAsString = $dt ? $dt->format('Y-m-d H:i:s') : null;
726: if ($currentDateAsString !== $newDateAsString) {
727: $this->timelastmodified = $newDateAsString;
728: $this->modifiedColumns[] = FeaturePeer::TIMELASTMODIFIED;
729: }
730: }
731:
732:
733: return $this;
734: }
735:
736: 737: 738: 739: 740: 741: 742: 743:
744: public function hasOnlyDefaultValues()
745: {
746: if ($this->is_analysis !== false) {
747: return false;
748: }
749:
750: if ($this->is_obsolete !== false) {
751: return false;
752: }
753:
754:
755: return true;
756: }
757:
758: 759: 760: 761: 762: 763: 764: 765: 766: 767: 768: 769: 770: 771:
772: public function hydrate($row, $startcol = 0, $rehydrate = false)
773: {
774: try {
775:
776: $this->feature_id = ($row[$startcol + 0] !== null) ? (int) $row[$startcol + 0] : null;
777: $this->dbxref_id = ($row[$startcol + 1] !== null) ? (int) $row[$startcol + 1] : null;
778: $this->organism_id = ($row[$startcol + 2] !== null) ? (int) $row[$startcol + 2] : null;
779: $this->name = ($row[$startcol + 3] !== null) ? (string) $row[$startcol + 3] : null;
780: $this->uniquename = ($row[$startcol + 4] !== null) ? (string) $row[$startcol + 4] : null;
781: $this->residues = ($row[$startcol + 5] !== null) ? (string) $row[$startcol + 5] : null;
782: $this->seqlen = ($row[$startcol + 6] !== null) ? (int) $row[$startcol + 6] : null;
783: $this->md5checksum = ($row[$startcol + 7] !== null) ? (string) $row[$startcol + 7] : null;
784: $this->type_id = ($row[$startcol + 8] !== null) ? (int) $row[$startcol + 8] : null;
785: $this->is_analysis = ($row[$startcol + 9] !== null) ? (boolean) $row[$startcol + 9] : null;
786: $this->is_obsolete = ($row[$startcol + 10] !== null) ? (boolean) $row[$startcol + 10] : null;
787: $this->timeaccessioned = ($row[$startcol + 11] !== null) ? (string) $row[$startcol + 11] : null;
788: $this->timelastmodified = ($row[$startcol + 12] !== null) ? (string) $row[$startcol + 12] : null;
789: $this->resetModified();
790:
791: $this->setNew(false);
792:
793: if ($rehydrate) {
794: $this->ensureConsistency();
795: }
796: $this->postHydrate($row, $startcol, $rehydrate);
797: return $startcol + 13;
798:
799: } catch (Exception $e) {
800: throw new PropelException("Error populating Feature object", $e);
801: }
802: }
803:
804: 805: 806: 807: 808: 809: 810: 811: 812: 813: 814: 815: 816:
817: public function ensureConsistency()
818: {
819:
820: if ($this->aDbxref !== null && $this->dbxref_id !== $this->aDbxref->getDbxrefId()) {
821: $this->aDbxref = null;
822: }
823: if ($this->aOrganism !== null && $this->organism_id !== $this->aOrganism->getOrganismId()) {
824: $this->aOrganism = null;
825: }
826: if ($this->aCvterm !== null && $this->type_id !== $this->aCvterm->getCvtermId()) {
827: $this->aCvterm = null;
828: }
829: }
830:
831: 832: 833: 834: 835: 836: 837: 838: 839: 840:
841: public function reload($deep = false, PropelPDO $con = null)
842: {
843: if ($this->isDeleted()) {
844: throw new PropelException("Cannot reload a deleted object.");
845: }
846:
847: if ($this->isNew()) {
848: throw new PropelException("Cannot reload an unsaved object.");
849: }
850:
851: if ($con === null) {
852: $con = Propel::getConnection(FeaturePeer::DATABASE_NAME, Propel::CONNECTION_READ);
853: }
854:
855:
856:
857:
858: $stmt = FeaturePeer::doSelectStmt($this->buildPkeyCriteria(), $con);
859: $row = $stmt->fetch(PDO::FETCH_NUM);
860: $stmt->closeCursor();
861: if (!$row) {
862: throw new PropelException('Cannot find matching row in the database to reload object values.');
863: }
864: $this->hydrate($row, 0, true);
865:
866: if ($deep) {
867:
868: $this->aDbxref = null;
869: $this->aOrganism = null;
870: $this->aCvterm = null;
871: $this->collFeatureCvterms = null;
872:
873: $this->collFeatureDbxrefs = null;
874:
875: $this->collFeaturePubs = null;
876:
877: $this->collFeatureSynonyms = null;
878:
879: }
880: }
881:
882: 883: 884: 885: 886: 887: 888: 889: 890: 891:
892: public function delete(PropelPDO $con = null)
893: {
894: if ($this->isDeleted()) {
895: throw new PropelException("This object has already been deleted.");
896: }
897:
898: if ($con === null) {
899: $con = Propel::getConnection(FeaturePeer::DATABASE_NAME, Propel::CONNECTION_WRITE);
900: }
901:
902: $con->beginTransaction();
903: try {
904: $deleteQuery = FeatureQuery::create()
905: ->filterByPrimaryKey($this->getPrimaryKey());
906: $ret = $this->preDelete($con);
907: if ($ret) {
908: $deleteQuery->delete($con);
909: $this->postDelete($con);
910: $con->commit();
911: $this->setDeleted(true);
912: } else {
913: $con->commit();
914: }
915: } catch (Exception $e) {
916: $con->rollBack();
917: throw $e;
918: }
919: }
920:
921: 922: 923: 924: 925: 926: 927: 928: 929: 930: 931: 932: 933: 934:
935: public function save(PropelPDO $con = null)
936: {
937: if ($this->isDeleted()) {
938: throw new PropelException("You cannot save an object that has been deleted.");
939: }
940:
941: if ($con === null) {
942: $con = Propel::getConnection(FeaturePeer::DATABASE_NAME, Propel::CONNECTION_WRITE);
943: }
944:
945: $con->beginTransaction();
946: $isInsert = $this->isNew();
947: try {
948: $ret = $this->preSave($con);
949: if ($isInsert) {
950: $ret = $ret && $this->preInsert($con);
951: } else {
952: $ret = $ret && $this->preUpdate($con);
953: }
954: if ($ret) {
955: $affectedRows = $this->doSave($con);
956: if ($isInsert) {
957: $this->postInsert($con);
958: } else {
959: $this->postUpdate($con);
960: }
961: $this->postSave($con);
962: FeaturePeer::addInstanceToPool($this);
963: } else {
964: $affectedRows = 0;
965: }
966: $con->commit();
967:
968: return $affectedRows;
969: } catch (Exception $e) {
970: $con->rollBack();
971: throw $e;
972: }
973: }
974:
975: 976: 977: 978: 979: 980: 981: 982: 983: 984: 985:
986: protected function doSave(PropelPDO $con)
987: {
988: $affectedRows = 0;
989: if (!$this->alreadyInSave) {
990: $this->alreadyInSave = true;
991:
992:
993:
994:
995:
996:
997: if ($this->aDbxref !== null) {
998: if ($this->aDbxref->isModified() || $this->aDbxref->isNew()) {
999: $affectedRows += $this->aDbxref->save($con);
1000: }
1001: $this->setDbxref($this->aDbxref);
1002: }
1003:
1004: if ($this->aOrganism !== null) {
1005: if ($this->aOrganism->isModified() || $this->aOrganism->isNew()) {
1006: $affectedRows += $this->aOrganism->save($con);
1007: }
1008: $this->setOrganism($this->aOrganism);
1009: }
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:
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->featureDbxrefsScheduledForDeletion !== null) {
1047: if (!$this->featureDbxrefsScheduledForDeletion->isEmpty()) {
1048: FeatureDbxrefQuery::create()
1049: ->filterByPrimaryKeys($this->featureDbxrefsScheduledForDeletion->getPrimaryKeys(false))
1050: ->delete($con);
1051: $this->featureDbxrefsScheduledForDeletion = null;
1052: }
1053: }
1054:
1055: if ($this->collFeatureDbxrefs !== null) {
1056: foreach ($this->collFeatureDbxrefs 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: $this->alreadyInSave = false;
1098:
1099: }
1100:
1101: return $affectedRows;
1102: }
1103:
1104: 1105: 1106: 1107: 1108: 1109: 1110: 1111:
1112: protected function doInsert(PropelPDO $con)
1113: {
1114: $modifiedColumns = array();
1115: $index = 0;
1116:
1117: $this->modifiedColumns[] = FeaturePeer::FEATURE_ID;
1118: if (null !== $this->feature_id) {
1119: throw new PropelException('Cannot insert a value for auto-increment primary key (' . FeaturePeer::FEATURE_ID . ')');
1120: }
1121: if (null === $this->feature_id) {
1122: try {
1123: $stmt = $con->query("SELECT nextval('feature_feature_id_seq')");
1124: $row = $stmt->fetch(PDO::FETCH_NUM);
1125: $this->feature_id = $row[0];
1126: } catch (Exception $e) {
1127: throw new PropelException('Unable to get sequence id.', $e);
1128: }
1129: }
1130:
1131:
1132:
1133: if ($this->isColumnModified(FeaturePeer::FEATURE_ID)) {
1134: $modifiedColumns[':p' . $index++] = '"feature_id"';
1135: }
1136: if ($this->isColumnModified(FeaturePeer::DBXREF_ID)) {
1137: $modifiedColumns[':p' . $index++] = '"dbxref_id"';
1138: }
1139: if ($this->isColumnModified(FeaturePeer::ORGANISM_ID)) {
1140: $modifiedColumns[':p' . $index++] = '"organism_id"';
1141: }
1142: if ($this->isColumnModified(FeaturePeer::NAME)) {
1143: $modifiedColumns[':p' . $index++] = '"name"';
1144: }
1145: if ($this->isColumnModified(FeaturePeer::UNIQUENAME)) {
1146: $modifiedColumns[':p' . $index++] = '"uniquename"';
1147: }
1148: if ($this->isColumnModified(FeaturePeer::RESIDUES)) {
1149: $modifiedColumns[':p' . $index++] = '"residues"';
1150: }
1151: if ($this->isColumnModified(FeaturePeer::SEQLEN)) {
1152: $modifiedColumns[':p' . $index++] = '"seqlen"';
1153: }
1154: if ($this->isColumnModified(FeaturePeer::MD5CHECKSUM)) {
1155: $modifiedColumns[':p' . $index++] = '"md5checksum"';
1156: }
1157: if ($this->isColumnModified(FeaturePeer::TYPE_ID)) {
1158: $modifiedColumns[':p' . $index++] = '"type_id"';
1159: }
1160: if ($this->isColumnModified(FeaturePeer::IS_ANALYSIS)) {
1161: $modifiedColumns[':p' . $index++] = '"is_analysis"';
1162: }
1163: if ($this->isColumnModified(FeaturePeer::IS_OBSOLETE)) {
1164: $modifiedColumns[':p' . $index++] = '"is_obsolete"';
1165: }
1166: if ($this->isColumnModified(FeaturePeer::TIMEACCESSIONED)) {
1167: $modifiedColumns[':p' . $index++] = '"timeaccessioned"';
1168: }
1169: if ($this->isColumnModified(FeaturePeer::TIMELASTMODIFIED)) {
1170: $modifiedColumns[':p' . $index++] = '"timelastmodified"';
1171: }
1172:
1173: $sql = sprintf(
1174: 'INSERT INTO "feature" (%s) VALUES (%s)',
1175: implode(', ', $modifiedColumns),
1176: implode(', ', array_keys($modifiedColumns))
1177: );
1178:
1179: try {
1180: $stmt = $con->prepare($sql);
1181: foreach ($modifiedColumns as $identifier => $columnName) {
1182: switch ($columnName) {
1183: case '"feature_id"':
1184: $stmt->bindValue($identifier, $this->feature_id, PDO::PARAM_INT);
1185: break;
1186: case '"dbxref_id"':
1187: $stmt->bindValue($identifier, $this->dbxref_id, PDO::PARAM_INT);
1188: break;
1189: case '"organism_id"':
1190: $stmt->bindValue($identifier, $this->organism_id, PDO::PARAM_INT);
1191: break;
1192: case '"name"':
1193: $stmt->bindValue($identifier, $this->name, PDO::PARAM_STR);
1194: break;
1195: case '"uniquename"':
1196: $stmt->bindValue($identifier, $this->uniquename, PDO::PARAM_STR);
1197: break;
1198: case '"residues"':
1199: $stmt->bindValue($identifier, $this->residues, PDO::PARAM_STR);
1200: break;
1201: case '"seqlen"':
1202: $stmt->bindValue($identifier, $this->seqlen, PDO::PARAM_INT);
1203: break;
1204: case '"md5checksum"':
1205: $stmt->bindValue($identifier, $this->md5checksum, PDO::PARAM_STR);
1206: break;
1207: case '"type_id"':
1208: $stmt->bindValue($identifier, $this->type_id, PDO::PARAM_INT);
1209: break;
1210: case '"is_analysis"':
1211: $stmt->bindValue($identifier, $this->is_analysis, PDO::PARAM_BOOL);
1212: break;
1213: case '"is_obsolete"':
1214: $stmt->bindValue($identifier, $this->is_obsolete, PDO::PARAM_BOOL);
1215: break;
1216: case '"timeaccessioned"':
1217: $stmt->bindValue($identifier, $this->timeaccessioned, PDO::PARAM_STR);
1218: break;
1219: case '"timelastmodified"':
1220: $stmt->bindValue($identifier, $this->timelastmodified, PDO::PARAM_STR);
1221: break;
1222: }
1223: }
1224: $stmt->execute();
1225: } catch (Exception $e) {
1226: Propel::log($e->getMessage(), Propel::LOG_ERR);
1227: throw new PropelException(sprintf('Unable to execute INSERT statement [%s]', $sql), $e);
1228: }
1229:
1230: $this->setNew(false);
1231: }
1232:
1233: 1234: 1235: 1236: 1237: 1238: 1239:
1240: protected function doUpdate(PropelPDO $con)
1241: {
1242: $selectCriteria = $this->buildPkeyCriteria();
1243: $valuesCriteria = $this->buildCriteria();
1244: BasePeer::doUpdate($selectCriteria, $valuesCriteria, $con);
1245: }
1246:
1247: 1248: 1249: 1250:
1251: protected $validationFailures = array();
1252:
1253: 1254: 1255: 1256: 1257: 1258: 1259:
1260: public function getValidationFailures()
1261: {
1262: return $this->validationFailures;
1263: }
1264:
1265: 1266: 1267: 1268: 1269: 1270: 1271: 1272: 1273: 1274: 1275:
1276: public function validate($columns = null)
1277: {
1278: $res = $this->doValidate($columns);
1279: if ($res === true) {
1280: $this->validationFailures = array();
1281:
1282: return true;
1283: }
1284:
1285: $this->validationFailures = $res;
1286:
1287: return false;
1288: }
1289:
1290: 1291: 1292: 1293: 1294: 1295: 1296: 1297: 1298: 1299:
1300: protected function doValidate($columns = null)
1301: {
1302: if (!$this->alreadyInValidation) {
1303: $this->alreadyInValidation = true;
1304: $retval = null;
1305:
1306: $failureMap = array();
1307:
1308:
1309:
1310:
1311:
1312:
1313:
1314: if ($this->aDbxref !== null) {
1315: if (!$this->aDbxref->validate($columns)) {
1316: $failureMap = array_merge($failureMap, $this->aDbxref->getValidationFailures());
1317: }
1318: }
1319:
1320: if ($this->aOrganism !== null) {
1321: if (!$this->aOrganism->validate($columns)) {
1322: $failureMap = array_merge($failureMap, $this->aOrganism->getValidationFailures());
1323: }
1324: }
1325:
1326: if ($this->aCvterm !== null) {
1327: if (!$this->aCvterm->validate($columns)) {
1328: $failureMap = array_merge($failureMap, $this->aCvterm->getValidationFailures());
1329: }
1330: }
1331:
1332:
1333: if (($retval = FeaturePeer::doValidate($this, $columns)) !== true) {
1334: $failureMap = array_merge($failureMap, $retval);
1335: }
1336:
1337:
1338: if ($this->collFeatureCvterms !== null) {
1339: foreach ($this->collFeatureCvterms as $referrerFK) {
1340: if (!$referrerFK->validate($columns)) {
1341: $failureMap = array_merge($failureMap, $referrerFK->getValidationFailures());
1342: }
1343: }
1344: }
1345:
1346: if ($this->collFeatureDbxrefs !== null) {
1347: foreach ($this->collFeatureDbxrefs as $referrerFK) {
1348: if (!$referrerFK->validate($columns)) {
1349: $failureMap = array_merge($failureMap, $referrerFK->getValidationFailures());
1350: }
1351: }
1352: }
1353:
1354: if ($this->collFeaturePubs !== null) {
1355: foreach ($this->collFeaturePubs as $referrerFK) {
1356: if (!$referrerFK->validate($columns)) {
1357: $failureMap = array_merge($failureMap, $referrerFK->getValidationFailures());
1358: }
1359: }
1360: }
1361:
1362: if ($this->collFeatureSynonyms !== null) {
1363: foreach ($this->collFeatureSynonyms as $referrerFK) {
1364: if (!$referrerFK->validate($columns)) {
1365: $failureMap = array_merge($failureMap, $referrerFK->getValidationFailures());
1366: }
1367: }
1368: }
1369:
1370:
1371: $this->alreadyInValidation = false;
1372: }
1373:
1374: return (!empty($failureMap) ? $failureMap : true);
1375: }
1376:
1377: 1378: 1379: 1380: 1381: 1382: 1383: 1384: 1385: 1386:
1387: public function getByName($name, $type = BasePeer::TYPE_PHPNAME)
1388: {
1389: $pos = FeaturePeer::translateFieldName($name, $type, BasePeer::TYPE_NUM);
1390: $field = $this->getByPosition($pos);
1391:
1392: return $field;
1393: }
1394:
1395: 1396: 1397: 1398: 1399: 1400: 1401:
1402: public function getByPosition($pos)
1403: {
1404: switch ($pos) {
1405: case 0:
1406: return $this->getFeatureId();
1407: break;
1408: case 1:
1409: return $this->getDbxrefId();
1410: break;
1411: case 2:
1412: return $this->getOrganismId();
1413: break;
1414: case 3:
1415: return $this->getName();
1416: break;
1417: case 4:
1418: return $this->getUniquename();
1419: break;
1420: case 5:
1421: return $this->getResidues();
1422: break;
1423: case 6:
1424: return $this->getSeqlen();
1425: break;
1426: case 7:
1427: return $this->getMd5checksum();
1428: break;
1429: case 8:
1430: return $this->getTypeId();
1431: break;
1432: case 9:
1433: return $this->getIsAnalysis();
1434: break;
1435: case 10:
1436: return $this->getIsObsolete();
1437: break;
1438: case 11:
1439: return $this->getTimeaccessioned();
1440: break;
1441: case 12:
1442: return $this->getTimelastmodified();
1443: break;
1444: default:
1445: return null;
1446: break;
1447: }
1448: }
1449:
1450: 1451: 1452: 1453: 1454: 1455: 1456: 1457: 1458: 1459: 1460: 1461: 1462: 1463: 1464:
1465: public function toArray($keyType = BasePeer::TYPE_PHPNAME, $includeLazyLoadColumns = true, $alreadyDumpedObjects = array(), $includeForeignObjects = false)
1466: {
1467: if (isset($alreadyDumpedObjects['Feature'][$this->getPrimaryKey()])) {
1468: return '*RECURSION*';
1469: }
1470: $alreadyDumpedObjects['Feature'][$this->getPrimaryKey()] = true;
1471: $keys = FeaturePeer::getFieldNames($keyType);
1472: $result = array(
1473: $keys[0] => $this->getFeatureId(),
1474: $keys[1] => $this->getDbxrefId(),
1475: $keys[2] => $this->getOrganismId(),
1476: $keys[3] => $this->getName(),
1477: $keys[4] => $this->getUniquename(),
1478: $keys[5] => $this->getResidues(),
1479: $keys[6] => $this->getSeqlen(),
1480: $keys[7] => $this->getMd5checksum(),
1481: $keys[8] => $this->getTypeId(),
1482: $keys[9] => $this->getIsAnalysis(),
1483: $keys[10] => $this->getIsObsolete(),
1484: $keys[11] => $this->getTimeaccessioned(),
1485: $keys[12] => $this->getTimelastmodified(),
1486: );
1487: if ($includeForeignObjects) {
1488: if (null !== $this->aDbxref) {
1489: $result['Dbxref'] = $this->aDbxref->toArray($keyType, $includeLazyLoadColumns, $alreadyDumpedObjects, true);
1490: }
1491: if (null !== $this->aOrganism) {
1492: $result['Organism'] = $this->aOrganism->toArray($keyType, $includeLazyLoadColumns, $alreadyDumpedObjects, true);
1493: }
1494: if (null !== $this->aCvterm) {
1495: $result['Cvterm'] = $this->aCvterm->toArray($keyType, $includeLazyLoadColumns, $alreadyDumpedObjects, true);
1496: }
1497: if (null !== $this->collFeatureCvterms) {
1498: $result['FeatureCvterms'] = $this->collFeatureCvterms->toArray(null, true, $keyType, $includeLazyLoadColumns, $alreadyDumpedObjects);
1499: }
1500: if (null !== $this->collFeatureDbxrefs) {
1501: $result['FeatureDbxrefs'] = $this->collFeatureDbxrefs->toArray(null, true, $keyType, $includeLazyLoadColumns, $alreadyDumpedObjects);
1502: }
1503: if (null !== $this->collFeaturePubs) {
1504: $result['FeaturePubs'] = $this->collFeaturePubs->toArray(null, true, $keyType, $includeLazyLoadColumns, $alreadyDumpedObjects);
1505: }
1506: if (null !== $this->collFeatureSynonyms) {
1507: $result['FeatureSynonyms'] = $this->collFeatureSynonyms->toArray(null, true, $keyType, $includeLazyLoadColumns, $alreadyDumpedObjects);
1508: }
1509: }
1510:
1511: return $result;
1512: }
1513:
1514: 1515: 1516: 1517: 1518: 1519: 1520: 1521: 1522: 1523: 1524:
1525: public function setByName($name, $value, $type = BasePeer::TYPE_PHPNAME)
1526: {
1527: $pos = FeaturePeer::translateFieldName($name, $type, BasePeer::TYPE_NUM);
1528:
1529: $this->setByPosition($pos, $value);
1530: }
1531:
1532: 1533: 1534: 1535: 1536: 1537: 1538: 1539:
1540: public function setByPosition($pos, $value)
1541: {
1542: switch ($pos) {
1543: case 0:
1544: $this->setFeatureId($value);
1545: break;
1546: case 1:
1547: $this->setDbxrefId($value);
1548: break;
1549: case 2:
1550: $this->setOrganismId($value);
1551: break;
1552: case 3:
1553: $this->setName($value);
1554: break;
1555: case 4:
1556: $this->setUniquename($value);
1557: break;
1558: case 5:
1559: $this->setResidues($value);
1560: break;
1561: case 6:
1562: $this->setSeqlen($value);
1563: break;
1564: case 7:
1565: $this->setMd5checksum($value);
1566: break;
1567: case 8:
1568: $this->setTypeId($value);
1569: break;
1570: case 9:
1571: $this->setIsAnalysis($value);
1572: break;
1573: case 10:
1574: $this->setIsObsolete($value);
1575: break;
1576: case 11:
1577: $this->setTimeaccessioned($value);
1578: break;
1579: case 12:
1580: $this->setTimelastmodified($value);
1581: break;
1582: }
1583: }
1584:
1585: 1586: 1587: 1588: 1589: 1590: 1591: 1592: 1593: 1594: 1595: 1596: 1597: 1598: 1599: 1600: 1601:
1602: public function fromArray($arr, $keyType = BasePeer::TYPE_PHPNAME)
1603: {
1604: $keys = FeaturePeer::getFieldNames($keyType);
1605:
1606: if (array_key_exists($keys[0], $arr)) $this->setFeatureId($arr[$keys[0]]);
1607: if (array_key_exists($keys[1], $arr)) $this->setDbxrefId($arr[$keys[1]]);
1608: if (array_key_exists($keys[2], $arr)) $this->setOrganismId($arr[$keys[2]]);
1609: if (array_key_exists($keys[3], $arr)) $this->setName($arr[$keys[3]]);
1610: if (array_key_exists($keys[4], $arr)) $this->setUniquename($arr[$keys[4]]);
1611: if (array_key_exists($keys[5], $arr)) $this->setResidues($arr[$keys[5]]);
1612: if (array_key_exists($keys[6], $arr)) $this->setSeqlen($arr[$keys[6]]);
1613: if (array_key_exists($keys[7], $arr)) $this->setMd5checksum($arr[$keys[7]]);
1614: if (array_key_exists($keys[8], $arr)) $this->setTypeId($arr[$keys[8]]);
1615: if (array_key_exists($keys[9], $arr)) $this->setIsAnalysis($arr[$keys[9]]);
1616: if (array_key_exists($keys[10], $arr)) $this->setIsObsolete($arr[$keys[10]]);
1617: if (array_key_exists($keys[11], $arr)) $this->setTimeaccessioned($arr[$keys[11]]);
1618: if (array_key_exists($keys[12], $arr)) $this->setTimelastmodified($arr[$keys[12]]);
1619: }
1620:
1621: 1622: 1623: 1624: 1625:
1626: public function buildCriteria()
1627: {
1628: $criteria = new Criteria(FeaturePeer::DATABASE_NAME);
1629:
1630: if ($this->isColumnModified(FeaturePeer::FEATURE_ID)) $criteria->add(FeaturePeer::FEATURE_ID, $this->feature_id);
1631: if ($this->isColumnModified(FeaturePeer::DBXREF_ID)) $criteria->add(FeaturePeer::DBXREF_ID, $this->dbxref_id);
1632: if ($this->isColumnModified(FeaturePeer::ORGANISM_ID)) $criteria->add(FeaturePeer::ORGANISM_ID, $this->organism_id);
1633: if ($this->isColumnModified(FeaturePeer::NAME)) $criteria->add(FeaturePeer::NAME, $this->name);
1634: if ($this->isColumnModified(FeaturePeer::UNIQUENAME)) $criteria->add(FeaturePeer::UNIQUENAME, $this->uniquename);
1635: if ($this->isColumnModified(FeaturePeer::RESIDUES)) $criteria->add(FeaturePeer::RESIDUES, $this->residues);
1636: if ($this->isColumnModified(FeaturePeer::SEQLEN)) $criteria->add(FeaturePeer::SEQLEN, $this->seqlen);
1637: if ($this->isColumnModified(FeaturePeer::MD5CHECKSUM)) $criteria->add(FeaturePeer::MD5CHECKSUM, $this->md5checksum);
1638: if ($this->isColumnModified(FeaturePeer::TYPE_ID)) $criteria->add(FeaturePeer::TYPE_ID, $this->type_id);
1639: if ($this->isColumnModified(FeaturePeer::IS_ANALYSIS)) $criteria->add(FeaturePeer::IS_ANALYSIS, $this->is_analysis);
1640: if ($this->isColumnModified(FeaturePeer::IS_OBSOLETE)) $criteria->add(FeaturePeer::IS_OBSOLETE, $this->is_obsolete);
1641: if ($this->isColumnModified(FeaturePeer::TIMEACCESSIONED)) $criteria->add(FeaturePeer::TIMEACCESSIONED, $this->timeaccessioned);
1642: if ($this->isColumnModified(FeaturePeer::TIMELASTMODIFIED)) $criteria->add(FeaturePeer::TIMELASTMODIFIED, $this->timelastmodified);
1643:
1644: return $criteria;
1645: }
1646:
1647: 1648: 1649: 1650: 1651: 1652: 1653: 1654:
1655: public function buildPkeyCriteria()
1656: {
1657: $criteria = new Criteria(FeaturePeer::DATABASE_NAME);
1658: $criteria->add(FeaturePeer::FEATURE_ID, $this->feature_id);
1659:
1660: return $criteria;
1661: }
1662:
1663: 1664: 1665: 1666:
1667: public function getPrimaryKey()
1668: {
1669: return $this->getFeatureId();
1670: }
1671:
1672: 1673: 1674: 1675: 1676: 1677:
1678: public function setPrimaryKey($key)
1679: {
1680: $this->setFeatureId($key);
1681: }
1682:
1683: 1684: 1685: 1686:
1687: public function isPrimaryKeyNull()
1688: {
1689:
1690: return null === $this->getFeatureId();
1691: }
1692:
1693: 1694: 1695: 1696: 1697: 1698: 1699: 1700: 1701: 1702: 1703:
1704: public function copyInto($copyObj, $deepCopy = false, $makeNew = true)
1705: {
1706: $copyObj->setDbxrefId($this->getDbxrefId());
1707: $copyObj->setOrganismId($this->getOrganismId());
1708: $copyObj->setName($this->getName());
1709: $copyObj->setUniquename($this->getUniquename());
1710: $copyObj->setResidues($this->getResidues());
1711: $copyObj->setSeqlen($this->getSeqlen());
1712: $copyObj->setMd5checksum($this->getMd5checksum());
1713: $copyObj->setTypeId($this->getTypeId());
1714: $copyObj->setIsAnalysis($this->getIsAnalysis());
1715: $copyObj->setIsObsolete($this->getIsObsolete());
1716: $copyObj->setTimeaccessioned($this->getTimeaccessioned());
1717: $copyObj->setTimelastmodified($this->getTimelastmodified());
1718:
1719: if ($deepCopy && !$this->startCopy) {
1720:
1721:
1722: $copyObj->setNew(false);
1723:
1724: $this->startCopy = true;
1725:
1726: foreach ($this->getFeatureCvterms() as $relObj) {
1727: if ($relObj !== $this) {
1728: $copyObj->addFeatureCvterm($relObj->copy($deepCopy));
1729: }
1730: }
1731:
1732: foreach ($this->getFeatureDbxrefs() as $relObj) {
1733: if ($relObj !== $this) {
1734: $copyObj->addFeatureDbxref($relObj->copy($deepCopy));
1735: }
1736: }
1737:
1738: foreach ($this->getFeaturePubs() as $relObj) {
1739: if ($relObj !== $this) {
1740: $copyObj->addFeaturePub($relObj->copy($deepCopy));
1741: }
1742: }
1743:
1744: foreach ($this->getFeatureSynonyms() as $relObj) {
1745: if ($relObj !== $this) {
1746: $copyObj->addFeatureSynonym($relObj->copy($deepCopy));
1747: }
1748: }
1749:
1750:
1751: $this->startCopy = false;
1752: }
1753:
1754: if ($makeNew) {
1755: $copyObj->setNew(true);
1756: $copyObj->setFeatureId(NULL);
1757: }
1758: }
1759:
1760: 1761: 1762: 1763: 1764: 1765: 1766: 1767: 1768: 1769: 1770: 1771:
1772: public function copy($deepCopy = false)
1773: {
1774:
1775: $clazz = get_class($this);
1776: $copyObj = new $clazz();
1777: $this->copyInto($copyObj, $deepCopy);
1778:
1779: return $copyObj;
1780: }
1781:
1782: 1783: 1784: 1785: 1786: 1787: 1788: 1789: 1790:
1791: public function getPeer()
1792: {
1793: if (self::$peer === null) {
1794: self::$peer = new FeaturePeer();
1795: }
1796:
1797: return self::$peer;
1798: }
1799:
1800: 1801: 1802: 1803: 1804: 1805: 1806:
1807: public function setDbxref(Dbxref $v = null)
1808: {
1809: if ($v === null) {
1810: $this->setDbxrefId(NULL);
1811: } else {
1812: $this->setDbxrefId($v->getDbxrefId());
1813: }
1814:
1815: $this->aDbxref = $v;
1816:
1817:
1818:
1819: if ($v !== null) {
1820: $v->addFeature($this);
1821: }
1822:
1823:
1824: return $this;
1825: }
1826:
1827:
1828: 1829: 1830: 1831: 1832: 1833: 1834: 1835:
1836: public function getDbxref(PropelPDO $con = null, $doQuery = true)
1837: {
1838: if ($this->aDbxref === null && ($this->dbxref_id !== null) && $doQuery) {
1839: $this->aDbxref = DbxrefQuery::create()->findPk($this->dbxref_id, $con);
1840: 1841: 1842: 1843: 1844: 1845: 1846:
1847: }
1848:
1849: return $this->aDbxref;
1850: }
1851:
1852: 1853: 1854: 1855: 1856: 1857: 1858:
1859: public function setOrganism(Organism $v = null)
1860: {
1861: if ($v === null) {
1862: $this->setOrganismId(NULL);
1863: } else {
1864: $this->setOrganismId($v->getOrganismId());
1865: }
1866:
1867: $this->aOrganism = $v;
1868:
1869:
1870:
1871: if ($v !== null) {
1872: $v->addFeature($this);
1873: }
1874:
1875:
1876: return $this;
1877: }
1878:
1879:
1880: 1881: 1882: 1883: 1884: 1885: 1886: 1887:
1888: public function getOrganism(PropelPDO $con = null, $doQuery = true)
1889: {
1890: if ($this->aOrganism === null && ($this->organism_id !== null) && $doQuery) {
1891: $this->aOrganism = OrganismQuery::create()->findPk($this->organism_id, $con);
1892: 1893: 1894: 1895: 1896: 1897: 1898:
1899: }
1900:
1901: return $this->aOrganism;
1902: }
1903:
1904: 1905: 1906: 1907: 1908: 1909: 1910:
1911: public function setCvterm(Cvterm $v = null)
1912: {
1913: if ($v === null) {
1914: $this->setTypeId(NULL);
1915: } else {
1916: $this->setTypeId($v->getCvtermId());
1917: }
1918:
1919: $this->aCvterm = $v;
1920:
1921:
1922:
1923: if ($v !== null) {
1924: $v->addFeature($this);
1925: }
1926:
1927:
1928: return $this;
1929: }
1930:
1931:
1932: 1933: 1934: 1935: 1936: 1937: 1938: 1939:
1940: public function getCvterm(PropelPDO $con = null, $doQuery = true)
1941: {
1942: if ($this->aCvterm === null && ($this->type_id !== null) && $doQuery) {
1943: $this->aCvterm = CvtermQuery::create()->findPk($this->type_id, $con);
1944: 1945: 1946: 1947: 1948: 1949: 1950:
1951: }
1952:
1953: return $this->aCvterm;
1954: }
1955:
1956:
1957: 1958: 1959: 1960: 1961: 1962: 1963: 1964:
1965: public function initRelation($relationName)
1966: {
1967: if ('FeatureCvterm' == $relationName) {
1968: $this->initFeatureCvterms();
1969: }
1970: if ('FeatureDbxref' == $relationName) {
1971: $this->initFeatureDbxrefs();
1972: }
1973: if ('FeaturePub' == $relationName) {
1974: $this->initFeaturePubs();
1975: }
1976: if ('FeatureSynonym' == $relationName) {
1977: $this->initFeatureSynonyms();
1978: }
1979: }
1980:
1981: 1982: 1983: 1984: 1985: 1986: 1987: 1988: 1989:
1990: public function clearFeatureCvterms()
1991: {
1992: $this->collFeatureCvterms = null;
1993: $this->collFeatureCvtermsPartial = null;
1994:
1995: return $this;
1996: }
1997:
1998: 1999: 2000: 2001: 2002:
2003: public function resetPartialFeatureCvterms($v = true)
2004: {
2005: $this->collFeatureCvtermsPartial = $v;
2006: }
2007:
2008: 2009: 2010: 2011: 2012: 2013: 2014: 2015: 2016: 2017: 2018: 2019:
2020: public function initFeatureCvterms($overrideExisting = true)
2021: {
2022: if (null !== $this->collFeatureCvterms && !$overrideExisting) {
2023: return;
2024: }
2025: $this->collFeatureCvterms = new PropelObjectCollection();
2026: $this->collFeatureCvterms->setModel('FeatureCvterm');
2027: }
2028:
2029: 2030: 2031: 2032: 2033: 2034: 2035: 2036: 2037: 2038: 2039: 2040: 2041: 2042:
2043: public function getFeatureCvterms($criteria = null, PropelPDO $con = null)
2044: {
2045: $partial = $this->collFeatureCvtermsPartial && !$this->isNew();
2046: if (null === $this->collFeatureCvterms || null !== $criteria || $partial) {
2047: if ($this->isNew() && null === $this->collFeatureCvterms) {
2048:
2049: $this->initFeatureCvterms();
2050: } else {
2051: $collFeatureCvterms = FeatureCvtermQuery::create(null, $criteria)
2052: ->filterByFeature($this)
2053: ->find($con);
2054: if (null !== $criteria) {
2055: if (false !== $this->collFeatureCvtermsPartial && count($collFeatureCvterms)) {
2056: $this->initFeatureCvterms(false);
2057:
2058: foreach($collFeatureCvterms as $obj) {
2059: if (false == $this->collFeatureCvterms->contains($obj)) {
2060: $this->collFeatureCvterms->append($obj);
2061: }
2062: }
2063:
2064: $this->collFeatureCvtermsPartial = true;
2065: }
2066:
2067: $collFeatureCvterms->getInternalIterator()->rewind();
2068: return $collFeatureCvterms;
2069: }
2070:
2071: if($partial && $this->collFeatureCvterms) {
2072: foreach($this->collFeatureCvterms as $obj) {
2073: if($obj->isNew()) {
2074: $collFeatureCvterms[] = $obj;
2075: }
2076: }
2077: }
2078:
2079: $this->collFeatureCvterms = $collFeatureCvterms;
2080: $this->collFeatureCvtermsPartial = false;
2081: }
2082: }
2083:
2084: return $this->collFeatureCvterms;
2085: }
2086:
2087: 2088: 2089: 2090: 2091: 2092: 2093: 2094: 2095: 2096:
2097: public function setFeatureCvterms(PropelCollection $featureCvterms, PropelPDO $con = null)
2098: {
2099: $featureCvtermsToDelete = $this->getFeatureCvterms(new Criteria(), $con)->diff($featureCvterms);
2100:
2101: $this->featureCvtermsScheduledForDeletion = unserialize(serialize($featureCvtermsToDelete));
2102:
2103: foreach ($featureCvtermsToDelete as $featureCvtermRemoved) {
2104: $featureCvtermRemoved->setFeature(null);
2105: }
2106:
2107: $this->collFeatureCvterms = null;
2108: foreach ($featureCvterms as $featureCvterm) {
2109: $this->addFeatureCvterm($featureCvterm);
2110: }
2111:
2112: $this->collFeatureCvterms = $featureCvterms;
2113: $this->collFeatureCvtermsPartial = false;
2114:
2115: return $this;
2116: }
2117:
2118: 2119: 2120: 2121: 2122: 2123: 2124: 2125: 2126:
2127: public function countFeatureCvterms(Criteria $criteria = null, $distinct = false, PropelPDO $con = null)
2128: {
2129: $partial = $this->collFeatureCvtermsPartial && !$this->isNew();
2130: if (null === $this->collFeatureCvterms || null !== $criteria || $partial) {
2131: if ($this->isNew() && null === $this->collFeatureCvterms) {
2132: return 0;
2133: }
2134:
2135: if($partial && !$criteria) {
2136: return count($this->getFeatureCvterms());
2137: }
2138: $query = FeatureCvtermQuery::create(null, $criteria);
2139: if ($distinct) {
2140: $query->distinct();
2141: }
2142:
2143: return $query
2144: ->filterByFeature($this)
2145: ->count($con);
2146: }
2147:
2148: return count($this->collFeatureCvterms);
2149: }
2150:
2151: 2152: 2153: 2154: 2155: 2156: 2157:
2158: public function addFeatureCvterm(FeatureCvterm $l)
2159: {
2160: if ($this->collFeatureCvterms === null) {
2161: $this->initFeatureCvterms();
2162: $this->collFeatureCvtermsPartial = true;
2163: }
2164: if (!in_array($l, $this->collFeatureCvterms->getArrayCopy(), true)) {
2165: $this->doAddFeatureCvterm($l);
2166: }
2167:
2168: return $this;
2169: }
2170:
2171: 2172: 2173:
2174: protected function doAddFeatureCvterm($featureCvterm)
2175: {
2176: $this->collFeatureCvterms[]= $featureCvterm;
2177: $featureCvterm->setFeature($this);
2178: }
2179:
2180: 2181: 2182: 2183:
2184: public function removeFeatureCvterm($featureCvterm)
2185: {
2186: if ($this->getFeatureCvterms()->contains($featureCvterm)) {
2187: $this->collFeatureCvterms->remove($this->collFeatureCvterms->search($featureCvterm));
2188: if (null === $this->featureCvtermsScheduledForDeletion) {
2189: $this->featureCvtermsScheduledForDeletion = clone $this->collFeatureCvterms;
2190: $this->featureCvtermsScheduledForDeletion->clear();
2191: }
2192: $this->featureCvtermsScheduledForDeletion[]= clone $featureCvterm;
2193: $featureCvterm->setFeature(null);
2194: }
2195:
2196: return $this;
2197: }
2198:
2199:
2200: 2201: 2202: 2203: 2204: 2205: 2206: 2207: 2208: 2209: 2210: 2211: 2212: 2213: 2214: 2215:
2216: public function getFeatureCvtermsJoinCvterm($criteria = null, $con = null, $join_behavior = Criteria::LEFT_JOIN)
2217: {
2218: $query = FeatureCvtermQuery::create(null, $criteria);
2219: $query->joinWith('Cvterm', $join_behavior);
2220:
2221: return $this->getFeatureCvterms($query, $con);
2222: }
2223:
2224:
2225: 2226: 2227: 2228: 2229: 2230: 2231: 2232: 2233: 2234: 2235: 2236: 2237: 2238: 2239: 2240:
2241: public function getFeatureCvtermsJoinPub($criteria = null, $con = null, $join_behavior = Criteria::LEFT_JOIN)
2242: {
2243: $query = FeatureCvtermQuery::create(null, $criteria);
2244: $query->joinWith('Pub', $join_behavior);
2245:
2246: return $this->getFeatureCvterms($query, $con);
2247: }
2248:
2249: 2250: 2251: 2252: 2253: 2254: 2255: 2256: 2257:
2258: public function clearFeatureDbxrefs()
2259: {
2260: $this->collFeatureDbxrefs = null;
2261: $this->collFeatureDbxrefsPartial = null;
2262:
2263: return $this;
2264: }
2265:
2266: 2267: 2268: 2269: 2270:
2271: public function resetPartialFeatureDbxrefs($v = true)
2272: {
2273: $this->collFeatureDbxrefsPartial = $v;
2274: }
2275:
2276: 2277: 2278: 2279: 2280: 2281: 2282: 2283: 2284: 2285: 2286: 2287:
2288: public function initFeatureDbxrefs($overrideExisting = true)
2289: {
2290: if (null !== $this->collFeatureDbxrefs && !$overrideExisting) {
2291: return;
2292: }
2293: $this->collFeatureDbxrefs = new PropelObjectCollection();
2294: $this->collFeatureDbxrefs->setModel('FeatureDbxref');
2295: }
2296:
2297: 2298: 2299: 2300: 2301: 2302: 2303: 2304: 2305: 2306: 2307: 2308: 2309: 2310:
2311: public function getFeatureDbxrefs($criteria = null, PropelPDO $con = null)
2312: {
2313: $partial = $this->collFeatureDbxrefsPartial && !$this->isNew();
2314: if (null === $this->collFeatureDbxrefs || null !== $criteria || $partial) {
2315: if ($this->isNew() && null === $this->collFeatureDbxrefs) {
2316:
2317: $this->initFeatureDbxrefs();
2318: } else {
2319: $collFeatureDbxrefs = FeatureDbxrefQuery::create(null, $criteria)
2320: ->filterByFeature($this)
2321: ->find($con);
2322: if (null !== $criteria) {
2323: if (false !== $this->collFeatureDbxrefsPartial && count($collFeatureDbxrefs)) {
2324: $this->initFeatureDbxrefs(false);
2325:
2326: foreach($collFeatureDbxrefs as $obj) {
2327: if (false == $this->collFeatureDbxrefs->contains($obj)) {
2328: $this->collFeatureDbxrefs->append($obj);
2329: }
2330: }
2331:
2332: $this->collFeatureDbxrefsPartial = true;
2333: }
2334:
2335: $collFeatureDbxrefs->getInternalIterator()->rewind();
2336: return $collFeatureDbxrefs;
2337: }
2338:
2339: if($partial && $this->collFeatureDbxrefs) {
2340: foreach($this->collFeatureDbxrefs as $obj) {
2341: if($obj->isNew()) {
2342: $collFeatureDbxrefs[] = $obj;
2343: }
2344: }
2345: }
2346:
2347: $this->collFeatureDbxrefs = $collFeatureDbxrefs;
2348: $this->collFeatureDbxrefsPartial = false;
2349: }
2350: }
2351:
2352: return $this->collFeatureDbxrefs;
2353: }
2354:
2355: 2356: 2357: 2358: 2359: 2360: 2361: 2362: 2363: 2364:
2365: public function setFeatureDbxrefs(PropelCollection $featureDbxrefs, PropelPDO $con = null)
2366: {
2367: $featureDbxrefsToDelete = $this->getFeatureDbxrefs(new Criteria(), $con)->diff($featureDbxrefs);
2368:
2369: $this->featureDbxrefsScheduledForDeletion = unserialize(serialize($featureDbxrefsToDelete));
2370:
2371: foreach ($featureDbxrefsToDelete as $featureDbxrefRemoved) {
2372: $featureDbxrefRemoved->setFeature(null);
2373: }
2374:
2375: $this->collFeatureDbxrefs = null;
2376: foreach ($featureDbxrefs as $featureDbxref) {
2377: $this->addFeatureDbxref($featureDbxref);
2378: }
2379:
2380: $this->collFeatureDbxrefs = $featureDbxrefs;
2381: $this->collFeatureDbxrefsPartial = false;
2382:
2383: return $this;
2384: }
2385:
2386: 2387: 2388: 2389: 2390: 2391: 2392: 2393: 2394:
2395: public function countFeatureDbxrefs(Criteria $criteria = null, $distinct = false, PropelPDO $con = null)
2396: {
2397: $partial = $this->collFeatureDbxrefsPartial && !$this->isNew();
2398: if (null === $this->collFeatureDbxrefs || null !== $criteria || $partial) {
2399: if ($this->isNew() && null === $this->collFeatureDbxrefs) {
2400: return 0;
2401: }
2402:
2403: if($partial && !$criteria) {
2404: return count($this->getFeatureDbxrefs());
2405: }
2406: $query = FeatureDbxrefQuery::create(null, $criteria);
2407: if ($distinct) {
2408: $query->distinct();
2409: }
2410:
2411: return $query
2412: ->filterByFeature($this)
2413: ->count($con);
2414: }
2415:
2416: return count($this->collFeatureDbxrefs);
2417: }
2418:
2419: 2420: 2421: 2422: 2423: 2424: 2425:
2426: public function addFeatureDbxref(FeatureDbxref $l)
2427: {
2428: if ($this->collFeatureDbxrefs === null) {
2429: $this->initFeatureDbxrefs();
2430: $this->collFeatureDbxrefsPartial = true;
2431: }
2432: if (!in_array($l, $this->collFeatureDbxrefs->getArrayCopy(), true)) {
2433: $this->doAddFeatureDbxref($l);
2434: }
2435:
2436: return $this;
2437: }
2438:
2439: 2440: 2441:
2442: protected function doAddFeatureDbxref($featureDbxref)
2443: {
2444: $this->collFeatureDbxrefs[]= $featureDbxref;
2445: $featureDbxref->setFeature($this);
2446: }
2447:
2448: 2449: 2450: 2451:
2452: public function removeFeatureDbxref($featureDbxref)
2453: {
2454: if ($this->getFeatureDbxrefs()->contains($featureDbxref)) {
2455: $this->collFeatureDbxrefs->remove($this->collFeatureDbxrefs->search($featureDbxref));
2456: if (null === $this->featureDbxrefsScheduledForDeletion) {
2457: $this->featureDbxrefsScheduledForDeletion = clone $this->collFeatureDbxrefs;
2458: $this->featureDbxrefsScheduledForDeletion->clear();
2459: }
2460: $this->featureDbxrefsScheduledForDeletion[]= clone $featureDbxref;
2461: $featureDbxref->setFeature(null);
2462: }
2463:
2464: return $this;
2465: }
2466:
2467:
2468: 2469: 2470: 2471: 2472: 2473: 2474: 2475: 2476: 2477: 2478: 2479: 2480: 2481: 2482: 2483:
2484: public function getFeatureDbxrefsJoinDbxref($criteria = null, $con = null, $join_behavior = Criteria::LEFT_JOIN)
2485: {
2486: $query = FeatureDbxrefQuery::create(null, $criteria);
2487: $query->joinWith('Dbxref', $join_behavior);
2488:
2489: return $this->getFeatureDbxrefs($query, $con);
2490: }
2491:
2492: 2493: 2494: 2495: 2496: 2497: 2498: 2499: 2500:
2501: public function clearFeaturePubs()
2502: {
2503: $this->collFeaturePubs = null;
2504: $this->collFeaturePubsPartial = null;
2505:
2506: return $this;
2507: }
2508:
2509: 2510: 2511: 2512: 2513:
2514: public function resetPartialFeaturePubs($v = true)
2515: {
2516: $this->collFeaturePubsPartial = $v;
2517: }
2518:
2519: 2520: 2521: 2522: 2523: 2524: 2525: 2526: 2527: 2528: 2529: 2530:
2531: public function initFeaturePubs($overrideExisting = true)
2532: {
2533: if (null !== $this->collFeaturePubs && !$overrideExisting) {
2534: return;
2535: }
2536: $this->collFeaturePubs = new PropelObjectCollection();
2537: $this->collFeaturePubs->setModel('FeaturePub');
2538: }
2539:
2540: 2541: 2542: 2543: 2544: 2545: 2546: 2547: 2548: 2549: 2550: 2551: 2552: 2553:
2554: public function getFeaturePubs($criteria = null, PropelPDO $con = null)
2555: {
2556: $partial = $this->collFeaturePubsPartial && !$this->isNew();
2557: if (null === $this->collFeaturePubs || null !== $criteria || $partial) {
2558: if ($this->isNew() && null === $this->collFeaturePubs) {
2559:
2560: $this->initFeaturePubs();
2561: } else {
2562: $collFeaturePubs = FeaturePubQuery::create(null, $criteria)
2563: ->filterByFeature($this)
2564: ->find($con);
2565: if (null !== $criteria) {
2566: if (false !== $this->collFeaturePubsPartial && count($collFeaturePubs)) {
2567: $this->initFeaturePubs(false);
2568:
2569: foreach($collFeaturePubs as $obj) {
2570: if (false == $this->collFeaturePubs->contains($obj)) {
2571: $this->collFeaturePubs->append($obj);
2572: }
2573: }
2574:
2575: $this->collFeaturePubsPartial = true;
2576: }
2577:
2578: $collFeaturePubs->getInternalIterator()->rewind();
2579: return $collFeaturePubs;
2580: }
2581:
2582: if($partial && $this->collFeaturePubs) {
2583: foreach($this->collFeaturePubs as $obj) {
2584: if($obj->isNew()) {
2585: $collFeaturePubs[] = $obj;
2586: }
2587: }
2588: }
2589:
2590: $this->collFeaturePubs = $collFeaturePubs;
2591: $this->collFeaturePubsPartial = false;
2592: }
2593: }
2594:
2595: return $this->collFeaturePubs;
2596: }
2597:
2598: 2599: 2600: 2601: 2602: 2603: 2604: 2605: 2606: 2607:
2608: public function setFeaturePubs(PropelCollection $featurePubs, PropelPDO $con = null)
2609: {
2610: $featurePubsToDelete = $this->getFeaturePubs(new Criteria(), $con)->diff($featurePubs);
2611:
2612: $this->featurePubsScheduledForDeletion = unserialize(serialize($featurePubsToDelete));
2613:
2614: foreach ($featurePubsToDelete as $featurePubRemoved) {
2615: $featurePubRemoved->setFeature(null);
2616: }
2617:
2618: $this->collFeaturePubs = null;
2619: foreach ($featurePubs as $featurePub) {
2620: $this->addFeaturePub($featurePub);
2621: }
2622:
2623: $this->collFeaturePubs = $featurePubs;
2624: $this->collFeaturePubsPartial = false;
2625:
2626: return $this;
2627: }
2628:
2629: 2630: 2631: 2632: 2633: 2634: 2635: 2636: 2637:
2638: public function countFeaturePubs(Criteria $criteria = null, $distinct = false, PropelPDO $con = null)
2639: {
2640: $partial = $this->collFeaturePubsPartial && !$this->isNew();
2641: if (null === $this->collFeaturePubs || null !== $criteria || $partial) {
2642: if ($this->isNew() && null === $this->collFeaturePubs) {
2643: return 0;
2644: }
2645:
2646: if($partial && !$criteria) {
2647: return count($this->getFeaturePubs());
2648: }
2649: $query = FeaturePubQuery::create(null, $criteria);
2650: if ($distinct) {
2651: $query->distinct();
2652: }
2653:
2654: return $query
2655: ->filterByFeature($this)
2656: ->count($con);
2657: }
2658:
2659: return count($this->collFeaturePubs);
2660: }
2661:
2662: 2663: 2664: 2665: 2666: 2667: 2668:
2669: public function addFeaturePub(FeaturePub $l)
2670: {
2671: if ($this->collFeaturePubs === null) {
2672: $this->initFeaturePubs();
2673: $this->collFeaturePubsPartial = true;
2674: }
2675: if (!in_array($l, $this->collFeaturePubs->getArrayCopy(), true)) {
2676: $this->doAddFeaturePub($l);
2677: }
2678:
2679: return $this;
2680: }
2681:
2682: 2683: 2684:
2685: protected function doAddFeaturePub($featurePub)
2686: {
2687: $this->collFeaturePubs[]= $featurePub;
2688: $featurePub->setFeature($this);
2689: }
2690:
2691: 2692: 2693: 2694:
2695: public function removeFeaturePub($featurePub)
2696: {
2697: if ($this->getFeaturePubs()->contains($featurePub)) {
2698: $this->collFeaturePubs->remove($this->collFeaturePubs->search($featurePub));
2699: if (null === $this->featurePubsScheduledForDeletion) {
2700: $this->featurePubsScheduledForDeletion = clone $this->collFeaturePubs;
2701: $this->featurePubsScheduledForDeletion->clear();
2702: }
2703: $this->featurePubsScheduledForDeletion[]= clone $featurePub;
2704: $featurePub->setFeature(null);
2705: }
2706:
2707: return $this;
2708: }
2709:
2710:
2711: 2712: 2713: 2714: 2715: 2716: 2717: 2718: 2719: 2720: 2721: 2722: 2723: 2724: 2725: 2726:
2727: public function getFeaturePubsJoinPub($criteria = null, $con = null, $join_behavior = Criteria::LEFT_JOIN)
2728: {
2729: $query = FeaturePubQuery::create(null, $criteria);
2730: $query->joinWith('Pub', $join_behavior);
2731:
2732: return $this->getFeaturePubs($query, $con);
2733: }
2734:
2735: 2736: 2737: 2738: 2739: 2740: 2741: 2742: 2743:
2744: public function clearFeatureSynonyms()
2745: {
2746: $this->collFeatureSynonyms = null;
2747: $this->collFeatureSynonymsPartial = null;
2748:
2749: return $this;
2750: }
2751:
2752: 2753: 2754: 2755: 2756:
2757: public function resetPartialFeatureSynonyms($v = true)
2758: {
2759: $this->collFeatureSynonymsPartial = $v;
2760: }
2761:
2762: 2763: 2764: 2765: 2766: 2767: 2768: 2769: 2770: 2771: 2772: 2773:
2774: public function initFeatureSynonyms($overrideExisting = true)
2775: {
2776: if (null !== $this->collFeatureSynonyms && !$overrideExisting) {
2777: return;
2778: }
2779: $this->collFeatureSynonyms = new PropelObjectCollection();
2780: $this->collFeatureSynonyms->setModel('FeatureSynonym');
2781: }
2782:
2783: 2784: 2785: 2786: 2787: 2788: 2789: 2790: 2791: 2792: 2793: 2794: 2795: 2796:
2797: public function getFeatureSynonyms($criteria = null, PropelPDO $con = null)
2798: {
2799: $partial = $this->collFeatureSynonymsPartial && !$this->isNew();
2800: if (null === $this->collFeatureSynonyms || null !== $criteria || $partial) {
2801: if ($this->isNew() && null === $this->collFeatureSynonyms) {
2802:
2803: $this->initFeatureSynonyms();
2804: } else {
2805: $collFeatureSynonyms = FeatureSynonymQuery::create(null, $criteria)
2806: ->filterByFeature($this)
2807: ->find($con);
2808: if (null !== $criteria) {
2809: if (false !== $this->collFeatureSynonymsPartial && count($collFeatureSynonyms)) {
2810: $this->initFeatureSynonyms(false);
2811:
2812: foreach($collFeatureSynonyms as $obj) {
2813: if (false == $this->collFeatureSynonyms->contains($obj)) {
2814: $this->collFeatureSynonyms->append($obj);
2815: }
2816: }
2817:
2818: $this->collFeatureSynonymsPartial = true;
2819: }
2820:
2821: $collFeatureSynonyms->getInternalIterator()->rewind();
2822: return $collFeatureSynonyms;
2823: }
2824:
2825: if($partial && $this->collFeatureSynonyms) {
2826: foreach($this->collFeatureSynonyms as $obj) {
2827: if($obj->isNew()) {
2828: $collFeatureSynonyms[] = $obj;
2829: }
2830: }
2831: }
2832:
2833: $this->collFeatureSynonyms = $collFeatureSynonyms;
2834: $this->collFeatureSynonymsPartial = false;
2835: }
2836: }
2837:
2838: return $this->collFeatureSynonyms;
2839: }
2840:
2841: 2842: 2843: 2844: 2845: 2846: 2847: 2848: 2849: 2850:
2851: public function setFeatureSynonyms(PropelCollection $featureSynonyms, PropelPDO $con = null)
2852: {
2853: $featureSynonymsToDelete = $this->getFeatureSynonyms(new Criteria(), $con)->diff($featureSynonyms);
2854:
2855: $this->featureSynonymsScheduledForDeletion = unserialize(serialize($featureSynonymsToDelete));
2856:
2857: foreach ($featureSynonymsToDelete as $featureSynonymRemoved) {
2858: $featureSynonymRemoved->setFeature(null);
2859: }
2860:
2861: $this->collFeatureSynonyms = null;
2862: foreach ($featureSynonyms as $featureSynonym) {
2863: $this->addFeatureSynonym($featureSynonym);
2864: }
2865:
2866: $this->collFeatureSynonyms = $featureSynonyms;
2867: $this->collFeatureSynonymsPartial = false;
2868:
2869: return $this;
2870: }
2871:
2872: 2873: 2874: 2875: 2876: 2877: 2878: 2879: 2880:
2881: public function countFeatureSynonyms(Criteria $criteria = null, $distinct = false, PropelPDO $con = null)
2882: {
2883: $partial = $this->collFeatureSynonymsPartial && !$this->isNew();
2884: if (null === $this->collFeatureSynonyms || null !== $criteria || $partial) {
2885: if ($this->isNew() && null === $this->collFeatureSynonyms) {
2886: return 0;
2887: }
2888:
2889: if($partial && !$criteria) {
2890: return count($this->getFeatureSynonyms());
2891: }
2892: $query = FeatureSynonymQuery::create(null, $criteria);
2893: if ($distinct) {
2894: $query->distinct();
2895: }
2896:
2897: return $query
2898: ->filterByFeature($this)
2899: ->count($con);
2900: }
2901:
2902: return count($this->collFeatureSynonyms);
2903: }
2904:
2905: 2906: 2907: 2908: 2909: 2910: 2911:
2912: public function addFeatureSynonym(FeatureSynonym $l)
2913: {
2914: if ($this->collFeatureSynonyms === null) {
2915: $this->initFeatureSynonyms();
2916: $this->collFeatureSynonymsPartial = true;
2917: }
2918: if (!in_array($l, $this->collFeatureSynonyms->getArrayCopy(), true)) {
2919: $this->doAddFeatureSynonym($l);
2920: }
2921:
2922: return $this;
2923: }
2924:
2925: 2926: 2927:
2928: protected function doAddFeatureSynonym($featureSynonym)
2929: {
2930: $this->collFeatureSynonyms[]= $featureSynonym;
2931: $featureSynonym->setFeature($this);
2932: }
2933:
2934: 2935: 2936: 2937:
2938: public function removeFeatureSynonym($featureSynonym)
2939: {
2940: if ($this->getFeatureSynonyms()->contains($featureSynonym)) {
2941: $this->collFeatureSynonyms->remove($this->collFeatureSynonyms->search($featureSynonym));
2942: if (null === $this->featureSynonymsScheduledForDeletion) {
2943: $this->featureSynonymsScheduledForDeletion = clone $this->collFeatureSynonyms;
2944: $this->featureSynonymsScheduledForDeletion->clear();
2945: }
2946: $this->featureSynonymsScheduledForDeletion[]= clone $featureSynonym;
2947: $featureSynonym->setFeature(null);
2948: }
2949:
2950: return $this;
2951: }
2952:
2953:
2954: 2955: 2956: 2957: 2958: 2959: 2960: 2961: 2962: 2963: 2964: 2965: 2966: 2967: 2968: 2969:
2970: public function getFeatureSynonymsJoinPub($criteria = null, $con = null, $join_behavior = Criteria::LEFT_JOIN)
2971: {
2972: $query = FeatureSynonymQuery::create(null, $criteria);
2973: $query->joinWith('Pub', $join_behavior);
2974:
2975: return $this->getFeatureSynonyms($query, $con);
2976: }
2977:
2978:
2979: 2980: 2981: 2982: 2983: 2984: 2985: 2986: 2987: 2988: 2989: 2990: 2991: 2992: 2993: 2994:
2995: public function getFeatureSynonymsJoinSynonym($criteria = null, $con = null, $join_behavior = Criteria::LEFT_JOIN)
2996: {
2997: $query = FeatureSynonymQuery::create(null, $criteria);
2998: $query->joinWith('Synonym', $join_behavior);
2999:
3000: return $this->getFeatureSynonyms($query, $con);
3001: }
3002:
3003: 3004: 3005:
3006: public function clear()
3007: {
3008: $this->feature_id = null;
3009: $this->dbxref_id = null;
3010: $this->organism_id = null;
3011: $this->name = null;
3012: $this->uniquename = null;
3013: $this->residues = null;
3014: $this->seqlen = null;
3015: $this->md5checksum = null;
3016: $this->type_id = null;
3017: $this->is_analysis = null;
3018: $this->is_obsolete = null;
3019: $this->timeaccessioned = null;
3020: $this->timelastmodified = null;
3021: $this->alreadyInSave = false;
3022: $this->alreadyInValidation = false;
3023: $this->alreadyInClearAllReferencesDeep = false;
3024: $this->clearAllReferences();
3025: $this->applyDefaultValues();
3026: $this->resetModified();
3027: $this->setNew(true);
3028: $this->setDeleted(false);
3029: }
3030:
3031: 3032: 3033: 3034: 3035: 3036: 3037: 3038: 3039:
3040: public function clearAllReferences($deep = false)
3041: {
3042: if ($deep && !$this->alreadyInClearAllReferencesDeep) {
3043: $this->alreadyInClearAllReferencesDeep = true;
3044: if ($this->collFeatureCvterms) {
3045: foreach ($this->collFeatureCvterms as $o) {
3046: $o->clearAllReferences($deep);
3047: }
3048: }
3049: if ($this->collFeatureDbxrefs) {
3050: foreach ($this->collFeatureDbxrefs as $o) {
3051: $o->clearAllReferences($deep);
3052: }
3053: }
3054: if ($this->collFeaturePubs) {
3055: foreach ($this->collFeaturePubs as $o) {
3056: $o->clearAllReferences($deep);
3057: }
3058: }
3059: if ($this->collFeatureSynonyms) {
3060: foreach ($this->collFeatureSynonyms as $o) {
3061: $o->clearAllReferences($deep);
3062: }
3063: }
3064: if ($this->aDbxref instanceof Persistent) {
3065: $this->aDbxref->clearAllReferences($deep);
3066: }
3067: if ($this->aOrganism instanceof Persistent) {
3068: $this->aOrganism->clearAllReferences($deep);
3069: }
3070: if ($this->aCvterm instanceof Persistent) {
3071: $this->aCvterm->clearAllReferences($deep);
3072: }
3073:
3074: $this->alreadyInClearAllReferencesDeep = false;
3075: }
3076:
3077: if ($this->collFeatureCvterms instanceof PropelCollection) {
3078: $this->collFeatureCvterms->clearIterator();
3079: }
3080: $this->collFeatureCvterms = null;
3081: if ($this->collFeatureDbxrefs instanceof PropelCollection) {
3082: $this->collFeatureDbxrefs->clearIterator();
3083: }
3084: $this->collFeatureDbxrefs = null;
3085: if ($this->collFeaturePubs instanceof PropelCollection) {
3086: $this->collFeaturePubs->clearIterator();
3087: }
3088: $this->collFeaturePubs = null;
3089: if ($this->collFeatureSynonyms instanceof PropelCollection) {
3090: $this->collFeatureSynonyms->clearIterator();
3091: }
3092: $this->collFeatureSynonyms = null;
3093: $this->aDbxref = null;
3094: $this->aOrganism = null;
3095: $this->aCvterm = null;
3096: }
3097:
3098: 3099: 3100: 3101: 3102:
3103: public function __toString()
3104: {
3105: return (string) $this->exportTo(FeaturePeer::DEFAULT_STRING_FORMAT);
3106: }
3107:
3108: 3109: 3110: 3111: 3112:
3113: public function isAlreadyInSave()
3114: {
3115: return $this->alreadyInSave;
3116: }
3117:
3118: }
3119: