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