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\Analysis;
19: use cli_db\propel\AnalysisPeer;
20: use cli_db\propel\AnalysisQuery;
21: use cli_db\propel\Quantification;
22: use cli_db\propel\QuantificationQuery;
23:
24: 25: 26: 27: 28: 29: 30:
31: abstract class BaseAnalysis extends BaseObject implements Persistent
32: {
33: 34: 35:
36: const PEER = 'cli_db\\propel\\AnalysisPeer';
37:
38: 39: 40: 41: 42: 43:
44: protected static $peer;
45:
46: 47: 48: 49:
50: protected $startCopy = false;
51:
52: 53: 54: 55:
56: protected $analysis_id;
57:
58: 59: 60: 61:
62: protected $name;
63:
64: 65: 66: 67:
68: protected $description;
69:
70: 71: 72: 73:
74: protected $program;
75:
76: 77: 78: 79:
80: protected $programversion;
81:
82: 83: 84: 85:
86: protected $algorithm;
87:
88: 89: 90: 91:
92: protected $sourcename;
93:
94: 95: 96: 97:
98: protected $sourceversion;
99:
100: 101: 102: 103:
104: protected $sourceuri;
105:
106: 107: 108: 109: 110:
111: protected $timeexecuted;
112:
113: 114: 115:
116: protected $collQuantifications;
117: protected $collQuantificationsPartial;
118:
119: 120: 121: 122: 123:
124: protected $alreadyInSave = false;
125:
126: 127: 128: 129: 130:
131: protected $alreadyInValidation = false;
132:
133: 134: 135: 136:
137: protected $alreadyInClearAllReferencesDeep = false;
138:
139: 140: 141: 142:
143: protected $quantificationsScheduledForDeletion = null;
144:
145: 146: 147: 148: 149: 150:
151: public function applyDefaultValues()
152: {
153: }
154:
155: 156: 157: 158:
159: public function __construct()
160: {
161: parent::__construct();
162: $this->applyDefaultValues();
163: }
164:
165: 166: 167: 168: 169:
170: public function getAnalysisId()
171: {
172: return $this->analysis_id;
173: }
174:
175: 176: 177: 178: 179:
180: public function getName()
181: {
182: return $this->name;
183: }
184:
185: 186: 187: 188: 189:
190: public function getDescription()
191: {
192: return $this->description;
193: }
194:
195: 196: 197: 198: 199:
200: public function getProgram()
201: {
202: return $this->program;
203: }
204:
205: 206: 207: 208: 209:
210: public function getProgramversion()
211: {
212: return $this->programversion;
213: }
214:
215: 216: 217: 218: 219:
220: public function getAlgorithm()
221: {
222: return $this->algorithm;
223: }
224:
225: 226: 227: 228: 229:
230: public function getSourcename()
231: {
232: return $this->sourcename;
233: }
234:
235: 236: 237: 238: 239:
240: public function getSourceversion()
241: {
242: return $this->sourceversion;
243: }
244:
245: 246: 247: 248: 249:
250: public function getSourceuri()
251: {
252: return $this->sourceuri;
253: }
254:
255: 256: 257: 258: 259: 260: 261: 262: 263:
264: public function getTimeexecuted($format = 'Y-m-d H:i:s')
265: {
266: if ($this->timeexecuted === null) {
267: return null;
268: }
269:
270:
271: try {
272: $dt = new DateTime($this->timeexecuted);
273: } catch (Exception $x) {
274: throw new PropelException("Internally stored date/time/timestamp value could not be converted to DateTime: " . var_export($this->timeexecuted, true), $x);
275: }
276:
277: if ($format === null) {
278:
279: return $dt;
280: }
281:
282: if (strpos($format, '%') !== false) {
283: return strftime($format, $dt->format('U'));
284: }
285:
286: return $dt->format($format);
287:
288: }
289:
290: 291: 292: 293: 294: 295:
296: public function setAnalysisId($v)
297: {
298: if ($v !== null && is_numeric($v)) {
299: $v = (int) $v;
300: }
301:
302: if ($this->analysis_id !== $v) {
303: $this->analysis_id = $v;
304: $this->modifiedColumns[] = AnalysisPeer::ANALYSIS_ID;
305: }
306:
307:
308: return $this;
309: }
310:
311: 312: 313: 314: 315: 316:
317: public function setName($v)
318: {
319: if ($v !== null && is_numeric($v)) {
320: $v = (string) $v;
321: }
322:
323: if ($this->name !== $v) {
324: $this->name = $v;
325: $this->modifiedColumns[] = AnalysisPeer::NAME;
326: }
327:
328:
329: return $this;
330: }
331:
332: 333: 334: 335: 336: 337:
338: public function setDescription($v)
339: {
340: if ($v !== null && is_numeric($v)) {
341: $v = (string) $v;
342: }
343:
344: if ($this->description !== $v) {
345: $this->description = $v;
346: $this->modifiedColumns[] = AnalysisPeer::DESCRIPTION;
347: }
348:
349:
350: return $this;
351: }
352:
353: 354: 355: 356: 357: 358:
359: public function setProgram($v)
360: {
361: if ($v !== null && is_numeric($v)) {
362: $v = (string) $v;
363: }
364:
365: if ($this->program !== $v) {
366: $this->program = $v;
367: $this->modifiedColumns[] = AnalysisPeer::PROGRAM;
368: }
369:
370:
371: return $this;
372: }
373:
374: 375: 376: 377: 378: 379:
380: public function setProgramversion($v)
381: {
382: if ($v !== null && is_numeric($v)) {
383: $v = (string) $v;
384: }
385:
386: if ($this->programversion !== $v) {
387: $this->programversion = $v;
388: $this->modifiedColumns[] = AnalysisPeer::PROGRAMVERSION;
389: }
390:
391:
392: return $this;
393: }
394:
395: 396: 397: 398: 399: 400:
401: public function setAlgorithm($v)
402: {
403: if ($v !== null && is_numeric($v)) {
404: $v = (string) $v;
405: }
406:
407: if ($this->algorithm !== $v) {
408: $this->algorithm = $v;
409: $this->modifiedColumns[] = AnalysisPeer::ALGORITHM;
410: }
411:
412:
413: return $this;
414: }
415:
416: 417: 418: 419: 420: 421:
422: public function setSourcename($v)
423: {
424: if ($v !== null && is_numeric($v)) {
425: $v = (string) $v;
426: }
427:
428: if ($this->sourcename !== $v) {
429: $this->sourcename = $v;
430: $this->modifiedColumns[] = AnalysisPeer::SOURCENAME;
431: }
432:
433:
434: return $this;
435: }
436:
437: 438: 439: 440: 441: 442:
443: public function setSourceversion($v)
444: {
445: if ($v !== null && is_numeric($v)) {
446: $v = (string) $v;
447: }
448:
449: if ($this->sourceversion !== $v) {
450: $this->sourceversion = $v;
451: $this->modifiedColumns[] = AnalysisPeer::SOURCEVERSION;
452: }
453:
454:
455: return $this;
456: }
457:
458: 459: 460: 461: 462: 463:
464: public function setSourceuri($v)
465: {
466: if ($v !== null && is_numeric($v)) {
467: $v = (string) $v;
468: }
469:
470: if ($this->sourceuri !== $v) {
471: $this->sourceuri = $v;
472: $this->modifiedColumns[] = AnalysisPeer::SOURCEURI;
473: }
474:
475:
476: return $this;
477: }
478:
479: 480: 481: 482: 483: 484: 485:
486: public function setTimeexecuted($v)
487: {
488: $dt = PropelDateTime::newInstance($v, null, 'DateTime');
489: if ($this->timeexecuted !== null || $dt !== null) {
490: $currentDateAsString = ($this->timeexecuted !== null && $tmpDt = new DateTime($this->timeexecuted)) ? $tmpDt->format('Y-m-d H:i:s') : null;
491: $newDateAsString = $dt ? $dt->format('Y-m-d H:i:s') : null;
492: if ($currentDateAsString !== $newDateAsString) {
493: $this->timeexecuted = $newDateAsString;
494: $this->modifiedColumns[] = AnalysisPeer::TIMEEXECUTED;
495: }
496: }
497:
498:
499: return $this;
500: }
501:
502: 503: 504: 505: 506: 507: 508: 509:
510: public function hasOnlyDefaultValues()
511: {
512:
513: return true;
514: }
515:
516: 517: 518: 519: 520: 521: 522: 523: 524: 525: 526: 527: 528: 529:
530: public function hydrate($row, $startcol = 0, $rehydrate = false)
531: {
532: try {
533:
534: $this->analysis_id = ($row[$startcol + 0] !== null) ? (int) $row[$startcol + 0] : null;
535: $this->name = ($row[$startcol + 1] !== null) ? (string) $row[$startcol + 1] : null;
536: $this->description = ($row[$startcol + 2] !== null) ? (string) $row[$startcol + 2] : null;
537: $this->program = ($row[$startcol + 3] !== null) ? (string) $row[$startcol + 3] : null;
538: $this->programversion = ($row[$startcol + 4] !== null) ? (string) $row[$startcol + 4] : null;
539: $this->algorithm = ($row[$startcol + 5] !== null) ? (string) $row[$startcol + 5] : null;
540: $this->sourcename = ($row[$startcol + 6] !== null) ? (string) $row[$startcol + 6] : null;
541: $this->sourceversion = ($row[$startcol + 7] !== null) ? (string) $row[$startcol + 7] : null;
542: $this->sourceuri = ($row[$startcol + 8] !== null) ? (string) $row[$startcol + 8] : null;
543: $this->timeexecuted = ($row[$startcol + 9] !== null) ? (string) $row[$startcol + 9] : null;
544: $this->resetModified();
545:
546: $this->setNew(false);
547:
548: if ($rehydrate) {
549: $this->ensureConsistency();
550: }
551: $this->postHydrate($row, $startcol, $rehydrate);
552: return $startcol + 10;
553:
554: } catch (Exception $e) {
555: throw new PropelException("Error populating Analysis object", $e);
556: }
557: }
558:
559: 560: 561: 562: 563: 564: 565: 566: 567: 568: 569: 570: 571:
572: public function ensureConsistency()
573: {
574:
575: }
576:
577: 578: 579: 580: 581: 582: 583: 584: 585: 586:
587: public function reload($deep = false, PropelPDO $con = null)
588: {
589: if ($this->isDeleted()) {
590: throw new PropelException("Cannot reload a deleted object.");
591: }
592:
593: if ($this->isNew()) {
594: throw new PropelException("Cannot reload an unsaved object.");
595: }
596:
597: if ($con === null) {
598: $con = Propel::getConnection(AnalysisPeer::DATABASE_NAME, Propel::CONNECTION_READ);
599: }
600:
601:
602:
603:
604: $stmt = AnalysisPeer::doSelectStmt($this->buildPkeyCriteria(), $con);
605: $row = $stmt->fetch(PDO::FETCH_NUM);
606: $stmt->closeCursor();
607: if (!$row) {
608: throw new PropelException('Cannot find matching row in the database to reload object values.');
609: }
610: $this->hydrate($row, 0, true);
611:
612: if ($deep) {
613:
614: $this->collQuantifications = null;
615:
616: }
617: }
618:
619: 620: 621: 622: 623: 624: 625: 626: 627: 628:
629: public function delete(PropelPDO $con = null)
630: {
631: if ($this->isDeleted()) {
632: throw new PropelException("This object has already been deleted.");
633: }
634:
635: if ($con === null) {
636: $con = Propel::getConnection(AnalysisPeer::DATABASE_NAME, Propel::CONNECTION_WRITE);
637: }
638:
639: $con->beginTransaction();
640: try {
641: $deleteQuery = AnalysisQuery::create()
642: ->filterByPrimaryKey($this->getPrimaryKey());
643: $ret = $this->preDelete($con);
644: if ($ret) {
645: $deleteQuery->delete($con);
646: $this->postDelete($con);
647: $con->commit();
648: $this->setDeleted(true);
649: } else {
650: $con->commit();
651: }
652: } catch (Exception $e) {
653: $con->rollBack();
654: throw $e;
655: }
656: }
657:
658: 659: 660: 661: 662: 663: 664: 665: 666: 667: 668: 669: 670: 671:
672: public function save(PropelPDO $con = null)
673: {
674: if ($this->isDeleted()) {
675: throw new PropelException("You cannot save an object that has been deleted.");
676: }
677:
678: if ($con === null) {
679: $con = Propel::getConnection(AnalysisPeer::DATABASE_NAME, Propel::CONNECTION_WRITE);
680: }
681:
682: $con->beginTransaction();
683: $isInsert = $this->isNew();
684: try {
685: $ret = $this->preSave($con);
686: if ($isInsert) {
687: $ret = $ret && $this->preInsert($con);
688: } else {
689: $ret = $ret && $this->preUpdate($con);
690: }
691: if ($ret) {
692: $affectedRows = $this->doSave($con);
693: if ($isInsert) {
694: $this->postInsert($con);
695: } else {
696: $this->postUpdate($con);
697: }
698: $this->postSave($con);
699: AnalysisPeer::addInstanceToPool($this);
700: } else {
701: $affectedRows = 0;
702: }
703: $con->commit();
704:
705: return $affectedRows;
706: } catch (Exception $e) {
707: $con->rollBack();
708: throw $e;
709: }
710: }
711:
712: 713: 714: 715: 716: 717: 718: 719: 720: 721: 722:
723: protected function doSave(PropelPDO $con)
724: {
725: $affectedRows = 0;
726: if (!$this->alreadyInSave) {
727: $this->alreadyInSave = true;
728:
729: if ($this->isNew() || $this->isModified()) {
730:
731: if ($this->isNew()) {
732: $this->doInsert($con);
733: } else {
734: $this->doUpdate($con);
735: }
736: $affectedRows += 1;
737: $this->resetModified();
738: }
739:
740: if ($this->quantificationsScheduledForDeletion !== null) {
741: if (!$this->quantificationsScheduledForDeletion->isEmpty()) {
742: QuantificationQuery::create()
743: ->filterByPrimaryKeys($this->quantificationsScheduledForDeletion->getPrimaryKeys(false))
744: ->delete($con);
745: $this->quantificationsScheduledForDeletion = null;
746: }
747: }
748:
749: if ($this->collQuantifications !== null) {
750: foreach ($this->collQuantifications as $referrerFK) {
751: if (!$referrerFK->isDeleted() && ($referrerFK->isNew() || $referrerFK->isModified())) {
752: $affectedRows += $referrerFK->save($con);
753: }
754: }
755: }
756:
757: $this->alreadyInSave = false;
758:
759: }
760:
761: return $affectedRows;
762: }
763:
764: 765: 766: 767: 768: 769: 770: 771:
772: protected function doInsert(PropelPDO $con)
773: {
774: $modifiedColumns = array();
775: $index = 0;
776:
777: $this->modifiedColumns[] = AnalysisPeer::ANALYSIS_ID;
778: if (null !== $this->analysis_id) {
779: throw new PropelException('Cannot insert a value for auto-increment primary key (' . AnalysisPeer::ANALYSIS_ID . ')');
780: }
781: if (null === $this->analysis_id) {
782: try {
783: $stmt = $con->query("SELECT nextval('analysis_analysis_id_seq')");
784: $row = $stmt->fetch(PDO::FETCH_NUM);
785: $this->analysis_id = $row[0];
786: } catch (Exception $e) {
787: throw new PropelException('Unable to get sequence id.', $e);
788: }
789: }
790:
791:
792:
793: if ($this->isColumnModified(AnalysisPeer::ANALYSIS_ID)) {
794: $modifiedColumns[':p' . $index++] = '"analysis_id"';
795: }
796: if ($this->isColumnModified(AnalysisPeer::NAME)) {
797: $modifiedColumns[':p' . $index++] = '"name"';
798: }
799: if ($this->isColumnModified(AnalysisPeer::DESCRIPTION)) {
800: $modifiedColumns[':p' . $index++] = '"description"';
801: }
802: if ($this->isColumnModified(AnalysisPeer::PROGRAM)) {
803: $modifiedColumns[':p' . $index++] = '"program"';
804: }
805: if ($this->isColumnModified(AnalysisPeer::PROGRAMVERSION)) {
806: $modifiedColumns[':p' . $index++] = '"programversion"';
807: }
808: if ($this->isColumnModified(AnalysisPeer::ALGORITHM)) {
809: $modifiedColumns[':p' . $index++] = '"algorithm"';
810: }
811: if ($this->isColumnModified(AnalysisPeer::SOURCENAME)) {
812: $modifiedColumns[':p' . $index++] = '"sourcename"';
813: }
814: if ($this->isColumnModified(AnalysisPeer::SOURCEVERSION)) {
815: $modifiedColumns[':p' . $index++] = '"sourceversion"';
816: }
817: if ($this->isColumnModified(AnalysisPeer::SOURCEURI)) {
818: $modifiedColumns[':p' . $index++] = '"sourceuri"';
819: }
820: if ($this->isColumnModified(AnalysisPeer::TIMEEXECUTED)) {
821: $modifiedColumns[':p' . $index++] = '"timeexecuted"';
822: }
823:
824: $sql = sprintf(
825: 'INSERT INTO "analysis" (%s) VALUES (%s)',
826: implode(', ', $modifiedColumns),
827: implode(', ', array_keys($modifiedColumns))
828: );
829:
830: try {
831: $stmt = $con->prepare($sql);
832: foreach ($modifiedColumns as $identifier => $columnName) {
833: switch ($columnName) {
834: case '"analysis_id"':
835: $stmt->bindValue($identifier, $this->analysis_id, PDO::PARAM_INT);
836: break;
837: case '"name"':
838: $stmt->bindValue($identifier, $this->name, PDO::PARAM_STR);
839: break;
840: case '"description"':
841: $stmt->bindValue($identifier, $this->description, PDO::PARAM_STR);
842: break;
843: case '"program"':
844: $stmt->bindValue($identifier, $this->program, PDO::PARAM_STR);
845: break;
846: case '"programversion"':
847: $stmt->bindValue($identifier, $this->programversion, PDO::PARAM_STR);
848: break;
849: case '"algorithm"':
850: $stmt->bindValue($identifier, $this->algorithm, PDO::PARAM_STR);
851: break;
852: case '"sourcename"':
853: $stmt->bindValue($identifier, $this->sourcename, PDO::PARAM_STR);
854: break;
855: case '"sourceversion"':
856: $stmt->bindValue($identifier, $this->sourceversion, PDO::PARAM_STR);
857: break;
858: case '"sourceuri"':
859: $stmt->bindValue($identifier, $this->sourceuri, PDO::PARAM_STR);
860: break;
861: case '"timeexecuted"':
862: $stmt->bindValue($identifier, $this->timeexecuted, PDO::PARAM_STR);
863: break;
864: }
865: }
866: $stmt->execute();
867: } catch (Exception $e) {
868: Propel::log($e->getMessage(), Propel::LOG_ERR);
869: throw new PropelException(sprintf('Unable to execute INSERT statement [%s]', $sql), $e);
870: }
871:
872: $this->setNew(false);
873: }
874:
875: 876: 877: 878: 879: 880: 881:
882: protected function doUpdate(PropelPDO $con)
883: {
884: $selectCriteria = $this->buildPkeyCriteria();
885: $valuesCriteria = $this->buildCriteria();
886: BasePeer::doUpdate($selectCriteria, $valuesCriteria, $con);
887: }
888:
889: 890: 891: 892:
893: protected $validationFailures = array();
894:
895: 896: 897: 898: 899: 900: 901:
902: public function getValidationFailures()
903: {
904: return $this->validationFailures;
905: }
906:
907: 908: 909: 910: 911: 912: 913: 914: 915: 916: 917:
918: public function validate($columns = null)
919: {
920: $res = $this->doValidate($columns);
921: if ($res === true) {
922: $this->validationFailures = array();
923:
924: return true;
925: }
926:
927: $this->validationFailures = $res;
928:
929: return false;
930: }
931:
932: 933: 934: 935: 936: 937: 938: 939: 940: 941:
942: protected function doValidate($columns = null)
943: {
944: if (!$this->alreadyInValidation) {
945: $this->alreadyInValidation = true;
946: $retval = null;
947:
948: $failureMap = array();
949:
950:
951: if (($retval = AnalysisPeer::doValidate($this, $columns)) !== true) {
952: $failureMap = array_merge($failureMap, $retval);
953: }
954:
955:
956: if ($this->collQuantifications !== null) {
957: foreach ($this->collQuantifications as $referrerFK) {
958: if (!$referrerFK->validate($columns)) {
959: $failureMap = array_merge($failureMap, $referrerFK->getValidationFailures());
960: }
961: }
962: }
963:
964:
965: $this->alreadyInValidation = false;
966: }
967:
968: return (!empty($failureMap) ? $failureMap : true);
969: }
970:
971: 972: 973: 974: 975: 976: 977: 978: 979: 980:
981: public function getByName($name, $type = BasePeer::TYPE_PHPNAME)
982: {
983: $pos = AnalysisPeer::translateFieldName($name, $type, BasePeer::TYPE_NUM);
984: $field = $this->getByPosition($pos);
985:
986: return $field;
987: }
988:
989: 990: 991: 992: 993: 994: 995:
996: public function getByPosition($pos)
997: {
998: switch ($pos) {
999: case 0:
1000: return $this->getAnalysisId();
1001: break;
1002: case 1:
1003: return $this->getName();
1004: break;
1005: case 2:
1006: return $this->getDescription();
1007: break;
1008: case 3:
1009: return $this->getProgram();
1010: break;
1011: case 4:
1012: return $this->getProgramversion();
1013: break;
1014: case 5:
1015: return $this->getAlgorithm();
1016: break;
1017: case 6:
1018: return $this->getSourcename();
1019: break;
1020: case 7:
1021: return $this->getSourceversion();
1022: break;
1023: case 8:
1024: return $this->getSourceuri();
1025: break;
1026: case 9:
1027: return $this->getTimeexecuted();
1028: break;
1029: default:
1030: return null;
1031: break;
1032: }
1033: }
1034:
1035: 1036: 1037: 1038: 1039: 1040: 1041: 1042: 1043: 1044: 1045: 1046: 1047: 1048: 1049:
1050: public function toArray($keyType = BasePeer::TYPE_PHPNAME, $includeLazyLoadColumns = true, $alreadyDumpedObjects = array(), $includeForeignObjects = false)
1051: {
1052: if (isset($alreadyDumpedObjects['Analysis'][$this->getPrimaryKey()])) {
1053: return '*RECURSION*';
1054: }
1055: $alreadyDumpedObjects['Analysis'][$this->getPrimaryKey()] = true;
1056: $keys = AnalysisPeer::getFieldNames($keyType);
1057: $result = array(
1058: $keys[0] => $this->getAnalysisId(),
1059: $keys[1] => $this->getName(),
1060: $keys[2] => $this->getDescription(),
1061: $keys[3] => $this->getProgram(),
1062: $keys[4] => $this->getProgramversion(),
1063: $keys[5] => $this->getAlgorithm(),
1064: $keys[6] => $this->getSourcename(),
1065: $keys[7] => $this->getSourceversion(),
1066: $keys[8] => $this->getSourceuri(),
1067: $keys[9] => $this->getTimeexecuted(),
1068: );
1069: if ($includeForeignObjects) {
1070: if (null !== $this->collQuantifications) {
1071: $result['Quantifications'] = $this->collQuantifications->toArray(null, true, $keyType, $includeLazyLoadColumns, $alreadyDumpedObjects);
1072: }
1073: }
1074:
1075: return $result;
1076: }
1077:
1078: 1079: 1080: 1081: 1082: 1083: 1084: 1085: 1086: 1087: 1088:
1089: public function setByName($name, $value, $type = BasePeer::TYPE_PHPNAME)
1090: {
1091: $pos = AnalysisPeer::translateFieldName($name, $type, BasePeer::TYPE_NUM);
1092:
1093: $this->setByPosition($pos, $value);
1094: }
1095:
1096: 1097: 1098: 1099: 1100: 1101: 1102: 1103:
1104: public function setByPosition($pos, $value)
1105: {
1106: switch ($pos) {
1107: case 0:
1108: $this->setAnalysisId($value);
1109: break;
1110: case 1:
1111: $this->setName($value);
1112: break;
1113: case 2:
1114: $this->setDescription($value);
1115: break;
1116: case 3:
1117: $this->setProgram($value);
1118: break;
1119: case 4:
1120: $this->setProgramversion($value);
1121: break;
1122: case 5:
1123: $this->setAlgorithm($value);
1124: break;
1125: case 6:
1126: $this->setSourcename($value);
1127: break;
1128: case 7:
1129: $this->setSourceversion($value);
1130: break;
1131: case 8:
1132: $this->setSourceuri($value);
1133: break;
1134: case 9:
1135: $this->setTimeexecuted($value);
1136: break;
1137: }
1138: }
1139:
1140: 1141: 1142: 1143: 1144: 1145: 1146: 1147: 1148: 1149: 1150: 1151: 1152: 1153: 1154: 1155: 1156:
1157: public function fromArray($arr, $keyType = BasePeer::TYPE_PHPNAME)
1158: {
1159: $keys = AnalysisPeer::getFieldNames($keyType);
1160:
1161: if (array_key_exists($keys[0], $arr)) $this->setAnalysisId($arr[$keys[0]]);
1162: if (array_key_exists($keys[1], $arr)) $this->setName($arr[$keys[1]]);
1163: if (array_key_exists($keys[2], $arr)) $this->setDescription($arr[$keys[2]]);
1164: if (array_key_exists($keys[3], $arr)) $this->setProgram($arr[$keys[3]]);
1165: if (array_key_exists($keys[4], $arr)) $this->setProgramversion($arr[$keys[4]]);
1166: if (array_key_exists($keys[5], $arr)) $this->setAlgorithm($arr[$keys[5]]);
1167: if (array_key_exists($keys[6], $arr)) $this->setSourcename($arr[$keys[6]]);
1168: if (array_key_exists($keys[7], $arr)) $this->setSourceversion($arr[$keys[7]]);
1169: if (array_key_exists($keys[8], $arr)) $this->setSourceuri($arr[$keys[8]]);
1170: if (array_key_exists($keys[9], $arr)) $this->setTimeexecuted($arr[$keys[9]]);
1171: }
1172:
1173: 1174: 1175: 1176: 1177:
1178: public function buildCriteria()
1179: {
1180: $criteria = new Criteria(AnalysisPeer::DATABASE_NAME);
1181:
1182: if ($this->isColumnModified(AnalysisPeer::ANALYSIS_ID)) $criteria->add(AnalysisPeer::ANALYSIS_ID, $this->analysis_id);
1183: if ($this->isColumnModified(AnalysisPeer::NAME)) $criteria->add(AnalysisPeer::NAME, $this->name);
1184: if ($this->isColumnModified(AnalysisPeer::DESCRIPTION)) $criteria->add(AnalysisPeer::DESCRIPTION, $this->description);
1185: if ($this->isColumnModified(AnalysisPeer::PROGRAM)) $criteria->add(AnalysisPeer::PROGRAM, $this->program);
1186: if ($this->isColumnModified(AnalysisPeer::PROGRAMVERSION)) $criteria->add(AnalysisPeer::PROGRAMVERSION, $this->programversion);
1187: if ($this->isColumnModified(AnalysisPeer::ALGORITHM)) $criteria->add(AnalysisPeer::ALGORITHM, $this->algorithm);
1188: if ($this->isColumnModified(AnalysisPeer::SOURCENAME)) $criteria->add(AnalysisPeer::SOURCENAME, $this->sourcename);
1189: if ($this->isColumnModified(AnalysisPeer::SOURCEVERSION)) $criteria->add(AnalysisPeer::SOURCEVERSION, $this->sourceversion);
1190: if ($this->isColumnModified(AnalysisPeer::SOURCEURI)) $criteria->add(AnalysisPeer::SOURCEURI, $this->sourceuri);
1191: if ($this->isColumnModified(AnalysisPeer::TIMEEXECUTED)) $criteria->add(AnalysisPeer::TIMEEXECUTED, $this->timeexecuted);
1192:
1193: return $criteria;
1194: }
1195:
1196: 1197: 1198: 1199: 1200: 1201: 1202: 1203:
1204: public function buildPkeyCriteria()
1205: {
1206: $criteria = new Criteria(AnalysisPeer::DATABASE_NAME);
1207: $criteria->add(AnalysisPeer::ANALYSIS_ID, $this->analysis_id);
1208:
1209: return $criteria;
1210: }
1211:
1212: 1213: 1214: 1215:
1216: public function getPrimaryKey()
1217: {
1218: return $this->getAnalysisId();
1219: }
1220:
1221: 1222: 1223: 1224: 1225: 1226:
1227: public function setPrimaryKey($key)
1228: {
1229: $this->setAnalysisId($key);
1230: }
1231:
1232: 1233: 1234: 1235:
1236: public function isPrimaryKeyNull()
1237: {
1238:
1239: return null === $this->getAnalysisId();
1240: }
1241:
1242: 1243: 1244: 1245: 1246: 1247: 1248: 1249: 1250: 1251: 1252:
1253: public function copyInto($copyObj, $deepCopy = false, $makeNew = true)
1254: {
1255: $copyObj->setName($this->getName());
1256: $copyObj->setDescription($this->getDescription());
1257: $copyObj->setProgram($this->getProgram());
1258: $copyObj->setProgramversion($this->getProgramversion());
1259: $copyObj->setAlgorithm($this->getAlgorithm());
1260: $copyObj->setSourcename($this->getSourcename());
1261: $copyObj->setSourceversion($this->getSourceversion());
1262: $copyObj->setSourceuri($this->getSourceuri());
1263: $copyObj->setTimeexecuted($this->getTimeexecuted());
1264:
1265: if ($deepCopy && !$this->startCopy) {
1266:
1267:
1268: $copyObj->setNew(false);
1269:
1270: $this->startCopy = true;
1271:
1272: foreach ($this->getQuantifications() as $relObj) {
1273: if ($relObj !== $this) {
1274: $copyObj->addQuantification($relObj->copy($deepCopy));
1275: }
1276: }
1277:
1278:
1279: $this->startCopy = false;
1280: }
1281:
1282: if ($makeNew) {
1283: $copyObj->setNew(true);
1284: $copyObj->setAnalysisId(NULL);
1285: }
1286: }
1287:
1288: 1289: 1290: 1291: 1292: 1293: 1294: 1295: 1296: 1297: 1298: 1299:
1300: public function copy($deepCopy = false)
1301: {
1302:
1303: $clazz = get_class($this);
1304: $copyObj = new $clazz();
1305: $this->copyInto($copyObj, $deepCopy);
1306:
1307: return $copyObj;
1308: }
1309:
1310: 1311: 1312: 1313: 1314: 1315: 1316: 1317: 1318:
1319: public function getPeer()
1320: {
1321: if (self::$peer === null) {
1322: self::$peer = new AnalysisPeer();
1323: }
1324:
1325: return self::$peer;
1326: }
1327:
1328:
1329: 1330: 1331: 1332: 1333: 1334: 1335: 1336:
1337: public function initRelation($relationName)
1338: {
1339: if ('Quantification' == $relationName) {
1340: $this->initQuantifications();
1341: }
1342: }
1343:
1344: 1345: 1346: 1347: 1348: 1349: 1350: 1351: 1352:
1353: public function clearQuantifications()
1354: {
1355: $this->collQuantifications = null;
1356: $this->collQuantificationsPartial = null;
1357:
1358: return $this;
1359: }
1360:
1361: 1362: 1363: 1364: 1365:
1366: public function resetPartialQuantifications($v = true)
1367: {
1368: $this->collQuantificationsPartial = $v;
1369: }
1370:
1371: 1372: 1373: 1374: 1375: 1376: 1377: 1378: 1379: 1380: 1381: 1382:
1383: public function initQuantifications($overrideExisting = true)
1384: {
1385: if (null !== $this->collQuantifications && !$overrideExisting) {
1386: return;
1387: }
1388: $this->collQuantifications = new PropelObjectCollection();
1389: $this->collQuantifications->setModel('Quantification');
1390: }
1391:
1392: 1393: 1394: 1395: 1396: 1397: 1398: 1399: 1400: 1401: 1402: 1403: 1404: 1405:
1406: public function getQuantifications($criteria = null, PropelPDO $con = null)
1407: {
1408: $partial = $this->collQuantificationsPartial && !$this->isNew();
1409: if (null === $this->collQuantifications || null !== $criteria || $partial) {
1410: if ($this->isNew() && null === $this->collQuantifications) {
1411:
1412: $this->initQuantifications();
1413: } else {
1414: $collQuantifications = QuantificationQuery::create(null, $criteria)
1415: ->filterByAnalysis($this)
1416: ->find($con);
1417: if (null !== $criteria) {
1418: if (false !== $this->collQuantificationsPartial && count($collQuantifications)) {
1419: $this->initQuantifications(false);
1420:
1421: foreach($collQuantifications as $obj) {
1422: if (false == $this->collQuantifications->contains($obj)) {
1423: $this->collQuantifications->append($obj);
1424: }
1425: }
1426:
1427: $this->collQuantificationsPartial = true;
1428: }
1429:
1430: $collQuantifications->getInternalIterator()->rewind();
1431: return $collQuantifications;
1432: }
1433:
1434: if($partial && $this->collQuantifications) {
1435: foreach($this->collQuantifications as $obj) {
1436: if($obj->isNew()) {
1437: $collQuantifications[] = $obj;
1438: }
1439: }
1440: }
1441:
1442: $this->collQuantifications = $collQuantifications;
1443: $this->collQuantificationsPartial = false;
1444: }
1445: }
1446:
1447: return $this->collQuantifications;
1448: }
1449:
1450: 1451: 1452: 1453: 1454: 1455: 1456: 1457: 1458: 1459:
1460: public function setQuantifications(PropelCollection $quantifications, PropelPDO $con = null)
1461: {
1462: $quantificationsToDelete = $this->getQuantifications(new Criteria(), $con)->diff($quantifications);
1463:
1464: $this->quantificationsScheduledForDeletion = unserialize(serialize($quantificationsToDelete));
1465:
1466: foreach ($quantificationsToDelete as $quantificationRemoved) {
1467: $quantificationRemoved->setAnalysis(null);
1468: }
1469:
1470: $this->collQuantifications = null;
1471: foreach ($quantifications as $quantification) {
1472: $this->addQuantification($quantification);
1473: }
1474:
1475: $this->collQuantifications = $quantifications;
1476: $this->collQuantificationsPartial = false;
1477:
1478: return $this;
1479: }
1480:
1481: 1482: 1483: 1484: 1485: 1486: 1487: 1488: 1489:
1490: public function countQuantifications(Criteria $criteria = null, $distinct = false, PropelPDO $con = null)
1491: {
1492: $partial = $this->collQuantificationsPartial && !$this->isNew();
1493: if (null === $this->collQuantifications || null !== $criteria || $partial) {
1494: if ($this->isNew() && null === $this->collQuantifications) {
1495: return 0;
1496: }
1497:
1498: if($partial && !$criteria) {
1499: return count($this->getQuantifications());
1500: }
1501: $query = QuantificationQuery::create(null, $criteria);
1502: if ($distinct) {
1503: $query->distinct();
1504: }
1505:
1506: return $query
1507: ->filterByAnalysis($this)
1508: ->count($con);
1509: }
1510:
1511: return count($this->collQuantifications);
1512: }
1513:
1514: 1515: 1516: 1517: 1518: 1519: 1520:
1521: public function addQuantification(Quantification $l)
1522: {
1523: if ($this->collQuantifications === null) {
1524: $this->initQuantifications();
1525: $this->collQuantificationsPartial = true;
1526: }
1527: if (!in_array($l, $this->collQuantifications->getArrayCopy(), true)) {
1528: $this->doAddQuantification($l);
1529: }
1530:
1531: return $this;
1532: }
1533:
1534: 1535: 1536:
1537: protected function doAddQuantification($quantification)
1538: {
1539: $this->collQuantifications[]= $quantification;
1540: $quantification->setAnalysis($this);
1541: }
1542:
1543: 1544: 1545: 1546:
1547: public function removeQuantification($quantification)
1548: {
1549: if ($this->getQuantifications()->contains($quantification)) {
1550: $this->collQuantifications->remove($this->collQuantifications->search($quantification));
1551: if (null === $this->quantificationsScheduledForDeletion) {
1552: $this->quantificationsScheduledForDeletion = clone $this->collQuantifications;
1553: $this->quantificationsScheduledForDeletion->clear();
1554: }
1555: $this->quantificationsScheduledForDeletion[]= clone $quantification;
1556: $quantification->setAnalysis(null);
1557: }
1558:
1559: return $this;
1560: }
1561:
1562:
1563: 1564: 1565: 1566: 1567: 1568: 1569: 1570: 1571: 1572: 1573: 1574: 1575: 1576: 1577: 1578:
1579: public function getQuantificationsJoinAcquisition($criteria = null, $con = null, $join_behavior = Criteria::LEFT_JOIN)
1580: {
1581: $query = QuantificationQuery::create(null, $criteria);
1582: $query->joinWith('Acquisition', $join_behavior);
1583:
1584: return $this->getQuantifications($query, $con);
1585: }
1586:
1587:
1588: 1589: 1590: 1591: 1592: 1593: 1594: 1595: 1596: 1597: 1598: 1599: 1600: 1601: 1602: 1603:
1604: public function getQuantificationsJoinContact($criteria = null, $con = null, $join_behavior = Criteria::LEFT_JOIN)
1605: {
1606: $query = QuantificationQuery::create(null, $criteria);
1607: $query->joinWith('Contact', $join_behavior);
1608:
1609: return $this->getQuantifications($query, $con);
1610: }
1611:
1612:
1613: 1614: 1615: 1616: 1617: 1618: 1619: 1620: 1621: 1622: 1623: 1624: 1625: 1626: 1627: 1628:
1629: public function getQuantificationsJoinProtocol($criteria = null, $con = null, $join_behavior = Criteria::LEFT_JOIN)
1630: {
1631: $query = QuantificationQuery::create(null, $criteria);
1632: $query->joinWith('Protocol', $join_behavior);
1633:
1634: return $this->getQuantifications($query, $con);
1635: }
1636:
1637: 1638: 1639:
1640: public function clear()
1641: {
1642: $this->analysis_id = null;
1643: $this->name = null;
1644: $this->description = null;
1645: $this->program = null;
1646: $this->programversion = null;
1647: $this->algorithm = null;
1648: $this->sourcename = null;
1649: $this->sourceversion = null;
1650: $this->sourceuri = null;
1651: $this->timeexecuted = null;
1652: $this->alreadyInSave = false;
1653: $this->alreadyInValidation = false;
1654: $this->alreadyInClearAllReferencesDeep = false;
1655: $this->clearAllReferences();
1656: $this->applyDefaultValues();
1657: $this->resetModified();
1658: $this->setNew(true);
1659: $this->setDeleted(false);
1660: }
1661:
1662: 1663: 1664: 1665: 1666: 1667: 1668: 1669: 1670:
1671: public function clearAllReferences($deep = false)
1672: {
1673: if ($deep && !$this->alreadyInClearAllReferencesDeep) {
1674: $this->alreadyInClearAllReferencesDeep = true;
1675: if ($this->collQuantifications) {
1676: foreach ($this->collQuantifications as $o) {
1677: $o->clearAllReferences($deep);
1678: }
1679: }
1680:
1681: $this->alreadyInClearAllReferencesDeep = false;
1682: }
1683:
1684: if ($this->collQuantifications instanceof PropelCollection) {
1685: $this->collQuantifications->clearIterator();
1686: }
1687: $this->collQuantifications = null;
1688: }
1689:
1690: 1691: 1692: 1693: 1694:
1695: public function __toString()
1696: {
1697: return (string) $this->exportTo(AnalysisPeer::DEFAULT_STRING_FORMAT);
1698: }
1699:
1700: 1701: 1702: 1703: 1704:
1705: public function isAlreadyInSave()
1706: {
1707: return $this->alreadyInSave;
1708: }
1709:
1710: }
1711: