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