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\AssayBiomaterial;
17: use cli_db\propel\AssayBiomaterialQuery;
18: use cli_db\propel\Biomaterial;
19: use cli_db\propel\BiomaterialPeer;
20: use cli_db\propel\BiomaterialQuery;
21: use cli_db\propel\BiomaterialRelationship;
22: use cli_db\propel\BiomaterialRelationshipQuery;
23: use cli_db\propel\Biomaterialprop;
24: use cli_db\propel\BiomaterialpropQuery;
25: use cli_db\propel\Contact;
26: use cli_db\propel\ContactQuery;
27: use cli_db\propel\Organism;
28: use cli_db\propel\OrganismQuery;
29:
30: 31: 32: 33: 34: 35: 36:
37: abstract class BaseBiomaterial extends BaseObject implements Persistent
38: {
39: 40: 41:
42: const PEER = 'cli_db\\propel\\BiomaterialPeer';
43:
44: 45: 46: 47: 48: 49:
50: protected static $peer;
51:
52: 53: 54: 55:
56: protected $startCopy = false;
57:
58: 59: 60: 61:
62: protected $biomaterial_id;
63:
64: 65: 66: 67:
68: protected $taxon_id;
69:
70: 71: 72: 73:
74: protected $biosourceprovider_id;
75:
76: 77: 78: 79:
80: protected $dbxref_id;
81:
82: 83: 84: 85:
86: protected $name;
87:
88: 89: 90: 91:
92: protected $description;
93:
94: 95: 96:
97: protected $aContact;
98:
99: 100: 101:
102: protected $aOrganism;
103:
104: 105: 106:
107: protected $collAssayBiomaterials;
108: protected $collAssayBiomaterialsPartial;
109:
110: 111: 112:
113: protected $collBiomaterialRelationshipsRelatedByObjectId;
114: protected $collBiomaterialRelationshipsRelatedByObjectIdPartial;
115:
116: 117: 118:
119: protected $collBiomaterialRelationshipsRelatedBySubjectId;
120: protected $collBiomaterialRelationshipsRelatedBySubjectIdPartial;
121:
122: 123: 124:
125: protected $collBiomaterialprops;
126: protected $collBiomaterialpropsPartial;
127:
128: 129: 130: 131: 132:
133: protected $alreadyInSave = false;
134:
135: 136: 137: 138: 139:
140: protected $alreadyInValidation = false;
141:
142: 143: 144: 145:
146: protected $alreadyInClearAllReferencesDeep = false;
147:
148: 149: 150: 151:
152: protected $assayBiomaterialsScheduledForDeletion = null;
153:
154: 155: 156: 157:
158: protected $biomaterialRelationshipsRelatedByObjectIdScheduledForDeletion = null;
159:
160: 161: 162: 163:
164: protected $biomaterialRelationshipsRelatedBySubjectIdScheduledForDeletion = null;
165:
166: 167: 168: 169:
170: protected $biomaterialpropsScheduledForDeletion = null;
171:
172: 173: 174: 175: 176:
177: public function getBiomaterialId()
178: {
179: return $this->biomaterial_id;
180: }
181:
182: 183: 184: 185: 186:
187: public function getTaxonId()
188: {
189: return $this->taxon_id;
190: }
191:
192: 193: 194: 195: 196:
197: public function getBiosourceproviderId()
198: {
199: return $this->biosourceprovider_id;
200: }
201:
202: 203: 204: 205: 206:
207: public function getDbxrefId()
208: {
209: return $this->dbxref_id;
210: }
211:
212: 213: 214: 215: 216:
217: public function getName()
218: {
219: return $this->name;
220: }
221:
222: 223: 224: 225: 226:
227: public function getDescription()
228: {
229: return $this->description;
230: }
231:
232: 233: 234: 235: 236: 237:
238: public function setBiomaterialId($v)
239: {
240: if ($v !== null && is_numeric($v)) {
241: $v = (int) $v;
242: }
243:
244: if ($this->biomaterial_id !== $v) {
245: $this->biomaterial_id = $v;
246: $this->modifiedColumns[] = BiomaterialPeer::BIOMATERIAL_ID;
247: }
248:
249:
250: return $this;
251: }
252:
253: 254: 255: 256: 257: 258:
259: public function setTaxonId($v)
260: {
261: if ($v !== null && is_numeric($v)) {
262: $v = (int) $v;
263: }
264:
265: if ($this->taxon_id !== $v) {
266: $this->taxon_id = $v;
267: $this->modifiedColumns[] = BiomaterialPeer::TAXON_ID;
268: }
269:
270: if ($this->aOrganism !== null && $this->aOrganism->getOrganismId() !== $v) {
271: $this->aOrganism = null;
272: }
273:
274:
275: return $this;
276: }
277:
278: 279: 280: 281: 282: 283:
284: public function setBiosourceproviderId($v)
285: {
286: if ($v !== null && is_numeric($v)) {
287: $v = (int) $v;
288: }
289:
290: if ($this->biosourceprovider_id !== $v) {
291: $this->biosourceprovider_id = $v;
292: $this->modifiedColumns[] = BiomaterialPeer::BIOSOURCEPROVIDER_ID;
293: }
294:
295: if ($this->aContact !== null && $this->aContact->getContactId() !== $v) {
296: $this->aContact = null;
297: }
298:
299:
300: return $this;
301: }
302:
303: 304: 305: 306: 307: 308:
309: public function setDbxrefId($v)
310: {
311: if ($v !== null && is_numeric($v)) {
312: $v = (int) $v;
313: }
314:
315: if ($this->dbxref_id !== $v) {
316: $this->dbxref_id = $v;
317: $this->modifiedColumns[] = BiomaterialPeer::DBXREF_ID;
318: }
319:
320:
321: return $this;
322: }
323:
324: 325: 326: 327: 328: 329:
330: public function setName($v)
331: {
332: if ($v !== null && is_numeric($v)) {
333: $v = (string) $v;
334: }
335:
336: if ($this->name !== $v) {
337: $this->name = $v;
338: $this->modifiedColumns[] = BiomaterialPeer::NAME;
339: }
340:
341:
342: return $this;
343: }
344:
345: 346: 347: 348: 349: 350:
351: public function setDescription($v)
352: {
353: if ($v !== null && is_numeric($v)) {
354: $v = (string) $v;
355: }
356:
357: if ($this->description !== $v) {
358: $this->description = $v;
359: $this->modifiedColumns[] = BiomaterialPeer::DESCRIPTION;
360: }
361:
362:
363: return $this;
364: }
365:
366: 367: 368: 369: 370: 371: 372: 373:
374: public function hasOnlyDefaultValues()
375: {
376:
377: return true;
378: }
379:
380: 381: 382: 383: 384: 385: 386: 387: 388: 389: 390: 391: 392: 393:
394: public function hydrate($row, $startcol = 0, $rehydrate = false)
395: {
396: try {
397:
398: $this->biomaterial_id = ($row[$startcol + 0] !== null) ? (int) $row[$startcol + 0] : null;
399: $this->taxon_id = ($row[$startcol + 1] !== null) ? (int) $row[$startcol + 1] : null;
400: $this->biosourceprovider_id = ($row[$startcol + 2] !== null) ? (int) $row[$startcol + 2] : null;
401: $this->dbxref_id = ($row[$startcol + 3] !== null) ? (int) $row[$startcol + 3] : null;
402: $this->name = ($row[$startcol + 4] !== null) ? (string) $row[$startcol + 4] : null;
403: $this->description = ($row[$startcol + 5] !== null) ? (string) $row[$startcol + 5] : null;
404: $this->resetModified();
405:
406: $this->setNew(false);
407:
408: if ($rehydrate) {
409: $this->ensureConsistency();
410: }
411: $this->postHydrate($row, $startcol, $rehydrate);
412: return $startcol + 6;
413:
414: } catch (Exception $e) {
415: throw new PropelException("Error populating Biomaterial object", $e);
416: }
417: }
418:
419: 420: 421: 422: 423: 424: 425: 426: 427: 428: 429: 430: 431:
432: public function ensureConsistency()
433: {
434:
435: if ($this->aOrganism !== null && $this->taxon_id !== $this->aOrganism->getOrganismId()) {
436: $this->aOrganism = null;
437: }
438: if ($this->aContact !== null && $this->biosourceprovider_id !== $this->aContact->getContactId()) {
439: $this->aContact = null;
440: }
441: }
442:
443: 444: 445: 446: 447: 448: 449: 450: 451: 452:
453: public function reload($deep = false, PropelPDO $con = null)
454: {
455: if ($this->isDeleted()) {
456: throw new PropelException("Cannot reload a deleted object.");
457: }
458:
459: if ($this->isNew()) {
460: throw new PropelException("Cannot reload an unsaved object.");
461: }
462:
463: if ($con === null) {
464: $con = Propel::getConnection(BiomaterialPeer::DATABASE_NAME, Propel::CONNECTION_READ);
465: }
466:
467:
468:
469:
470: $stmt = BiomaterialPeer::doSelectStmt($this->buildPkeyCriteria(), $con);
471: $row = $stmt->fetch(PDO::FETCH_NUM);
472: $stmt->closeCursor();
473: if (!$row) {
474: throw new PropelException('Cannot find matching row in the database to reload object values.');
475: }
476: $this->hydrate($row, 0, true);
477:
478: if ($deep) {
479:
480: $this->aContact = null;
481: $this->aOrganism = null;
482: $this->collAssayBiomaterials = null;
483:
484: $this->collBiomaterialRelationshipsRelatedByObjectId = null;
485:
486: $this->collBiomaterialRelationshipsRelatedBySubjectId = null;
487:
488: $this->collBiomaterialprops = null;
489:
490: }
491: }
492:
493: 494: 495: 496: 497: 498: 499: 500: 501: 502:
503: public function delete(PropelPDO $con = null)
504: {
505: if ($this->isDeleted()) {
506: throw new PropelException("This object has already been deleted.");
507: }
508:
509: if ($con === null) {
510: $con = Propel::getConnection(BiomaterialPeer::DATABASE_NAME, Propel::CONNECTION_WRITE);
511: }
512:
513: $con->beginTransaction();
514: try {
515: $deleteQuery = BiomaterialQuery::create()
516: ->filterByPrimaryKey($this->getPrimaryKey());
517: $ret = $this->preDelete($con);
518: if ($ret) {
519: $deleteQuery->delete($con);
520: $this->postDelete($con);
521: $con->commit();
522: $this->setDeleted(true);
523: } else {
524: $con->commit();
525: }
526: } catch (Exception $e) {
527: $con->rollBack();
528: throw $e;
529: }
530: }
531:
532: 533: 534: 535: 536: 537: 538: 539: 540: 541: 542: 543: 544: 545:
546: public function save(PropelPDO $con = null)
547: {
548: if ($this->isDeleted()) {
549: throw new PropelException("You cannot save an object that has been deleted.");
550: }
551:
552: if ($con === null) {
553: $con = Propel::getConnection(BiomaterialPeer::DATABASE_NAME, Propel::CONNECTION_WRITE);
554: }
555:
556: $con->beginTransaction();
557: $isInsert = $this->isNew();
558: try {
559: $ret = $this->preSave($con);
560: if ($isInsert) {
561: $ret = $ret && $this->preInsert($con);
562: } else {
563: $ret = $ret && $this->preUpdate($con);
564: }
565: if ($ret) {
566: $affectedRows = $this->doSave($con);
567: if ($isInsert) {
568: $this->postInsert($con);
569: } else {
570: $this->postUpdate($con);
571: }
572: $this->postSave($con);
573: BiomaterialPeer::addInstanceToPool($this);
574: } else {
575: $affectedRows = 0;
576: }
577: $con->commit();
578:
579: return $affectedRows;
580: } catch (Exception $e) {
581: $con->rollBack();
582: throw $e;
583: }
584: }
585:
586: 587: 588: 589: 590: 591: 592: 593: 594: 595: 596:
597: protected function doSave(PropelPDO $con)
598: {
599: $affectedRows = 0;
600: if (!$this->alreadyInSave) {
601: $this->alreadyInSave = true;
602:
603:
604:
605:
606:
607:
608: if ($this->aContact !== null) {
609: if ($this->aContact->isModified() || $this->aContact->isNew()) {
610: $affectedRows += $this->aContact->save($con);
611: }
612: $this->setContact($this->aContact);
613: }
614:
615: if ($this->aOrganism !== null) {
616: if ($this->aOrganism->isModified() || $this->aOrganism->isNew()) {
617: $affectedRows += $this->aOrganism->save($con);
618: }
619: $this->setOrganism($this->aOrganism);
620: }
621:
622: if ($this->isNew() || $this->isModified()) {
623:
624: if ($this->isNew()) {
625: $this->doInsert($con);
626: } else {
627: $this->doUpdate($con);
628: }
629: $affectedRows += 1;
630: $this->resetModified();
631: }
632:
633: if ($this->assayBiomaterialsScheduledForDeletion !== null) {
634: if (!$this->assayBiomaterialsScheduledForDeletion->isEmpty()) {
635: AssayBiomaterialQuery::create()
636: ->filterByPrimaryKeys($this->assayBiomaterialsScheduledForDeletion->getPrimaryKeys(false))
637: ->delete($con);
638: $this->assayBiomaterialsScheduledForDeletion = null;
639: }
640: }
641:
642: if ($this->collAssayBiomaterials !== null) {
643: foreach ($this->collAssayBiomaterials as $referrerFK) {
644: if (!$referrerFK->isDeleted() && ($referrerFK->isNew() || $referrerFK->isModified())) {
645: $affectedRows += $referrerFK->save($con);
646: }
647: }
648: }
649:
650: if ($this->biomaterialRelationshipsRelatedByObjectIdScheduledForDeletion !== null) {
651: if (!$this->biomaterialRelationshipsRelatedByObjectIdScheduledForDeletion->isEmpty()) {
652: BiomaterialRelationshipQuery::create()
653: ->filterByPrimaryKeys($this->biomaterialRelationshipsRelatedByObjectIdScheduledForDeletion->getPrimaryKeys(false))
654: ->delete($con);
655: $this->biomaterialRelationshipsRelatedByObjectIdScheduledForDeletion = null;
656: }
657: }
658:
659: if ($this->collBiomaterialRelationshipsRelatedByObjectId !== null) {
660: foreach ($this->collBiomaterialRelationshipsRelatedByObjectId as $referrerFK) {
661: if (!$referrerFK->isDeleted() && ($referrerFK->isNew() || $referrerFK->isModified())) {
662: $affectedRows += $referrerFK->save($con);
663: }
664: }
665: }
666:
667: if ($this->biomaterialRelationshipsRelatedBySubjectIdScheduledForDeletion !== null) {
668: if (!$this->biomaterialRelationshipsRelatedBySubjectIdScheduledForDeletion->isEmpty()) {
669: BiomaterialRelationshipQuery::create()
670: ->filterByPrimaryKeys($this->biomaterialRelationshipsRelatedBySubjectIdScheduledForDeletion->getPrimaryKeys(false))
671: ->delete($con);
672: $this->biomaterialRelationshipsRelatedBySubjectIdScheduledForDeletion = null;
673: }
674: }
675:
676: if ($this->collBiomaterialRelationshipsRelatedBySubjectId !== null) {
677: foreach ($this->collBiomaterialRelationshipsRelatedBySubjectId as $referrerFK) {
678: if (!$referrerFK->isDeleted() && ($referrerFK->isNew() || $referrerFK->isModified())) {
679: $affectedRows += $referrerFK->save($con);
680: }
681: }
682: }
683:
684: if ($this->biomaterialpropsScheduledForDeletion !== null) {
685: if (!$this->biomaterialpropsScheduledForDeletion->isEmpty()) {
686: BiomaterialpropQuery::create()
687: ->filterByPrimaryKeys($this->biomaterialpropsScheduledForDeletion->getPrimaryKeys(false))
688: ->delete($con);
689: $this->biomaterialpropsScheduledForDeletion = null;
690: }
691: }
692:
693: if ($this->collBiomaterialprops !== null) {
694: foreach ($this->collBiomaterialprops as $referrerFK) {
695: if (!$referrerFK->isDeleted() && ($referrerFK->isNew() || $referrerFK->isModified())) {
696: $affectedRows += $referrerFK->save($con);
697: }
698: }
699: }
700:
701: $this->alreadyInSave = false;
702:
703: }
704:
705: return $affectedRows;
706: }
707:
708: 709: 710: 711: 712: 713: 714: 715:
716: protected function doInsert(PropelPDO $con)
717: {
718: $modifiedColumns = array();
719: $index = 0;
720:
721: $this->modifiedColumns[] = BiomaterialPeer::BIOMATERIAL_ID;
722: if (null !== $this->biomaterial_id) {
723: throw new PropelException('Cannot insert a value for auto-increment primary key (' . BiomaterialPeer::BIOMATERIAL_ID . ')');
724: }
725: if (null === $this->biomaterial_id) {
726: try {
727: $stmt = $con->query("SELECT nextval('biomaterial_biomaterial_id_seq')");
728: $row = $stmt->fetch(PDO::FETCH_NUM);
729: $this->biomaterial_id = $row[0];
730: } catch (Exception $e) {
731: throw new PropelException('Unable to get sequence id.', $e);
732: }
733: }
734:
735:
736:
737: if ($this->isColumnModified(BiomaterialPeer::BIOMATERIAL_ID)) {
738: $modifiedColumns[':p' . $index++] = '"biomaterial_id"';
739: }
740: if ($this->isColumnModified(BiomaterialPeer::TAXON_ID)) {
741: $modifiedColumns[':p' . $index++] = '"taxon_id"';
742: }
743: if ($this->isColumnModified(BiomaterialPeer::BIOSOURCEPROVIDER_ID)) {
744: $modifiedColumns[':p' . $index++] = '"biosourceprovider_id"';
745: }
746: if ($this->isColumnModified(BiomaterialPeer::DBXREF_ID)) {
747: $modifiedColumns[':p' . $index++] = '"dbxref_id"';
748: }
749: if ($this->isColumnModified(BiomaterialPeer::NAME)) {
750: $modifiedColumns[':p' . $index++] = '"name"';
751: }
752: if ($this->isColumnModified(BiomaterialPeer::DESCRIPTION)) {
753: $modifiedColumns[':p' . $index++] = '"description"';
754: }
755:
756: $sql = sprintf(
757: 'INSERT INTO "biomaterial" (%s) VALUES (%s)',
758: implode(', ', $modifiedColumns),
759: implode(', ', array_keys($modifiedColumns))
760: );
761:
762: try {
763: $stmt = $con->prepare($sql);
764: foreach ($modifiedColumns as $identifier => $columnName) {
765: switch ($columnName) {
766: case '"biomaterial_id"':
767: $stmt->bindValue($identifier, $this->biomaterial_id, PDO::PARAM_INT);
768: break;
769: case '"taxon_id"':
770: $stmt->bindValue($identifier, $this->taxon_id, PDO::PARAM_INT);
771: break;
772: case '"biosourceprovider_id"':
773: $stmt->bindValue($identifier, $this->biosourceprovider_id, PDO::PARAM_INT);
774: break;
775: case '"dbxref_id"':
776: $stmt->bindValue($identifier, $this->dbxref_id, PDO::PARAM_INT);
777: break;
778: case '"name"':
779: $stmt->bindValue($identifier, $this->name, PDO::PARAM_STR);
780: break;
781: case '"description"':
782: $stmt->bindValue($identifier, $this->description, PDO::PARAM_STR);
783: break;
784: }
785: }
786: $stmt->execute();
787: } catch (Exception $e) {
788: Propel::log($e->getMessage(), Propel::LOG_ERR);
789: throw new PropelException(sprintf('Unable to execute INSERT statement [%s]', $sql), $e);
790: }
791:
792: $this->setNew(false);
793: }
794:
795: 796: 797: 798: 799: 800: 801:
802: protected function doUpdate(PropelPDO $con)
803: {
804: $selectCriteria = $this->buildPkeyCriteria();
805: $valuesCriteria = $this->buildCriteria();
806: BasePeer::doUpdate($selectCriteria, $valuesCriteria, $con);
807: }
808:
809: 810: 811: 812:
813: protected $validationFailures = array();
814:
815: 816: 817: 818: 819: 820: 821:
822: public function getValidationFailures()
823: {
824: return $this->validationFailures;
825: }
826:
827: 828: 829: 830: 831: 832: 833: 834: 835: 836: 837:
838: public function validate($columns = null)
839: {
840: $res = $this->doValidate($columns);
841: if ($res === true) {
842: $this->validationFailures = array();
843:
844: return true;
845: }
846:
847: $this->validationFailures = $res;
848:
849: return false;
850: }
851:
852: 853: 854: 855: 856: 857: 858: 859: 860: 861:
862: protected function doValidate($columns = null)
863: {
864: if (!$this->alreadyInValidation) {
865: $this->alreadyInValidation = true;
866: $retval = null;
867:
868: $failureMap = array();
869:
870:
871:
872:
873:
874:
875:
876: if ($this->aContact !== null) {
877: if (!$this->aContact->validate($columns)) {
878: $failureMap = array_merge($failureMap, $this->aContact->getValidationFailures());
879: }
880: }
881:
882: if ($this->aOrganism !== null) {
883: if (!$this->aOrganism->validate($columns)) {
884: $failureMap = array_merge($failureMap, $this->aOrganism->getValidationFailures());
885: }
886: }
887:
888:
889: if (($retval = BiomaterialPeer::doValidate($this, $columns)) !== true) {
890: $failureMap = array_merge($failureMap, $retval);
891: }
892:
893:
894: if ($this->collAssayBiomaterials !== null) {
895: foreach ($this->collAssayBiomaterials as $referrerFK) {
896: if (!$referrerFK->validate($columns)) {
897: $failureMap = array_merge($failureMap, $referrerFK->getValidationFailures());
898: }
899: }
900: }
901:
902: if ($this->collBiomaterialRelationshipsRelatedByObjectId !== null) {
903: foreach ($this->collBiomaterialRelationshipsRelatedByObjectId as $referrerFK) {
904: if (!$referrerFK->validate($columns)) {
905: $failureMap = array_merge($failureMap, $referrerFK->getValidationFailures());
906: }
907: }
908: }
909:
910: if ($this->collBiomaterialRelationshipsRelatedBySubjectId !== null) {
911: foreach ($this->collBiomaterialRelationshipsRelatedBySubjectId as $referrerFK) {
912: if (!$referrerFK->validate($columns)) {
913: $failureMap = array_merge($failureMap, $referrerFK->getValidationFailures());
914: }
915: }
916: }
917:
918: if ($this->collBiomaterialprops !== null) {
919: foreach ($this->collBiomaterialprops as $referrerFK) {
920: if (!$referrerFK->validate($columns)) {
921: $failureMap = array_merge($failureMap, $referrerFK->getValidationFailures());
922: }
923: }
924: }
925:
926:
927: $this->alreadyInValidation = false;
928: }
929:
930: return (!empty($failureMap) ? $failureMap : true);
931: }
932:
933: 934: 935: 936: 937: 938: 939: 940: 941: 942:
943: public function getByName($name, $type = BasePeer::TYPE_PHPNAME)
944: {
945: $pos = BiomaterialPeer::translateFieldName($name, $type, BasePeer::TYPE_NUM);
946: $field = $this->getByPosition($pos);
947:
948: return $field;
949: }
950:
951: 952: 953: 954: 955: 956: 957:
958: public function getByPosition($pos)
959: {
960: switch ($pos) {
961: case 0:
962: return $this->getBiomaterialId();
963: break;
964: case 1:
965: return $this->getTaxonId();
966: break;
967: case 2:
968: return $this->getBiosourceproviderId();
969: break;
970: case 3:
971: return $this->getDbxrefId();
972: break;
973: case 4:
974: return $this->getName();
975: break;
976: case 5:
977: return $this->getDescription();
978: break;
979: default:
980: return null;
981: break;
982: }
983: }
984:
985: 986: 987: 988: 989: 990: 991: 992: 993: 994: 995: 996: 997: 998: 999:
1000: public function toArray($keyType = BasePeer::TYPE_PHPNAME, $includeLazyLoadColumns = true, $alreadyDumpedObjects = array(), $includeForeignObjects = false)
1001: {
1002: if (isset($alreadyDumpedObjects['Biomaterial'][$this->getPrimaryKey()])) {
1003: return '*RECURSION*';
1004: }
1005: $alreadyDumpedObjects['Biomaterial'][$this->getPrimaryKey()] = true;
1006: $keys = BiomaterialPeer::getFieldNames($keyType);
1007: $result = array(
1008: $keys[0] => $this->getBiomaterialId(),
1009: $keys[1] => $this->getTaxonId(),
1010: $keys[2] => $this->getBiosourceproviderId(),
1011: $keys[3] => $this->getDbxrefId(),
1012: $keys[4] => $this->getName(),
1013: $keys[5] => $this->getDescription(),
1014: );
1015: if ($includeForeignObjects) {
1016: if (null !== $this->aContact) {
1017: $result['Contact'] = $this->aContact->toArray($keyType, $includeLazyLoadColumns, $alreadyDumpedObjects, true);
1018: }
1019: if (null !== $this->aOrganism) {
1020: $result['Organism'] = $this->aOrganism->toArray($keyType, $includeLazyLoadColumns, $alreadyDumpedObjects, true);
1021: }
1022: if (null !== $this->collAssayBiomaterials) {
1023: $result['AssayBiomaterials'] = $this->collAssayBiomaterials->toArray(null, true, $keyType, $includeLazyLoadColumns, $alreadyDumpedObjects);
1024: }
1025: if (null !== $this->collBiomaterialRelationshipsRelatedByObjectId) {
1026: $result['BiomaterialRelationshipsRelatedByObjectId'] = $this->collBiomaterialRelationshipsRelatedByObjectId->toArray(null, true, $keyType, $includeLazyLoadColumns, $alreadyDumpedObjects);
1027: }
1028: if (null !== $this->collBiomaterialRelationshipsRelatedBySubjectId) {
1029: $result['BiomaterialRelationshipsRelatedBySubjectId'] = $this->collBiomaterialRelationshipsRelatedBySubjectId->toArray(null, true, $keyType, $includeLazyLoadColumns, $alreadyDumpedObjects);
1030: }
1031: if (null !== $this->collBiomaterialprops) {
1032: $result['Biomaterialprops'] = $this->collBiomaterialprops->toArray(null, true, $keyType, $includeLazyLoadColumns, $alreadyDumpedObjects);
1033: }
1034: }
1035:
1036: return $result;
1037: }
1038:
1039: 1040: 1041: 1042: 1043: 1044: 1045: 1046: 1047: 1048: 1049:
1050: public function setByName($name, $value, $type = BasePeer::TYPE_PHPNAME)
1051: {
1052: $pos = BiomaterialPeer::translateFieldName($name, $type, BasePeer::TYPE_NUM);
1053:
1054: $this->setByPosition($pos, $value);
1055: }
1056:
1057: 1058: 1059: 1060: 1061: 1062: 1063: 1064:
1065: public function setByPosition($pos, $value)
1066: {
1067: switch ($pos) {
1068: case 0:
1069: $this->setBiomaterialId($value);
1070: break;
1071: case 1:
1072: $this->setTaxonId($value);
1073: break;
1074: case 2:
1075: $this->setBiosourceproviderId($value);
1076: break;
1077: case 3:
1078: $this->setDbxrefId($value);
1079: break;
1080: case 4:
1081: $this->setName($value);
1082: break;
1083: case 5:
1084: $this->setDescription($value);
1085: break;
1086: }
1087: }
1088:
1089: 1090: 1091: 1092: 1093: 1094: 1095: 1096: 1097: 1098: 1099: 1100: 1101: 1102: 1103: 1104: 1105:
1106: public function fromArray($arr, $keyType = BasePeer::TYPE_PHPNAME)
1107: {
1108: $keys = BiomaterialPeer::getFieldNames($keyType);
1109:
1110: if (array_key_exists($keys[0], $arr)) $this->setBiomaterialId($arr[$keys[0]]);
1111: if (array_key_exists($keys[1], $arr)) $this->setTaxonId($arr[$keys[1]]);
1112: if (array_key_exists($keys[2], $arr)) $this->setBiosourceproviderId($arr[$keys[2]]);
1113: if (array_key_exists($keys[3], $arr)) $this->setDbxrefId($arr[$keys[3]]);
1114: if (array_key_exists($keys[4], $arr)) $this->setName($arr[$keys[4]]);
1115: if (array_key_exists($keys[5], $arr)) $this->setDescription($arr[$keys[5]]);
1116: }
1117:
1118: 1119: 1120: 1121: 1122:
1123: public function buildCriteria()
1124: {
1125: $criteria = new Criteria(BiomaterialPeer::DATABASE_NAME);
1126:
1127: if ($this->isColumnModified(BiomaterialPeer::BIOMATERIAL_ID)) $criteria->add(BiomaterialPeer::BIOMATERIAL_ID, $this->biomaterial_id);
1128: if ($this->isColumnModified(BiomaterialPeer::TAXON_ID)) $criteria->add(BiomaterialPeer::TAXON_ID, $this->taxon_id);
1129: if ($this->isColumnModified(BiomaterialPeer::BIOSOURCEPROVIDER_ID)) $criteria->add(BiomaterialPeer::BIOSOURCEPROVIDER_ID, $this->biosourceprovider_id);
1130: if ($this->isColumnModified(BiomaterialPeer::DBXREF_ID)) $criteria->add(BiomaterialPeer::DBXREF_ID, $this->dbxref_id);
1131: if ($this->isColumnModified(BiomaterialPeer::NAME)) $criteria->add(BiomaterialPeer::NAME, $this->name);
1132: if ($this->isColumnModified(BiomaterialPeer::DESCRIPTION)) $criteria->add(BiomaterialPeer::DESCRIPTION, $this->description);
1133:
1134: return $criteria;
1135: }
1136:
1137: 1138: 1139: 1140: 1141: 1142: 1143: 1144:
1145: public function buildPkeyCriteria()
1146: {
1147: $criteria = new Criteria(BiomaterialPeer::DATABASE_NAME);
1148: $criteria->add(BiomaterialPeer::BIOMATERIAL_ID, $this->biomaterial_id);
1149:
1150: return $criteria;
1151: }
1152:
1153: 1154: 1155: 1156:
1157: public function getPrimaryKey()
1158: {
1159: return $this->getBiomaterialId();
1160: }
1161:
1162: 1163: 1164: 1165: 1166: 1167:
1168: public function setPrimaryKey($key)
1169: {
1170: $this->setBiomaterialId($key);
1171: }
1172:
1173: 1174: 1175: 1176:
1177: public function isPrimaryKeyNull()
1178: {
1179:
1180: return null === $this->getBiomaterialId();
1181: }
1182:
1183: 1184: 1185: 1186: 1187: 1188: 1189: 1190: 1191: 1192: 1193:
1194: public function copyInto($copyObj, $deepCopy = false, $makeNew = true)
1195: {
1196: $copyObj->setTaxonId($this->getTaxonId());
1197: $copyObj->setBiosourceproviderId($this->getBiosourceproviderId());
1198: $copyObj->setDbxrefId($this->getDbxrefId());
1199: $copyObj->setName($this->getName());
1200: $copyObj->setDescription($this->getDescription());
1201:
1202: if ($deepCopy && !$this->startCopy) {
1203:
1204:
1205: $copyObj->setNew(false);
1206:
1207: $this->startCopy = true;
1208:
1209: foreach ($this->getAssayBiomaterials() as $relObj) {
1210: if ($relObj !== $this) {
1211: $copyObj->addAssayBiomaterial($relObj->copy($deepCopy));
1212: }
1213: }
1214:
1215: foreach ($this->getBiomaterialRelationshipsRelatedByObjectId() as $relObj) {
1216: if ($relObj !== $this) {
1217: $copyObj->addBiomaterialRelationshipRelatedByObjectId($relObj->copy($deepCopy));
1218: }
1219: }
1220:
1221: foreach ($this->getBiomaterialRelationshipsRelatedBySubjectId() as $relObj) {
1222: if ($relObj !== $this) {
1223: $copyObj->addBiomaterialRelationshipRelatedBySubjectId($relObj->copy($deepCopy));
1224: }
1225: }
1226:
1227: foreach ($this->getBiomaterialprops() as $relObj) {
1228: if ($relObj !== $this) {
1229: $copyObj->addBiomaterialprop($relObj->copy($deepCopy));
1230: }
1231: }
1232:
1233:
1234: $this->startCopy = false;
1235: }
1236:
1237: if ($makeNew) {
1238: $copyObj->setNew(true);
1239: $copyObj->setBiomaterialId(NULL);
1240: }
1241: }
1242:
1243: 1244: 1245: 1246: 1247: 1248: 1249: 1250: 1251: 1252: 1253: 1254:
1255: public function copy($deepCopy = false)
1256: {
1257:
1258: $clazz = get_class($this);
1259: $copyObj = new $clazz();
1260: $this->copyInto($copyObj, $deepCopy);
1261:
1262: return $copyObj;
1263: }
1264:
1265: 1266: 1267: 1268: 1269: 1270: 1271: 1272: 1273:
1274: public function getPeer()
1275: {
1276: if (self::$peer === null) {
1277: self::$peer = new BiomaterialPeer();
1278: }
1279:
1280: return self::$peer;
1281: }
1282:
1283: 1284: 1285: 1286: 1287: 1288: 1289:
1290: public function setContact(Contact $v = null)
1291: {
1292: if ($v === null) {
1293: $this->setBiosourceproviderId(NULL);
1294: } else {
1295: $this->setBiosourceproviderId($v->getContactId());
1296: }
1297:
1298: $this->aContact = $v;
1299:
1300:
1301:
1302: if ($v !== null) {
1303: $v->addBiomaterial($this);
1304: }
1305:
1306:
1307: return $this;
1308: }
1309:
1310:
1311: 1312: 1313: 1314: 1315: 1316: 1317: 1318:
1319: public function getContact(PropelPDO $con = null, $doQuery = true)
1320: {
1321: if ($this->aContact === null && ($this->biosourceprovider_id !== null) && $doQuery) {
1322: $this->aContact = ContactQuery::create()->findPk($this->biosourceprovider_id, $con);
1323: 1324: 1325: 1326: 1327: 1328: 1329:
1330: }
1331:
1332: return $this->aContact;
1333: }
1334:
1335: 1336: 1337: 1338: 1339: 1340: 1341:
1342: public function setOrganism(Organism $v = null)
1343: {
1344: if ($v === null) {
1345: $this->setTaxonId(NULL);
1346: } else {
1347: $this->setTaxonId($v->getOrganismId());
1348: }
1349:
1350: $this->aOrganism = $v;
1351:
1352:
1353:
1354: if ($v !== null) {
1355: $v->addBiomaterial($this);
1356: }
1357:
1358:
1359: return $this;
1360: }
1361:
1362:
1363: 1364: 1365: 1366: 1367: 1368: 1369: 1370:
1371: public function getOrganism(PropelPDO $con = null, $doQuery = true)
1372: {
1373: if ($this->aOrganism === null && ($this->taxon_id !== null) && $doQuery) {
1374: $this->aOrganism = OrganismQuery::create()->findPk($this->taxon_id, $con);
1375: 1376: 1377: 1378: 1379: 1380: 1381:
1382: }
1383:
1384: return $this->aOrganism;
1385: }
1386:
1387:
1388: 1389: 1390: 1391: 1392: 1393: 1394: 1395:
1396: public function initRelation($relationName)
1397: {
1398: if ('AssayBiomaterial' == $relationName) {
1399: $this->initAssayBiomaterials();
1400: }
1401: if ('BiomaterialRelationshipRelatedByObjectId' == $relationName) {
1402: $this->initBiomaterialRelationshipsRelatedByObjectId();
1403: }
1404: if ('BiomaterialRelationshipRelatedBySubjectId' == $relationName) {
1405: $this->initBiomaterialRelationshipsRelatedBySubjectId();
1406: }
1407: if ('Biomaterialprop' == $relationName) {
1408: $this->initBiomaterialprops();
1409: }
1410: }
1411:
1412: 1413: 1414: 1415: 1416: 1417: 1418: 1419: 1420:
1421: public function clearAssayBiomaterials()
1422: {
1423: $this->collAssayBiomaterials = null;
1424: $this->collAssayBiomaterialsPartial = null;
1425:
1426: return $this;
1427: }
1428:
1429: 1430: 1431: 1432: 1433:
1434: public function resetPartialAssayBiomaterials($v = true)
1435: {
1436: $this->collAssayBiomaterialsPartial = $v;
1437: }
1438:
1439: 1440: 1441: 1442: 1443: 1444: 1445: 1446: 1447: 1448: 1449: 1450:
1451: public function initAssayBiomaterials($overrideExisting = true)
1452: {
1453: if (null !== $this->collAssayBiomaterials && !$overrideExisting) {
1454: return;
1455: }
1456: $this->collAssayBiomaterials = new PropelObjectCollection();
1457: $this->collAssayBiomaterials->setModel('AssayBiomaterial');
1458: }
1459:
1460: 1461: 1462: 1463: 1464: 1465: 1466: 1467: 1468: 1469: 1470: 1471: 1472: 1473:
1474: public function getAssayBiomaterials($criteria = null, PropelPDO $con = null)
1475: {
1476: $partial = $this->collAssayBiomaterialsPartial && !$this->isNew();
1477: if (null === $this->collAssayBiomaterials || null !== $criteria || $partial) {
1478: if ($this->isNew() && null === $this->collAssayBiomaterials) {
1479:
1480: $this->initAssayBiomaterials();
1481: } else {
1482: $collAssayBiomaterials = AssayBiomaterialQuery::create(null, $criteria)
1483: ->filterByBiomaterial($this)
1484: ->find($con);
1485: if (null !== $criteria) {
1486: if (false !== $this->collAssayBiomaterialsPartial && count($collAssayBiomaterials)) {
1487: $this->initAssayBiomaterials(false);
1488:
1489: foreach($collAssayBiomaterials as $obj) {
1490: if (false == $this->collAssayBiomaterials->contains($obj)) {
1491: $this->collAssayBiomaterials->append($obj);
1492: }
1493: }
1494:
1495: $this->collAssayBiomaterialsPartial = true;
1496: }
1497:
1498: $collAssayBiomaterials->getInternalIterator()->rewind();
1499: return $collAssayBiomaterials;
1500: }
1501:
1502: if($partial && $this->collAssayBiomaterials) {
1503: foreach($this->collAssayBiomaterials as $obj) {
1504: if($obj->isNew()) {
1505: $collAssayBiomaterials[] = $obj;
1506: }
1507: }
1508: }
1509:
1510: $this->collAssayBiomaterials = $collAssayBiomaterials;
1511: $this->collAssayBiomaterialsPartial = false;
1512: }
1513: }
1514:
1515: return $this->collAssayBiomaterials;
1516: }
1517:
1518: 1519: 1520: 1521: 1522: 1523: 1524: 1525: 1526: 1527:
1528: public function setAssayBiomaterials(PropelCollection $assayBiomaterials, PropelPDO $con = null)
1529: {
1530: $assayBiomaterialsToDelete = $this->getAssayBiomaterials(new Criteria(), $con)->diff($assayBiomaterials);
1531:
1532: $this->assayBiomaterialsScheduledForDeletion = unserialize(serialize($assayBiomaterialsToDelete));
1533:
1534: foreach ($assayBiomaterialsToDelete as $assayBiomaterialRemoved) {
1535: $assayBiomaterialRemoved->setBiomaterial(null);
1536: }
1537:
1538: $this->collAssayBiomaterials = null;
1539: foreach ($assayBiomaterials as $assayBiomaterial) {
1540: $this->addAssayBiomaterial($assayBiomaterial);
1541: }
1542:
1543: $this->collAssayBiomaterials = $assayBiomaterials;
1544: $this->collAssayBiomaterialsPartial = false;
1545:
1546: return $this;
1547: }
1548:
1549: 1550: 1551: 1552: 1553: 1554: 1555: 1556: 1557:
1558: public function countAssayBiomaterials(Criteria $criteria = null, $distinct = false, PropelPDO $con = null)
1559: {
1560: $partial = $this->collAssayBiomaterialsPartial && !$this->isNew();
1561: if (null === $this->collAssayBiomaterials || null !== $criteria || $partial) {
1562: if ($this->isNew() && null === $this->collAssayBiomaterials) {
1563: return 0;
1564: }
1565:
1566: if($partial && !$criteria) {
1567: return count($this->getAssayBiomaterials());
1568: }
1569: $query = AssayBiomaterialQuery::create(null, $criteria);
1570: if ($distinct) {
1571: $query->distinct();
1572: }
1573:
1574: return $query
1575: ->filterByBiomaterial($this)
1576: ->count($con);
1577: }
1578:
1579: return count($this->collAssayBiomaterials);
1580: }
1581:
1582: 1583: 1584: 1585: 1586: 1587: 1588:
1589: public function addAssayBiomaterial(AssayBiomaterial $l)
1590: {
1591: if ($this->collAssayBiomaterials === null) {
1592: $this->initAssayBiomaterials();
1593: $this->collAssayBiomaterialsPartial = true;
1594: }
1595: if (!in_array($l, $this->collAssayBiomaterials->getArrayCopy(), true)) {
1596: $this->doAddAssayBiomaterial($l);
1597: }
1598:
1599: return $this;
1600: }
1601:
1602: 1603: 1604:
1605: protected function doAddAssayBiomaterial($assayBiomaterial)
1606: {
1607: $this->collAssayBiomaterials[]= $assayBiomaterial;
1608: $assayBiomaterial->setBiomaterial($this);
1609: }
1610:
1611: 1612: 1613: 1614:
1615: public function removeAssayBiomaterial($assayBiomaterial)
1616: {
1617: if ($this->getAssayBiomaterials()->contains($assayBiomaterial)) {
1618: $this->collAssayBiomaterials->remove($this->collAssayBiomaterials->search($assayBiomaterial));
1619: if (null === $this->assayBiomaterialsScheduledForDeletion) {
1620: $this->assayBiomaterialsScheduledForDeletion = clone $this->collAssayBiomaterials;
1621: $this->assayBiomaterialsScheduledForDeletion->clear();
1622: }
1623: $this->assayBiomaterialsScheduledForDeletion[]= clone $assayBiomaterial;
1624: $assayBiomaterial->setBiomaterial(null);
1625: }
1626:
1627: return $this;
1628: }
1629:
1630:
1631: 1632: 1633: 1634: 1635: 1636: 1637: 1638: 1639: 1640: 1641: 1642: 1643: 1644: 1645: 1646:
1647: public function getAssayBiomaterialsJoinAssay($criteria = null, $con = null, $join_behavior = Criteria::LEFT_JOIN)
1648: {
1649: $query = AssayBiomaterialQuery::create(null, $criteria);
1650: $query->joinWith('Assay', $join_behavior);
1651:
1652: return $this->getAssayBiomaterials($query, $con);
1653: }
1654:
1655: 1656: 1657: 1658: 1659: 1660: 1661: 1662: 1663:
1664: public function clearBiomaterialRelationshipsRelatedByObjectId()
1665: {
1666: $this->collBiomaterialRelationshipsRelatedByObjectId = null;
1667: $this->collBiomaterialRelationshipsRelatedByObjectIdPartial = null;
1668:
1669: return $this;
1670: }
1671:
1672: 1673: 1674: 1675: 1676:
1677: public function resetPartialBiomaterialRelationshipsRelatedByObjectId($v = true)
1678: {
1679: $this->collBiomaterialRelationshipsRelatedByObjectIdPartial = $v;
1680: }
1681:
1682: 1683: 1684: 1685: 1686: 1687: 1688: 1689: 1690: 1691: 1692: 1693:
1694: public function initBiomaterialRelationshipsRelatedByObjectId($overrideExisting = true)
1695: {
1696: if (null !== $this->collBiomaterialRelationshipsRelatedByObjectId && !$overrideExisting) {
1697: return;
1698: }
1699: $this->collBiomaterialRelationshipsRelatedByObjectId = new PropelObjectCollection();
1700: $this->collBiomaterialRelationshipsRelatedByObjectId->setModel('BiomaterialRelationship');
1701: }
1702:
1703: 1704: 1705: 1706: 1707: 1708: 1709: 1710: 1711: 1712: 1713: 1714: 1715: 1716:
1717: public function getBiomaterialRelationshipsRelatedByObjectId($criteria = null, PropelPDO $con = null)
1718: {
1719: $partial = $this->collBiomaterialRelationshipsRelatedByObjectIdPartial && !$this->isNew();
1720: if (null === $this->collBiomaterialRelationshipsRelatedByObjectId || null !== $criteria || $partial) {
1721: if ($this->isNew() && null === $this->collBiomaterialRelationshipsRelatedByObjectId) {
1722:
1723: $this->initBiomaterialRelationshipsRelatedByObjectId();
1724: } else {
1725: $collBiomaterialRelationshipsRelatedByObjectId = BiomaterialRelationshipQuery::create(null, $criteria)
1726: ->filterByBiomaterialRelatedByObjectId($this)
1727: ->find($con);
1728: if (null !== $criteria) {
1729: if (false !== $this->collBiomaterialRelationshipsRelatedByObjectIdPartial && count($collBiomaterialRelationshipsRelatedByObjectId)) {
1730: $this->initBiomaterialRelationshipsRelatedByObjectId(false);
1731:
1732: foreach($collBiomaterialRelationshipsRelatedByObjectId as $obj) {
1733: if (false == $this->collBiomaterialRelationshipsRelatedByObjectId->contains($obj)) {
1734: $this->collBiomaterialRelationshipsRelatedByObjectId->append($obj);
1735: }
1736: }
1737:
1738: $this->collBiomaterialRelationshipsRelatedByObjectIdPartial = true;
1739: }
1740:
1741: $collBiomaterialRelationshipsRelatedByObjectId->getInternalIterator()->rewind();
1742: return $collBiomaterialRelationshipsRelatedByObjectId;
1743: }
1744:
1745: if($partial && $this->collBiomaterialRelationshipsRelatedByObjectId) {
1746: foreach($this->collBiomaterialRelationshipsRelatedByObjectId as $obj) {
1747: if($obj->isNew()) {
1748: $collBiomaterialRelationshipsRelatedByObjectId[] = $obj;
1749: }
1750: }
1751: }
1752:
1753: $this->collBiomaterialRelationshipsRelatedByObjectId = $collBiomaterialRelationshipsRelatedByObjectId;
1754: $this->collBiomaterialRelationshipsRelatedByObjectIdPartial = false;
1755: }
1756: }
1757:
1758: return $this->collBiomaterialRelationshipsRelatedByObjectId;
1759: }
1760:
1761: 1762: 1763: 1764: 1765: 1766: 1767: 1768: 1769: 1770:
1771: public function setBiomaterialRelationshipsRelatedByObjectId(PropelCollection $biomaterialRelationshipsRelatedByObjectId, PropelPDO $con = null)
1772: {
1773: $biomaterialRelationshipsRelatedByObjectIdToDelete = $this->getBiomaterialRelationshipsRelatedByObjectId(new Criteria(), $con)->diff($biomaterialRelationshipsRelatedByObjectId);
1774:
1775: $this->biomaterialRelationshipsRelatedByObjectIdScheduledForDeletion = unserialize(serialize($biomaterialRelationshipsRelatedByObjectIdToDelete));
1776:
1777: foreach ($biomaterialRelationshipsRelatedByObjectIdToDelete as $biomaterialRelationshipRelatedByObjectIdRemoved) {
1778: $biomaterialRelationshipRelatedByObjectIdRemoved->setBiomaterialRelatedByObjectId(null);
1779: }
1780:
1781: $this->collBiomaterialRelationshipsRelatedByObjectId = null;
1782: foreach ($biomaterialRelationshipsRelatedByObjectId as $biomaterialRelationshipRelatedByObjectId) {
1783: $this->addBiomaterialRelationshipRelatedByObjectId($biomaterialRelationshipRelatedByObjectId);
1784: }
1785:
1786: $this->collBiomaterialRelationshipsRelatedByObjectId = $biomaterialRelationshipsRelatedByObjectId;
1787: $this->collBiomaterialRelationshipsRelatedByObjectIdPartial = false;
1788:
1789: return $this;
1790: }
1791:
1792: 1793: 1794: 1795: 1796: 1797: 1798: 1799: 1800:
1801: public function countBiomaterialRelationshipsRelatedByObjectId(Criteria $criteria = null, $distinct = false, PropelPDO $con = null)
1802: {
1803: $partial = $this->collBiomaterialRelationshipsRelatedByObjectIdPartial && !$this->isNew();
1804: if (null === $this->collBiomaterialRelationshipsRelatedByObjectId || null !== $criteria || $partial) {
1805: if ($this->isNew() && null === $this->collBiomaterialRelationshipsRelatedByObjectId) {
1806: return 0;
1807: }
1808:
1809: if($partial && !$criteria) {
1810: return count($this->getBiomaterialRelationshipsRelatedByObjectId());
1811: }
1812: $query = BiomaterialRelationshipQuery::create(null, $criteria);
1813: if ($distinct) {
1814: $query->distinct();
1815: }
1816:
1817: return $query
1818: ->filterByBiomaterialRelatedByObjectId($this)
1819: ->count($con);
1820: }
1821:
1822: return count($this->collBiomaterialRelationshipsRelatedByObjectId);
1823: }
1824:
1825: 1826: 1827: 1828: 1829: 1830: 1831:
1832: public function addBiomaterialRelationshipRelatedByObjectId(BiomaterialRelationship $l)
1833: {
1834: if ($this->collBiomaterialRelationshipsRelatedByObjectId === null) {
1835: $this->initBiomaterialRelationshipsRelatedByObjectId();
1836: $this->collBiomaterialRelationshipsRelatedByObjectIdPartial = true;
1837: }
1838: if (!in_array($l, $this->collBiomaterialRelationshipsRelatedByObjectId->getArrayCopy(), true)) {
1839: $this->doAddBiomaterialRelationshipRelatedByObjectId($l);
1840: }
1841:
1842: return $this;
1843: }
1844:
1845: 1846: 1847:
1848: protected function doAddBiomaterialRelationshipRelatedByObjectId($biomaterialRelationshipRelatedByObjectId)
1849: {
1850: $this->collBiomaterialRelationshipsRelatedByObjectId[]= $biomaterialRelationshipRelatedByObjectId;
1851: $biomaterialRelationshipRelatedByObjectId->setBiomaterialRelatedByObjectId($this);
1852: }
1853:
1854: 1855: 1856: 1857:
1858: public function removeBiomaterialRelationshipRelatedByObjectId($biomaterialRelationshipRelatedByObjectId)
1859: {
1860: if ($this->getBiomaterialRelationshipsRelatedByObjectId()->contains($biomaterialRelationshipRelatedByObjectId)) {
1861: $this->collBiomaterialRelationshipsRelatedByObjectId->remove($this->collBiomaterialRelationshipsRelatedByObjectId->search($biomaterialRelationshipRelatedByObjectId));
1862: if (null === $this->biomaterialRelationshipsRelatedByObjectIdScheduledForDeletion) {
1863: $this->biomaterialRelationshipsRelatedByObjectIdScheduledForDeletion = clone $this->collBiomaterialRelationshipsRelatedByObjectId;
1864: $this->biomaterialRelationshipsRelatedByObjectIdScheduledForDeletion->clear();
1865: }
1866: $this->biomaterialRelationshipsRelatedByObjectIdScheduledForDeletion[]= clone $biomaterialRelationshipRelatedByObjectId;
1867: $biomaterialRelationshipRelatedByObjectId->setBiomaterialRelatedByObjectId(null);
1868: }
1869:
1870: return $this;
1871: }
1872:
1873:
1874: 1875: 1876: 1877: 1878: 1879: 1880: 1881: 1882: 1883: 1884: 1885: 1886: 1887: 1888: 1889:
1890: public function getBiomaterialRelationshipsRelatedByObjectIdJoinCvterm($criteria = null, $con = null, $join_behavior = Criteria::LEFT_JOIN)
1891: {
1892: $query = BiomaterialRelationshipQuery::create(null, $criteria);
1893: $query->joinWith('Cvterm', $join_behavior);
1894:
1895: return $this->getBiomaterialRelationshipsRelatedByObjectId($query, $con);
1896: }
1897:
1898: 1899: 1900: 1901: 1902: 1903: 1904: 1905: 1906:
1907: public function clearBiomaterialRelationshipsRelatedBySubjectId()
1908: {
1909: $this->collBiomaterialRelationshipsRelatedBySubjectId = null;
1910: $this->collBiomaterialRelationshipsRelatedBySubjectIdPartial = null;
1911:
1912: return $this;
1913: }
1914:
1915: 1916: 1917: 1918: 1919:
1920: public function resetPartialBiomaterialRelationshipsRelatedBySubjectId($v = true)
1921: {
1922: $this->collBiomaterialRelationshipsRelatedBySubjectIdPartial = $v;
1923: }
1924:
1925: 1926: 1927: 1928: 1929: 1930: 1931: 1932: 1933: 1934: 1935: 1936:
1937: public function initBiomaterialRelationshipsRelatedBySubjectId($overrideExisting = true)
1938: {
1939: if (null !== $this->collBiomaterialRelationshipsRelatedBySubjectId && !$overrideExisting) {
1940: return;
1941: }
1942: $this->collBiomaterialRelationshipsRelatedBySubjectId = new PropelObjectCollection();
1943: $this->collBiomaterialRelationshipsRelatedBySubjectId->setModel('BiomaterialRelationship');
1944: }
1945:
1946: 1947: 1948: 1949: 1950: 1951: 1952: 1953: 1954: 1955: 1956: 1957: 1958: 1959:
1960: public function getBiomaterialRelationshipsRelatedBySubjectId($criteria = null, PropelPDO $con = null)
1961: {
1962: $partial = $this->collBiomaterialRelationshipsRelatedBySubjectIdPartial && !$this->isNew();
1963: if (null === $this->collBiomaterialRelationshipsRelatedBySubjectId || null !== $criteria || $partial) {
1964: if ($this->isNew() && null === $this->collBiomaterialRelationshipsRelatedBySubjectId) {
1965:
1966: $this->initBiomaterialRelationshipsRelatedBySubjectId();
1967: } else {
1968: $collBiomaterialRelationshipsRelatedBySubjectId = BiomaterialRelationshipQuery::create(null, $criteria)
1969: ->filterByBiomaterialRelatedBySubjectId($this)
1970: ->find($con);
1971: if (null !== $criteria) {
1972: if (false !== $this->collBiomaterialRelationshipsRelatedBySubjectIdPartial && count($collBiomaterialRelationshipsRelatedBySubjectId)) {
1973: $this->initBiomaterialRelationshipsRelatedBySubjectId(false);
1974:
1975: foreach($collBiomaterialRelationshipsRelatedBySubjectId as $obj) {
1976: if (false == $this->collBiomaterialRelationshipsRelatedBySubjectId->contains($obj)) {
1977: $this->collBiomaterialRelationshipsRelatedBySubjectId->append($obj);
1978: }
1979: }
1980:
1981: $this->collBiomaterialRelationshipsRelatedBySubjectIdPartial = true;
1982: }
1983:
1984: $collBiomaterialRelationshipsRelatedBySubjectId->getInternalIterator()->rewind();
1985: return $collBiomaterialRelationshipsRelatedBySubjectId;
1986: }
1987:
1988: if($partial && $this->collBiomaterialRelationshipsRelatedBySubjectId) {
1989: foreach($this->collBiomaterialRelationshipsRelatedBySubjectId as $obj) {
1990: if($obj->isNew()) {
1991: $collBiomaterialRelationshipsRelatedBySubjectId[] = $obj;
1992: }
1993: }
1994: }
1995:
1996: $this->collBiomaterialRelationshipsRelatedBySubjectId = $collBiomaterialRelationshipsRelatedBySubjectId;
1997: $this->collBiomaterialRelationshipsRelatedBySubjectIdPartial = false;
1998: }
1999: }
2000:
2001: return $this->collBiomaterialRelationshipsRelatedBySubjectId;
2002: }
2003:
2004: 2005: 2006: 2007: 2008: 2009: 2010: 2011: 2012: 2013:
2014: public function setBiomaterialRelationshipsRelatedBySubjectId(PropelCollection $biomaterialRelationshipsRelatedBySubjectId, PropelPDO $con = null)
2015: {
2016: $biomaterialRelationshipsRelatedBySubjectIdToDelete = $this->getBiomaterialRelationshipsRelatedBySubjectId(new Criteria(), $con)->diff($biomaterialRelationshipsRelatedBySubjectId);
2017:
2018: $this->biomaterialRelationshipsRelatedBySubjectIdScheduledForDeletion = unserialize(serialize($biomaterialRelationshipsRelatedBySubjectIdToDelete));
2019:
2020: foreach ($biomaterialRelationshipsRelatedBySubjectIdToDelete as $biomaterialRelationshipRelatedBySubjectIdRemoved) {
2021: $biomaterialRelationshipRelatedBySubjectIdRemoved->setBiomaterialRelatedBySubjectId(null);
2022: }
2023:
2024: $this->collBiomaterialRelationshipsRelatedBySubjectId = null;
2025: foreach ($biomaterialRelationshipsRelatedBySubjectId as $biomaterialRelationshipRelatedBySubjectId) {
2026: $this->addBiomaterialRelationshipRelatedBySubjectId($biomaterialRelationshipRelatedBySubjectId);
2027: }
2028:
2029: $this->collBiomaterialRelationshipsRelatedBySubjectId = $biomaterialRelationshipsRelatedBySubjectId;
2030: $this->collBiomaterialRelationshipsRelatedBySubjectIdPartial = false;
2031:
2032: return $this;
2033: }
2034:
2035: 2036: 2037: 2038: 2039: 2040: 2041: 2042: 2043:
2044: public function countBiomaterialRelationshipsRelatedBySubjectId(Criteria $criteria = null, $distinct = false, PropelPDO $con = null)
2045: {
2046: $partial = $this->collBiomaterialRelationshipsRelatedBySubjectIdPartial && !$this->isNew();
2047: if (null === $this->collBiomaterialRelationshipsRelatedBySubjectId || null !== $criteria || $partial) {
2048: if ($this->isNew() && null === $this->collBiomaterialRelationshipsRelatedBySubjectId) {
2049: return 0;
2050: }
2051:
2052: if($partial && !$criteria) {
2053: return count($this->getBiomaterialRelationshipsRelatedBySubjectId());
2054: }
2055: $query = BiomaterialRelationshipQuery::create(null, $criteria);
2056: if ($distinct) {
2057: $query->distinct();
2058: }
2059:
2060: return $query
2061: ->filterByBiomaterialRelatedBySubjectId($this)
2062: ->count($con);
2063: }
2064:
2065: return count($this->collBiomaterialRelationshipsRelatedBySubjectId);
2066: }
2067:
2068: 2069: 2070: 2071: 2072: 2073: 2074:
2075: public function addBiomaterialRelationshipRelatedBySubjectId(BiomaterialRelationship $l)
2076: {
2077: if ($this->collBiomaterialRelationshipsRelatedBySubjectId === null) {
2078: $this->initBiomaterialRelationshipsRelatedBySubjectId();
2079: $this->collBiomaterialRelationshipsRelatedBySubjectIdPartial = true;
2080: }
2081: if (!in_array($l, $this->collBiomaterialRelationshipsRelatedBySubjectId->getArrayCopy(), true)) {
2082: $this->doAddBiomaterialRelationshipRelatedBySubjectId($l);
2083: }
2084:
2085: return $this;
2086: }
2087:
2088: 2089: 2090:
2091: protected function doAddBiomaterialRelationshipRelatedBySubjectId($biomaterialRelationshipRelatedBySubjectId)
2092: {
2093: $this->collBiomaterialRelationshipsRelatedBySubjectId[]= $biomaterialRelationshipRelatedBySubjectId;
2094: $biomaterialRelationshipRelatedBySubjectId->setBiomaterialRelatedBySubjectId($this);
2095: }
2096:
2097: 2098: 2099: 2100:
2101: public function removeBiomaterialRelationshipRelatedBySubjectId($biomaterialRelationshipRelatedBySubjectId)
2102: {
2103: if ($this->getBiomaterialRelationshipsRelatedBySubjectId()->contains($biomaterialRelationshipRelatedBySubjectId)) {
2104: $this->collBiomaterialRelationshipsRelatedBySubjectId->remove($this->collBiomaterialRelationshipsRelatedBySubjectId->search($biomaterialRelationshipRelatedBySubjectId));
2105: if (null === $this->biomaterialRelationshipsRelatedBySubjectIdScheduledForDeletion) {
2106: $this->biomaterialRelationshipsRelatedBySubjectIdScheduledForDeletion = clone $this->collBiomaterialRelationshipsRelatedBySubjectId;
2107: $this->biomaterialRelationshipsRelatedBySubjectIdScheduledForDeletion->clear();
2108: }
2109: $this->biomaterialRelationshipsRelatedBySubjectIdScheduledForDeletion[]= clone $biomaterialRelationshipRelatedBySubjectId;
2110: $biomaterialRelationshipRelatedBySubjectId->setBiomaterialRelatedBySubjectId(null);
2111: }
2112:
2113: return $this;
2114: }
2115:
2116:
2117: 2118: 2119: 2120: 2121: 2122: 2123: 2124: 2125: 2126: 2127: 2128: 2129: 2130: 2131: 2132:
2133: public function getBiomaterialRelationshipsRelatedBySubjectIdJoinCvterm($criteria = null, $con = null, $join_behavior = Criteria::LEFT_JOIN)
2134: {
2135: $query = BiomaterialRelationshipQuery::create(null, $criteria);
2136: $query->joinWith('Cvterm', $join_behavior);
2137:
2138: return $this->getBiomaterialRelationshipsRelatedBySubjectId($query, $con);
2139: }
2140:
2141: 2142: 2143: 2144: 2145: 2146: 2147: 2148: 2149:
2150: public function clearBiomaterialprops()
2151: {
2152: $this->collBiomaterialprops = null;
2153: $this->collBiomaterialpropsPartial = null;
2154:
2155: return $this;
2156: }
2157:
2158: 2159: 2160: 2161: 2162:
2163: public function resetPartialBiomaterialprops($v = true)
2164: {
2165: $this->collBiomaterialpropsPartial = $v;
2166: }
2167:
2168: 2169: 2170: 2171: 2172: 2173: 2174: 2175: 2176: 2177: 2178: 2179:
2180: public function initBiomaterialprops($overrideExisting = true)
2181: {
2182: if (null !== $this->collBiomaterialprops && !$overrideExisting) {
2183: return;
2184: }
2185: $this->collBiomaterialprops = new PropelObjectCollection();
2186: $this->collBiomaterialprops->setModel('Biomaterialprop');
2187: }
2188:
2189: 2190: 2191: 2192: 2193: 2194: 2195: 2196: 2197: 2198: 2199: 2200: 2201: 2202:
2203: public function getBiomaterialprops($criteria = null, PropelPDO $con = null)
2204: {
2205: $partial = $this->collBiomaterialpropsPartial && !$this->isNew();
2206: if (null === $this->collBiomaterialprops || null !== $criteria || $partial) {
2207: if ($this->isNew() && null === $this->collBiomaterialprops) {
2208:
2209: $this->initBiomaterialprops();
2210: } else {
2211: $collBiomaterialprops = BiomaterialpropQuery::create(null, $criteria)
2212: ->filterByBiomaterial($this)
2213: ->find($con);
2214: if (null !== $criteria) {
2215: if (false !== $this->collBiomaterialpropsPartial && count($collBiomaterialprops)) {
2216: $this->initBiomaterialprops(false);
2217:
2218: foreach($collBiomaterialprops as $obj) {
2219: if (false == $this->collBiomaterialprops->contains($obj)) {
2220: $this->collBiomaterialprops->append($obj);
2221: }
2222: }
2223:
2224: $this->collBiomaterialpropsPartial = true;
2225: }
2226:
2227: $collBiomaterialprops->getInternalIterator()->rewind();
2228: return $collBiomaterialprops;
2229: }
2230:
2231: if($partial && $this->collBiomaterialprops) {
2232: foreach($this->collBiomaterialprops as $obj) {
2233: if($obj->isNew()) {
2234: $collBiomaterialprops[] = $obj;
2235: }
2236: }
2237: }
2238:
2239: $this->collBiomaterialprops = $collBiomaterialprops;
2240: $this->collBiomaterialpropsPartial = false;
2241: }
2242: }
2243:
2244: return $this->collBiomaterialprops;
2245: }
2246:
2247: 2248: 2249: 2250: 2251: 2252: 2253: 2254: 2255: 2256:
2257: public function setBiomaterialprops(PropelCollection $biomaterialprops, PropelPDO $con = null)
2258: {
2259: $biomaterialpropsToDelete = $this->getBiomaterialprops(new Criteria(), $con)->diff($biomaterialprops);
2260:
2261: $this->biomaterialpropsScheduledForDeletion = unserialize(serialize($biomaterialpropsToDelete));
2262:
2263: foreach ($biomaterialpropsToDelete as $biomaterialpropRemoved) {
2264: $biomaterialpropRemoved->setBiomaterial(null);
2265: }
2266:
2267: $this->collBiomaterialprops = null;
2268: foreach ($biomaterialprops as $biomaterialprop) {
2269: $this->addBiomaterialprop($biomaterialprop);
2270: }
2271:
2272: $this->collBiomaterialprops = $biomaterialprops;
2273: $this->collBiomaterialpropsPartial = false;
2274:
2275: return $this;
2276: }
2277:
2278: 2279: 2280: 2281: 2282: 2283: 2284: 2285: 2286:
2287: public function countBiomaterialprops(Criteria $criteria = null, $distinct = false, PropelPDO $con = null)
2288: {
2289: $partial = $this->collBiomaterialpropsPartial && !$this->isNew();
2290: if (null === $this->collBiomaterialprops || null !== $criteria || $partial) {
2291: if ($this->isNew() && null === $this->collBiomaterialprops) {
2292: return 0;
2293: }
2294:
2295: if($partial && !$criteria) {
2296: return count($this->getBiomaterialprops());
2297: }
2298: $query = BiomaterialpropQuery::create(null, $criteria);
2299: if ($distinct) {
2300: $query->distinct();
2301: }
2302:
2303: return $query
2304: ->filterByBiomaterial($this)
2305: ->count($con);
2306: }
2307:
2308: return count($this->collBiomaterialprops);
2309: }
2310:
2311: 2312: 2313: 2314: 2315: 2316: 2317:
2318: public function addBiomaterialprop(Biomaterialprop $l)
2319: {
2320: if ($this->collBiomaterialprops === null) {
2321: $this->initBiomaterialprops();
2322: $this->collBiomaterialpropsPartial = true;
2323: }
2324: if (!in_array($l, $this->collBiomaterialprops->getArrayCopy(), true)) {
2325: $this->doAddBiomaterialprop($l);
2326: }
2327:
2328: return $this;
2329: }
2330:
2331: 2332: 2333:
2334: protected function doAddBiomaterialprop($biomaterialprop)
2335: {
2336: $this->collBiomaterialprops[]= $biomaterialprop;
2337: $biomaterialprop->setBiomaterial($this);
2338: }
2339:
2340: 2341: 2342: 2343:
2344: public function removeBiomaterialprop($biomaterialprop)
2345: {
2346: if ($this->getBiomaterialprops()->contains($biomaterialprop)) {
2347: $this->collBiomaterialprops->remove($this->collBiomaterialprops->search($biomaterialprop));
2348: if (null === $this->biomaterialpropsScheduledForDeletion) {
2349: $this->biomaterialpropsScheduledForDeletion = clone $this->collBiomaterialprops;
2350: $this->biomaterialpropsScheduledForDeletion->clear();
2351: }
2352: $this->biomaterialpropsScheduledForDeletion[]= clone $biomaterialprop;
2353: $biomaterialprop->setBiomaterial(null);
2354: }
2355:
2356: return $this;
2357: }
2358:
2359:
2360: 2361: 2362: 2363: 2364: 2365: 2366: 2367: 2368: 2369: 2370: 2371: 2372: 2373: 2374: 2375:
2376: public function getBiomaterialpropsJoinCvterm($criteria = null, $con = null, $join_behavior = Criteria::LEFT_JOIN)
2377: {
2378: $query = BiomaterialpropQuery::create(null, $criteria);
2379: $query->joinWith('Cvterm', $join_behavior);
2380:
2381: return $this->getBiomaterialprops($query, $con);
2382: }
2383:
2384: 2385: 2386:
2387: public function clear()
2388: {
2389: $this->biomaterial_id = null;
2390: $this->taxon_id = null;
2391: $this->biosourceprovider_id = null;
2392: $this->dbxref_id = null;
2393: $this->name = null;
2394: $this->description = null;
2395: $this->alreadyInSave = false;
2396: $this->alreadyInValidation = false;
2397: $this->alreadyInClearAllReferencesDeep = false;
2398: $this->clearAllReferences();
2399: $this->resetModified();
2400: $this->setNew(true);
2401: $this->setDeleted(false);
2402: }
2403:
2404: 2405: 2406: 2407: 2408: 2409: 2410: 2411: 2412:
2413: public function clearAllReferences($deep = false)
2414: {
2415: if ($deep && !$this->alreadyInClearAllReferencesDeep) {
2416: $this->alreadyInClearAllReferencesDeep = true;
2417: if ($this->collAssayBiomaterials) {
2418: foreach ($this->collAssayBiomaterials as $o) {
2419: $o->clearAllReferences($deep);
2420: }
2421: }
2422: if ($this->collBiomaterialRelationshipsRelatedByObjectId) {
2423: foreach ($this->collBiomaterialRelationshipsRelatedByObjectId as $o) {
2424: $o->clearAllReferences($deep);
2425: }
2426: }
2427: if ($this->collBiomaterialRelationshipsRelatedBySubjectId) {
2428: foreach ($this->collBiomaterialRelationshipsRelatedBySubjectId as $o) {
2429: $o->clearAllReferences($deep);
2430: }
2431: }
2432: if ($this->collBiomaterialprops) {
2433: foreach ($this->collBiomaterialprops as $o) {
2434: $o->clearAllReferences($deep);
2435: }
2436: }
2437: if ($this->aContact instanceof Persistent) {
2438: $this->aContact->clearAllReferences($deep);
2439: }
2440: if ($this->aOrganism instanceof Persistent) {
2441: $this->aOrganism->clearAllReferences($deep);
2442: }
2443:
2444: $this->alreadyInClearAllReferencesDeep = false;
2445: }
2446:
2447: if ($this->collAssayBiomaterials instanceof PropelCollection) {
2448: $this->collAssayBiomaterials->clearIterator();
2449: }
2450: $this->collAssayBiomaterials = null;
2451: if ($this->collBiomaterialRelationshipsRelatedByObjectId instanceof PropelCollection) {
2452: $this->collBiomaterialRelationshipsRelatedByObjectId->clearIterator();
2453: }
2454: $this->collBiomaterialRelationshipsRelatedByObjectId = null;
2455: if ($this->collBiomaterialRelationshipsRelatedBySubjectId instanceof PropelCollection) {
2456: $this->collBiomaterialRelationshipsRelatedBySubjectId->clearIterator();
2457: }
2458: $this->collBiomaterialRelationshipsRelatedBySubjectId = null;
2459: if ($this->collBiomaterialprops instanceof PropelCollection) {
2460: $this->collBiomaterialprops->clearIterator();
2461: }
2462: $this->collBiomaterialprops = null;
2463: $this->aContact = null;
2464: $this->aOrganism = null;
2465: }
2466:
2467: 2468: 2469: 2470: 2471:
2472: public function __toString()
2473: {
2474: return (string) $this->exportTo(BiomaterialPeer::DEFAULT_STRING_FORMAT);
2475: }
2476:
2477: 2478: 2479: 2480: 2481:
2482: public function isAlreadyInSave()
2483: {
2484: return $this->alreadyInSave;
2485: }
2486:
2487: }
2488: