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