1: <?php
2:
3: namespace Thelia\Model\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 Thelia\Model\CouponOrder;
19: use Thelia\Model\CouponOrderQuery;
20: use Thelia\Model\Currency;
21: use Thelia\Model\CurrencyQuery;
22: use Thelia\Model\Customer;
23: use Thelia\Model\CustomerQuery;
24: use Thelia\Model\Order;
25: use Thelia\Model\OrderAddress;
26: use Thelia\Model\OrderAddressQuery;
27: use Thelia\Model\OrderPeer;
28: use Thelia\Model\OrderProduct;
29: use Thelia\Model\OrderProductQuery;
30: use Thelia\Model\OrderQuery;
31: use Thelia\Model\OrderStatus;
32: use Thelia\Model\OrderStatusQuery;
33:
34: 35: 36: 37: 38: 39: 40:
41: abstract class BaseOrder extends BaseObject implements Persistent
42: {
43: 44: 45:
46: const PEER = 'Thelia\\Model\\OrderPeer';
47:
48: 49: 50: 51: 52: 53:
54: protected static $peer;
55:
56: 57: 58: 59:
60: protected $startCopy = false;
61:
62: 63: 64: 65:
66: protected $id;
67:
68: 69: 70: 71:
72: protected $ref;
73:
74: 75: 76: 77:
78: protected $customer_id;
79:
80: 81: 82: 83:
84: protected $address_invoice;
85:
86: 87: 88: 89:
90: protected $address_delivery;
91:
92: 93: 94: 95:
96: protected $invoice_date;
97:
98: 99: 100: 101:
102: protected $currency_id;
103:
104: 105: 106: 107:
108: protected $currency_rate;
109:
110: 111: 112: 113:
114: protected $transaction;
115:
116: 117: 118: 119:
120: protected $delivery_num;
121:
122: 123: 124: 125:
126: protected $invoice;
127:
128: 129: 130: 131:
132: protected $postage;
133:
134: 135: 136: 137:
138: protected $payment;
139:
140: 141: 142: 143:
144: protected $carrier;
145:
146: 147: 148: 149:
150: protected $status_id;
151:
152: 153: 154: 155:
156: protected $lang;
157:
158: 159: 160: 161:
162: protected $created_at;
163:
164: 165: 166: 167:
168: protected $updated_at;
169:
170: 171: 172:
173: protected $aCurrency;
174:
175: 176: 177:
178: protected $aCustomer;
179:
180: 181: 182:
183: protected $aOrderAddressRelatedByAddressInvoice;
184:
185: 186: 187:
188: protected $aOrderAddressRelatedByAddressDelivery;
189:
190: 191: 192:
193: protected $aOrderStatus;
194:
195: 196: 197:
198: protected $collOrderProducts;
199: protected $collOrderProductsPartial;
200:
201: 202: 203:
204: protected $collCouponOrders;
205: protected $collCouponOrdersPartial;
206:
207: 208: 209: 210: 211:
212: protected $alreadyInSave = false;
213:
214: 215: 216: 217: 218:
219: protected $alreadyInValidation = false;
220:
221: 222: 223: 224:
225: protected $alreadyInClearAllReferencesDeep = false;
226:
227: 228: 229: 230:
231: protected $orderProductsScheduledForDeletion = null;
232:
233: 234: 235: 236:
237: protected = null;
238:
239: 240: 241: 242: 243:
244: public function getId()
245: {
246: return $this->id;
247: }
248:
249: 250: 251: 252: 253:
254: public function getRef()
255: {
256: return $this->ref;
257: }
258:
259: 260: 261: 262: 263:
264: public function getCustomerId()
265: {
266: return $this->customer_id;
267: }
268:
269: 270: 271: 272: 273:
274: public function getAddressInvoice()
275: {
276: return $this->address_invoice;
277: }
278:
279: 280: 281: 282: 283:
284: public function getAddressDelivery()
285: {
286: return $this->address_delivery;
287: }
288:
289: 290: 291: 292: 293: 294: 295: 296: 297:
298: public function getInvoiceDate($format = '%x')
299: {
300: if ($this->invoice_date === null) {
301: return null;
302: }
303:
304: if ($this->invoice_date === '0000-00-00') {
305:
306:
307: return null;
308: }
309:
310: try {
311: $dt = new DateTime($this->invoice_date);
312: } catch (Exception $x) {
313: throw new PropelException("Internally stored date/time/timestamp value could not be converted to DateTime: " . var_export($this->invoice_date, true), $x);
314: }
315:
316: if ($format === null) {
317:
318: return $dt;
319: }
320:
321: if (strpos($format, '%') !== false) {
322: return strftime($format, $dt->format('U'));
323: }
324:
325: return $dt->format($format);
326:
327: }
328:
329: 330: 331: 332: 333:
334: public function getCurrencyId()
335: {
336: return $this->currency_id;
337: }
338:
339: 340: 341: 342: 343:
344: public function getCurrencyRate()
345: {
346: return $this->currency_rate;
347: }
348:
349: 350: 351: 352: 353:
354: public function getTransaction()
355: {
356: return $this->transaction;
357: }
358:
359: 360: 361: 362: 363:
364: public function getDeliveryNum()
365: {
366: return $this->delivery_num;
367: }
368:
369: 370: 371: 372: 373:
374: public function getInvoice()
375: {
376: return $this->invoice;
377: }
378:
379: 380: 381: 382: 383:
384: public function getPostage()
385: {
386: return $this->postage;
387: }
388:
389: 390: 391: 392: 393:
394: public function getPayment()
395: {
396: return $this->payment;
397: }
398:
399: 400: 401: 402: 403:
404: public function getCarrier()
405: {
406: return $this->carrier;
407: }
408:
409: 410: 411: 412: 413:
414: public function getStatusId()
415: {
416: return $this->status_id;
417: }
418:
419: 420: 421: 422: 423:
424: public function getLang()
425: {
426: return $this->lang;
427: }
428:
429: 430: 431: 432: 433: 434: 435: 436: 437:
438: public function getCreatedAt($format = 'Y-m-d H:i:s')
439: {
440: if ($this->created_at === null) {
441: return null;
442: }
443:
444: if ($this->created_at === '0000-00-00 00:00:00') {
445:
446:
447: return null;
448: }
449:
450: try {
451: $dt = new DateTime($this->created_at);
452: } catch (Exception $x) {
453: throw new PropelException("Internally stored date/time/timestamp value could not be converted to DateTime: " . var_export($this->created_at, true), $x);
454: }
455:
456: if ($format === null) {
457:
458: return $dt;
459: }
460:
461: if (strpos($format, '%') !== false) {
462: return strftime($format, $dt->format('U'));
463: }
464:
465: return $dt->format($format);
466:
467: }
468:
469: 470: 471: 472: 473: 474: 475: 476: 477:
478: public function getUpdatedAt($format = 'Y-m-d H:i:s')
479: {
480: if ($this->updated_at === null) {
481: return null;
482: }
483:
484: if ($this->updated_at === '0000-00-00 00:00:00') {
485:
486:
487: return null;
488: }
489:
490: try {
491: $dt = new DateTime($this->updated_at);
492: } catch (Exception $x) {
493: throw new PropelException("Internally stored date/time/timestamp value could not be converted to DateTime: " . var_export($this->updated_at, true), $x);
494: }
495:
496: if ($format === null) {
497:
498: return $dt;
499: }
500:
501: if (strpos($format, '%') !== false) {
502: return strftime($format, $dt->format('U'));
503: }
504:
505: return $dt->format($format);
506:
507: }
508:
509: 510: 511: 512: 513: 514:
515: public function setId($v)
516: {
517: if ($v !== null && is_numeric($v)) {
518: $v = (int) $v;
519: }
520:
521: if ($this->id !== $v) {
522: $this->id = $v;
523: $this->modifiedColumns[] = OrderPeer::ID;
524: }
525:
526:
527: return $this;
528: }
529:
530: 531: 532: 533: 534: 535:
536: public function setRef($v)
537: {
538: if ($v !== null && is_numeric($v)) {
539: $v = (string) $v;
540: }
541:
542: if ($this->ref !== $v) {
543: $this->ref = $v;
544: $this->modifiedColumns[] = OrderPeer::REF;
545: }
546:
547:
548: return $this;
549: }
550:
551: 552: 553: 554: 555: 556:
557: public function setCustomerId($v)
558: {
559: if ($v !== null && is_numeric($v)) {
560: $v = (int) $v;
561: }
562:
563: if ($this->customer_id !== $v) {
564: $this->customer_id = $v;
565: $this->modifiedColumns[] = OrderPeer::CUSTOMER_ID;
566: }
567:
568: if ($this->aCustomer !== null && $this->aCustomer->getId() !== $v) {
569: $this->aCustomer = null;
570: }
571:
572:
573: return $this;
574: }
575:
576: 577: 578: 579: 580: 581:
582: public function setAddressInvoice($v)
583: {
584: if ($v !== null && is_numeric($v)) {
585: $v = (int) $v;
586: }
587:
588: if ($this->address_invoice !== $v) {
589: $this->address_invoice = $v;
590: $this->modifiedColumns[] = OrderPeer::ADDRESS_INVOICE;
591: }
592:
593: if ($this->aOrderAddressRelatedByAddressInvoice !== null && $this->aOrderAddressRelatedByAddressInvoice->getId() !== $v) {
594: $this->aOrderAddressRelatedByAddressInvoice = null;
595: }
596:
597:
598: return $this;
599: }
600:
601: 602: 603: 604: 605: 606:
607: public function setAddressDelivery($v)
608: {
609: if ($v !== null && is_numeric($v)) {
610: $v = (int) $v;
611: }
612:
613: if ($this->address_delivery !== $v) {
614: $this->address_delivery = $v;
615: $this->modifiedColumns[] = OrderPeer::ADDRESS_DELIVERY;
616: }
617:
618: if ($this->aOrderAddressRelatedByAddressDelivery !== null && $this->aOrderAddressRelatedByAddressDelivery->getId() !== $v) {
619: $this->aOrderAddressRelatedByAddressDelivery = null;
620: }
621:
622:
623: return $this;
624: }
625:
626: 627: 628: 629: 630: 631: 632:
633: public function setInvoiceDate($v)
634: {
635: $dt = PropelDateTime::newInstance($v, null, 'DateTime');
636: if ($this->invoice_date !== null || $dt !== null) {
637: $currentDateAsString = ($this->invoice_date !== null && $tmpDt = new DateTime($this->invoice_date)) ? $tmpDt->format('Y-m-d') : null;
638: $newDateAsString = $dt ? $dt->format('Y-m-d') : null;
639: if ($currentDateAsString !== $newDateAsString) {
640: $this->invoice_date = $newDateAsString;
641: $this->modifiedColumns[] = OrderPeer::INVOICE_DATE;
642: }
643: }
644:
645:
646: return $this;
647: }
648:
649: 650: 651: 652: 653: 654:
655: public function setCurrencyId($v)
656: {
657: if ($v !== null && is_numeric($v)) {
658: $v = (int) $v;
659: }
660:
661: if ($this->currency_id !== $v) {
662: $this->currency_id = $v;
663: $this->modifiedColumns[] = OrderPeer::CURRENCY_ID;
664: }
665:
666: if ($this->aCurrency !== null && $this->aCurrency->getId() !== $v) {
667: $this->aCurrency = null;
668: }
669:
670:
671: return $this;
672: }
673:
674: 675: 676: 677: 678: 679:
680: public function setCurrencyRate($v)
681: {
682: if ($v !== null && is_numeric($v)) {
683: $v = (double) $v;
684: }
685:
686: if ($this->currency_rate !== $v) {
687: $this->currency_rate = $v;
688: $this->modifiedColumns[] = OrderPeer::CURRENCY_RATE;
689: }
690:
691:
692: return $this;
693: }
694:
695: 696: 697: 698: 699: 700:
701: public function setTransaction($v)
702: {
703: if ($v !== null && is_numeric($v)) {
704: $v = (string) $v;
705: }
706:
707: if ($this->transaction !== $v) {
708: $this->transaction = $v;
709: $this->modifiedColumns[] = OrderPeer::TRANSACTION;
710: }
711:
712:
713: return $this;
714: }
715:
716: 717: 718: 719: 720: 721:
722: public function setDeliveryNum($v)
723: {
724: if ($v !== null && is_numeric($v)) {
725: $v = (string) $v;
726: }
727:
728: if ($this->delivery_num !== $v) {
729: $this->delivery_num = $v;
730: $this->modifiedColumns[] = OrderPeer::DELIVERY_NUM;
731: }
732:
733:
734: return $this;
735: }
736:
737: 738: 739: 740: 741: 742:
743: public function setInvoice($v)
744: {
745: if ($v !== null && is_numeric($v)) {
746: $v = (string) $v;
747: }
748:
749: if ($this->invoice !== $v) {
750: $this->invoice = $v;
751: $this->modifiedColumns[] = OrderPeer::INVOICE;
752: }
753:
754:
755: return $this;
756: }
757:
758: 759: 760: 761: 762: 763:
764: public function setPostage($v)
765: {
766: if ($v !== null && is_numeric($v)) {
767: $v = (double) $v;
768: }
769:
770: if ($this->postage !== $v) {
771: $this->postage = $v;
772: $this->modifiedColumns[] = OrderPeer::POSTAGE;
773: }
774:
775:
776: return $this;
777: }
778:
779: 780: 781: 782: 783: 784:
785: public function setPayment($v)
786: {
787: if ($v !== null && is_numeric($v)) {
788: $v = (string) $v;
789: }
790:
791: if ($this->payment !== $v) {
792: $this->payment = $v;
793: $this->modifiedColumns[] = OrderPeer::PAYMENT;
794: }
795:
796:
797: return $this;
798: }
799:
800: 801: 802: 803: 804: 805:
806: public function setCarrier($v)
807: {
808: if ($v !== null && is_numeric($v)) {
809: $v = (string) $v;
810: }
811:
812: if ($this->carrier !== $v) {
813: $this->carrier = $v;
814: $this->modifiedColumns[] = OrderPeer::CARRIER;
815: }
816:
817:
818: return $this;
819: }
820:
821: 822: 823: 824: 825: 826:
827: public function setStatusId($v)
828: {
829: if ($v !== null && is_numeric($v)) {
830: $v = (int) $v;
831: }
832:
833: if ($this->status_id !== $v) {
834: $this->status_id = $v;
835: $this->modifiedColumns[] = OrderPeer::STATUS_ID;
836: }
837:
838: if ($this->aOrderStatus !== null && $this->aOrderStatus->getId() !== $v) {
839: $this->aOrderStatus = null;
840: }
841:
842:
843: return $this;
844: }
845:
846: 847: 848: 849: 850: 851:
852: public function setLang($v)
853: {
854: if ($v !== null && is_numeric($v)) {
855: $v = (string) $v;
856: }
857:
858: if ($this->lang !== $v) {
859: $this->lang = $v;
860: $this->modifiedColumns[] = OrderPeer::LANG;
861: }
862:
863:
864: return $this;
865: }
866:
867: 868: 869: 870: 871: 872: 873:
874: public function setCreatedAt($v)
875: {
876: $dt = PropelDateTime::newInstance($v, null, 'DateTime');
877: if ($this->created_at !== null || $dt !== null) {
878: $currentDateAsString = ($this->created_at !== null && $tmpDt = new DateTime($this->created_at)) ? $tmpDt->format('Y-m-d H:i:s') : null;
879: $newDateAsString = $dt ? $dt->format('Y-m-d H:i:s') : null;
880: if ($currentDateAsString !== $newDateAsString) {
881: $this->created_at = $newDateAsString;
882: $this->modifiedColumns[] = OrderPeer::CREATED_AT;
883: }
884: }
885:
886:
887: return $this;
888: }
889:
890: 891: 892: 893: 894: 895: 896:
897: public function setUpdatedAt($v)
898: {
899: $dt = PropelDateTime::newInstance($v, null, 'DateTime');
900: if ($this->updated_at !== null || $dt !== null) {
901: $currentDateAsString = ($this->updated_at !== null && $tmpDt = new DateTime($this->updated_at)) ? $tmpDt->format('Y-m-d H:i:s') : null;
902: $newDateAsString = $dt ? $dt->format('Y-m-d H:i:s') : null;
903: if ($currentDateAsString !== $newDateAsString) {
904: $this->updated_at = $newDateAsString;
905: $this->modifiedColumns[] = OrderPeer::UPDATED_AT;
906: }
907: }
908:
909:
910: return $this;
911: }
912:
913: 914: 915: 916: 917: 918: 919: 920:
921: public function hasOnlyDefaultValues()
922: {
923:
924: return true;
925: }
926:
927: 928: 929: 930: 931: 932: 933: 934: 935: 936: 937: 938: 939: 940:
941: public function hydrate($row, $startcol = 0, $rehydrate = false)
942: {
943: try {
944:
945: $this->id = ($row[$startcol + 0] !== null) ? (int) $row[$startcol + 0] : null;
946: $this->ref = ($row[$startcol + 1] !== null) ? (string) $row[$startcol + 1] : null;
947: $this->customer_id = ($row[$startcol + 2] !== null) ? (int) $row[$startcol + 2] : null;
948: $this->address_invoice = ($row[$startcol + 3] !== null) ? (int) $row[$startcol + 3] : null;
949: $this->address_delivery = ($row[$startcol + 4] !== null) ? (int) $row[$startcol + 4] : null;
950: $this->invoice_date = ($row[$startcol + 5] !== null) ? (string) $row[$startcol + 5] : null;
951: $this->currency_id = ($row[$startcol + 6] !== null) ? (int) $row[$startcol + 6] : null;
952: $this->currency_rate = ($row[$startcol + 7] !== null) ? (double) $row[$startcol + 7] : null;
953: $this->transaction = ($row[$startcol + 8] !== null) ? (string) $row[$startcol + 8] : null;
954: $this->delivery_num = ($row[$startcol + 9] !== null) ? (string) $row[$startcol + 9] : null;
955: $this->invoice = ($row[$startcol + 10] !== null) ? (string) $row[$startcol + 10] : null;
956: $this->postage = ($row[$startcol + 11] !== null) ? (double) $row[$startcol + 11] : null;
957: $this->payment = ($row[$startcol + 12] !== null) ? (string) $row[$startcol + 12] : null;
958: $this->carrier = ($row[$startcol + 13] !== null) ? (string) $row[$startcol + 13] : null;
959: $this->status_id = ($row[$startcol + 14] !== null) ? (int) $row[$startcol + 14] : null;
960: $this->lang = ($row[$startcol + 15] !== null) ? (string) $row[$startcol + 15] : null;
961: $this->created_at = ($row[$startcol + 16] !== null) ? (string) $row[$startcol + 16] : null;
962: $this->updated_at = ($row[$startcol + 17] !== null) ? (string) $row[$startcol + 17] : null;
963: $this->resetModified();
964:
965: $this->setNew(false);
966:
967: if ($rehydrate) {
968: $this->ensureConsistency();
969: }
970: $this->postHydrate($row, $startcol, $rehydrate);
971: return $startcol + 18;
972:
973: } catch (Exception $e) {
974: throw new PropelException("Error populating Order object", $e);
975: }
976: }
977:
978: 979: 980: 981: 982: 983: 984: 985: 986: 987: 988: 989: 990:
991: public function ensureConsistency()
992: {
993:
994: if ($this->aCustomer !== null && $this->customer_id !== $this->aCustomer->getId()) {
995: $this->aCustomer = null;
996: }
997: if ($this->aOrderAddressRelatedByAddressInvoice !== null && $this->address_invoice !== $this->aOrderAddressRelatedByAddressInvoice->getId()) {
998: $this->aOrderAddressRelatedByAddressInvoice = null;
999: }
1000: if ($this->aOrderAddressRelatedByAddressDelivery !== null && $this->address_delivery !== $this->aOrderAddressRelatedByAddressDelivery->getId()) {
1001: $this->aOrderAddressRelatedByAddressDelivery = null;
1002: }
1003: if ($this->aCurrency !== null && $this->currency_id !== $this->aCurrency->getId()) {
1004: $this->aCurrency = null;
1005: }
1006: if ($this->aOrderStatus !== null && $this->status_id !== $this->aOrderStatus->getId()) {
1007: $this->aOrderStatus = null;
1008: }
1009: }
1010:
1011: 1012: 1013: 1014: 1015: 1016: 1017: 1018: 1019: 1020:
1021: public function reload($deep = false, PropelPDO $con = null)
1022: {
1023: if ($this->isDeleted()) {
1024: throw new PropelException("Cannot reload a deleted object.");
1025: }
1026:
1027: if ($this->isNew()) {
1028: throw new PropelException("Cannot reload an unsaved object.");
1029: }
1030:
1031: if ($con === null) {
1032: $con = Propel::getConnection(OrderPeer::DATABASE_NAME, Propel::CONNECTION_READ);
1033: }
1034:
1035:
1036:
1037:
1038: $stmt = OrderPeer::doSelectStmt($this->buildPkeyCriteria(), $con);
1039: $row = $stmt->fetch(PDO::FETCH_NUM);
1040: $stmt->closeCursor();
1041: if (!$row) {
1042: throw new PropelException('Cannot find matching row in the database to reload object values.');
1043: }
1044: $this->hydrate($row, 0, true);
1045:
1046: if ($deep) {
1047:
1048: $this->aCurrency = null;
1049: $this->aCustomer = null;
1050: $this->aOrderAddressRelatedByAddressInvoice = null;
1051: $this->aOrderAddressRelatedByAddressDelivery = null;
1052: $this->aOrderStatus = null;
1053: $this->collOrderProducts = null;
1054:
1055: $this->collCouponOrders = null;
1056:
1057: }
1058: }
1059:
1060: 1061: 1062: 1063: 1064: 1065: 1066: 1067: 1068: 1069:
1070: public function delete(PropelPDO $con = null)
1071: {
1072: if ($this->isDeleted()) {
1073: throw new PropelException("This object has already been deleted.");
1074: }
1075:
1076: if ($con === null) {
1077: $con = Propel::getConnection(OrderPeer::DATABASE_NAME, Propel::CONNECTION_WRITE);
1078: }
1079:
1080: $con->beginTransaction();
1081: try {
1082: $deleteQuery = OrderQuery::create()
1083: ->filterByPrimaryKey($this->getPrimaryKey());
1084: $ret = $this->preDelete($con);
1085: if ($ret) {
1086: $deleteQuery->delete($con);
1087: $this->postDelete($con);
1088: $con->commit();
1089: $this->setDeleted(true);
1090: } else {
1091: $con->commit();
1092: }
1093: } catch (Exception $e) {
1094: $con->rollBack();
1095: throw $e;
1096: }
1097: }
1098:
1099: 1100: 1101: 1102: 1103: 1104: 1105: 1106: 1107: 1108: 1109: 1110: 1111: 1112:
1113: public function save(PropelPDO $con = null)
1114: {
1115: if ($this->isDeleted()) {
1116: throw new PropelException("You cannot save an object that has been deleted.");
1117: }
1118:
1119: if ($con === null) {
1120: $con = Propel::getConnection(OrderPeer::DATABASE_NAME, Propel::CONNECTION_WRITE);
1121: }
1122:
1123: $con->beginTransaction();
1124: $isInsert = $this->isNew();
1125: try {
1126: $ret = $this->preSave($con);
1127: if ($isInsert) {
1128: $ret = $ret && $this->preInsert($con);
1129:
1130: if (!$this->isColumnModified(OrderPeer::CREATED_AT)) {
1131: $this->setCreatedAt(time());
1132: }
1133: if (!$this->isColumnModified(OrderPeer::UPDATED_AT)) {
1134: $this->setUpdatedAt(time());
1135: }
1136: } else {
1137: $ret = $ret && $this->preUpdate($con);
1138:
1139: if ($this->isModified() && !$this->isColumnModified(OrderPeer::UPDATED_AT)) {
1140: $this->setUpdatedAt(time());
1141: }
1142: }
1143: if ($ret) {
1144: $affectedRows = $this->doSave($con);
1145: if ($isInsert) {
1146: $this->postInsert($con);
1147: } else {
1148: $this->postUpdate($con);
1149: }
1150: $this->postSave($con);
1151: OrderPeer::addInstanceToPool($this);
1152: } else {
1153: $affectedRows = 0;
1154: }
1155: $con->commit();
1156:
1157: return $affectedRows;
1158: } catch (Exception $e) {
1159: $con->rollBack();
1160: throw $e;
1161: }
1162: }
1163:
1164: 1165: 1166: 1167: 1168: 1169: 1170: 1171: 1172: 1173: 1174:
1175: protected function doSave(PropelPDO $con)
1176: {
1177: $affectedRows = 0;
1178: if (!$this->alreadyInSave) {
1179: $this->alreadyInSave = true;
1180:
1181:
1182:
1183:
1184:
1185:
1186: if ($this->aCurrency !== null) {
1187: if ($this->aCurrency->isModified() || $this->aCurrency->isNew()) {
1188: $affectedRows += $this->aCurrency->save($con);
1189: }
1190: $this->setCurrency($this->aCurrency);
1191: }
1192:
1193: if ($this->aCustomer !== null) {
1194: if ($this->aCustomer->isModified() || $this->aCustomer->isNew()) {
1195: $affectedRows += $this->aCustomer->save($con);
1196: }
1197: $this->setCustomer($this->aCustomer);
1198: }
1199:
1200: if ($this->aOrderAddressRelatedByAddressInvoice !== null) {
1201: if ($this->aOrderAddressRelatedByAddressInvoice->isModified() || $this->aOrderAddressRelatedByAddressInvoice->isNew()) {
1202: $affectedRows += $this->aOrderAddressRelatedByAddressInvoice->save($con);
1203: }
1204: $this->setOrderAddressRelatedByAddressInvoice($this->aOrderAddressRelatedByAddressInvoice);
1205: }
1206:
1207: if ($this->aOrderAddressRelatedByAddressDelivery !== null) {
1208: if ($this->aOrderAddressRelatedByAddressDelivery->isModified() || $this->aOrderAddressRelatedByAddressDelivery->isNew()) {
1209: $affectedRows += $this->aOrderAddressRelatedByAddressDelivery->save($con);
1210: }
1211: $this->setOrderAddressRelatedByAddressDelivery($this->aOrderAddressRelatedByAddressDelivery);
1212: }
1213:
1214: if ($this->aOrderStatus !== null) {
1215: if ($this->aOrderStatus->isModified() || $this->aOrderStatus->isNew()) {
1216: $affectedRows += $this->aOrderStatus->save($con);
1217: }
1218: $this->setOrderStatus($this->aOrderStatus);
1219: }
1220:
1221: if ($this->isNew() || $this->isModified()) {
1222:
1223: if ($this->isNew()) {
1224: $this->doInsert($con);
1225: } else {
1226: $this->doUpdate($con);
1227: }
1228: $affectedRows += 1;
1229: $this->resetModified();
1230: }
1231:
1232: if ($this->orderProductsScheduledForDeletion !== null) {
1233: if (!$this->orderProductsScheduledForDeletion->isEmpty()) {
1234: OrderProductQuery::create()
1235: ->filterByPrimaryKeys($this->orderProductsScheduledForDeletion->getPrimaryKeys(false))
1236: ->delete($con);
1237: $this->orderProductsScheduledForDeletion = null;
1238: }
1239: }
1240:
1241: if ($this->collOrderProducts !== null) {
1242: foreach ($this->collOrderProducts as $referrerFK) {
1243: if (!$referrerFK->isDeleted() && ($referrerFK->isNew() || $referrerFK->isModified())) {
1244: $affectedRows += $referrerFK->save($con);
1245: }
1246: }
1247: }
1248:
1249: if ($this->couponOrdersScheduledForDeletion !== null) {
1250: if (!$this->couponOrdersScheduledForDeletion->isEmpty()) {
1251: CouponOrderQuery::create()
1252: ->filterByPrimaryKeys($this->couponOrdersScheduledForDeletion->getPrimaryKeys(false))
1253: ->delete($con);
1254: $this->couponOrdersScheduledForDeletion = null;
1255: }
1256: }
1257:
1258: if ($this->collCouponOrders !== null) {
1259: foreach ($this->collCouponOrders as $referrerFK) {
1260: if (!$referrerFK->isDeleted() && ($referrerFK->isNew() || $referrerFK->isModified())) {
1261: $affectedRows += $referrerFK->save($con);
1262: }
1263: }
1264: }
1265:
1266: $this->alreadyInSave = false;
1267:
1268: }
1269:
1270: return $affectedRows;
1271: }
1272:
1273: 1274: 1275: 1276: 1277: 1278: 1279: 1280:
1281: protected function doInsert(PropelPDO $con)
1282: {
1283: $modifiedColumns = array();
1284: $index = 0;
1285:
1286: $this->modifiedColumns[] = OrderPeer::ID;
1287: if (null !== $this->id) {
1288: throw new PropelException('Cannot insert a value for auto-increment primary key (' . OrderPeer::ID . ')');
1289: }
1290:
1291:
1292: if ($this->isColumnModified(OrderPeer::ID)) {
1293: $modifiedColumns[':p' . $index++] = '`id`';
1294: }
1295: if ($this->isColumnModified(OrderPeer::REF)) {
1296: $modifiedColumns[':p' . $index++] = '`ref`';
1297: }
1298: if ($this->isColumnModified(OrderPeer::CUSTOMER_ID)) {
1299: $modifiedColumns[':p' . $index++] = '`customer_id`';
1300: }
1301: if ($this->isColumnModified(OrderPeer::ADDRESS_INVOICE)) {
1302: $modifiedColumns[':p' . $index++] = '`address_invoice`';
1303: }
1304: if ($this->isColumnModified(OrderPeer::ADDRESS_DELIVERY)) {
1305: $modifiedColumns[':p' . $index++] = '`address_delivery`';
1306: }
1307: if ($this->isColumnModified(OrderPeer::INVOICE_DATE)) {
1308: $modifiedColumns[':p' . $index++] = '`invoice_date`';
1309: }
1310: if ($this->isColumnModified(OrderPeer::CURRENCY_ID)) {
1311: $modifiedColumns[':p' . $index++] = '`currency_id`';
1312: }
1313: if ($this->isColumnModified(OrderPeer::CURRENCY_RATE)) {
1314: $modifiedColumns[':p' . $index++] = '`currency_rate`';
1315: }
1316: if ($this->isColumnModified(OrderPeer::TRANSACTION)) {
1317: $modifiedColumns[':p' . $index++] = '`transaction`';
1318: }
1319: if ($this->isColumnModified(OrderPeer::DELIVERY_NUM)) {
1320: $modifiedColumns[':p' . $index++] = '`delivery_num`';
1321: }
1322: if ($this->isColumnModified(OrderPeer::INVOICE)) {
1323: $modifiedColumns[':p' . $index++] = '`invoice`';
1324: }
1325: if ($this->isColumnModified(OrderPeer::POSTAGE)) {
1326: $modifiedColumns[':p' . $index++] = '`postage`';
1327: }
1328: if ($this->isColumnModified(OrderPeer::PAYMENT)) {
1329: $modifiedColumns[':p' . $index++] = '`payment`';
1330: }
1331: if ($this->isColumnModified(OrderPeer::CARRIER)) {
1332: $modifiedColumns[':p' . $index++] = '`carrier`';
1333: }
1334: if ($this->isColumnModified(OrderPeer::STATUS_ID)) {
1335: $modifiedColumns[':p' . $index++] = '`status_id`';
1336: }
1337: if ($this->isColumnModified(OrderPeer::LANG)) {
1338: $modifiedColumns[':p' . $index++] = '`lang`';
1339: }
1340: if ($this->isColumnModified(OrderPeer::CREATED_AT)) {
1341: $modifiedColumns[':p' . $index++] = '`created_at`';
1342: }
1343: if ($this->isColumnModified(OrderPeer::UPDATED_AT)) {
1344: $modifiedColumns[':p' . $index++] = '`updated_at`';
1345: }
1346:
1347: $sql = sprintf(
1348: 'INSERT INTO `order` (%s) VALUES (%s)',
1349: implode(', ', $modifiedColumns),
1350: implode(', ', array_keys($modifiedColumns))
1351: );
1352:
1353: try {
1354: $stmt = $con->prepare($sql);
1355: foreach ($modifiedColumns as $identifier => $columnName) {
1356: switch ($columnName) {
1357: case '`id`':
1358: $stmt->bindValue($identifier, $this->id, PDO::PARAM_INT);
1359: break;
1360: case '`ref`':
1361: $stmt->bindValue($identifier, $this->ref, PDO::PARAM_STR);
1362: break;
1363: case '`customer_id`':
1364: $stmt->bindValue($identifier, $this->customer_id, PDO::PARAM_INT);
1365: break;
1366: case '`address_invoice`':
1367: $stmt->bindValue($identifier, $this->address_invoice, PDO::PARAM_INT);
1368: break;
1369: case '`address_delivery`':
1370: $stmt->bindValue($identifier, $this->address_delivery, PDO::PARAM_INT);
1371: break;
1372: case '`invoice_date`':
1373: $stmt->bindValue($identifier, $this->invoice_date, PDO::PARAM_STR);
1374: break;
1375: case '`currency_id`':
1376: $stmt->bindValue($identifier, $this->currency_id, PDO::PARAM_INT);
1377: break;
1378: case '`currency_rate`':
1379: $stmt->bindValue($identifier, $this->currency_rate, PDO::PARAM_STR);
1380: break;
1381: case '`transaction`':
1382: $stmt->bindValue($identifier, $this->transaction, PDO::PARAM_STR);
1383: break;
1384: case '`delivery_num`':
1385: $stmt->bindValue($identifier, $this->delivery_num, PDO::PARAM_STR);
1386: break;
1387: case '`invoice`':
1388: $stmt->bindValue($identifier, $this->invoice, PDO::PARAM_STR);
1389: break;
1390: case '`postage`':
1391: $stmt->bindValue($identifier, $this->postage, PDO::PARAM_STR);
1392: break;
1393: case '`payment`':
1394: $stmt->bindValue($identifier, $this->payment, PDO::PARAM_STR);
1395: break;
1396: case '`carrier`':
1397: $stmt->bindValue($identifier, $this->carrier, PDO::PARAM_STR);
1398: break;
1399: case '`status_id`':
1400: $stmt->bindValue($identifier, $this->status_id, PDO::PARAM_INT);
1401: break;
1402: case '`lang`':
1403: $stmt->bindValue($identifier, $this->lang, PDO::PARAM_STR);
1404: break;
1405: case '`created_at`':
1406: $stmt->bindValue($identifier, $this->created_at, PDO::PARAM_STR);
1407: break;
1408: case '`updated_at`':
1409: $stmt->bindValue($identifier, $this->updated_at, PDO::PARAM_STR);
1410: break;
1411: }
1412: }
1413: $stmt->execute();
1414: } catch (Exception $e) {
1415: Propel::log($e->getMessage(), Propel::LOG_ERR);
1416: throw new PropelException(sprintf('Unable to execute INSERT statement [%s]', $sql), $e);
1417: }
1418:
1419: try {
1420: $pk = $con->lastInsertId();
1421: } catch (Exception $e) {
1422: throw new PropelException('Unable to get autoincrement id.', $e);
1423: }
1424: $this->setId($pk);
1425:
1426: $this->setNew(false);
1427: }
1428:
1429: 1430: 1431: 1432: 1433: 1434: 1435:
1436: protected function doUpdate(PropelPDO $con)
1437: {
1438: $selectCriteria = $this->buildPkeyCriteria();
1439: $valuesCriteria = $this->buildCriteria();
1440: BasePeer::doUpdate($selectCriteria, $valuesCriteria, $con);
1441: }
1442:
1443: 1444: 1445: 1446:
1447: protected $validationFailures = array();
1448:
1449: 1450: 1451: 1452: 1453: 1454: 1455:
1456: public function getValidationFailures()
1457: {
1458: return $this->validationFailures;
1459: }
1460:
1461: 1462: 1463: 1464: 1465: 1466: 1467: 1468: 1469: 1470: 1471:
1472: public function validate($columns = null)
1473: {
1474: $res = $this->doValidate($columns);
1475: if ($res === true) {
1476: $this->validationFailures = array();
1477:
1478: return true;
1479: }
1480:
1481: $this->validationFailures = $res;
1482:
1483: return false;
1484: }
1485:
1486: 1487: 1488: 1489: 1490: 1491: 1492: 1493: 1494: 1495:
1496: protected function doValidate($columns = null)
1497: {
1498: if (!$this->alreadyInValidation) {
1499: $this->alreadyInValidation = true;
1500: $retval = null;
1501:
1502: $failureMap = array();
1503:
1504:
1505:
1506:
1507:
1508:
1509:
1510: if ($this->aCurrency !== null) {
1511: if (!$this->aCurrency->validate($columns)) {
1512: $failureMap = array_merge($failureMap, $this->aCurrency->getValidationFailures());
1513: }
1514: }
1515:
1516: if ($this->aCustomer !== null) {
1517: if (!$this->aCustomer->validate($columns)) {
1518: $failureMap = array_merge($failureMap, $this->aCustomer->getValidationFailures());
1519: }
1520: }
1521:
1522: if ($this->aOrderAddressRelatedByAddressInvoice !== null) {
1523: if (!$this->aOrderAddressRelatedByAddressInvoice->validate($columns)) {
1524: $failureMap = array_merge($failureMap, $this->aOrderAddressRelatedByAddressInvoice->getValidationFailures());
1525: }
1526: }
1527:
1528: if ($this->aOrderAddressRelatedByAddressDelivery !== null) {
1529: if (!$this->aOrderAddressRelatedByAddressDelivery->validate($columns)) {
1530: $failureMap = array_merge($failureMap, $this->aOrderAddressRelatedByAddressDelivery->getValidationFailures());
1531: }
1532: }
1533:
1534: if ($this->aOrderStatus !== null) {
1535: if (!$this->aOrderStatus->validate($columns)) {
1536: $failureMap = array_merge($failureMap, $this->aOrderStatus->getValidationFailures());
1537: }
1538: }
1539:
1540:
1541: if (($retval = OrderPeer::doValidate($this, $columns)) !== true) {
1542: $failureMap = array_merge($failureMap, $retval);
1543: }
1544:
1545:
1546: if ($this->collOrderProducts !== null) {
1547: foreach ($this->collOrderProducts as $referrerFK) {
1548: if (!$referrerFK->validate($columns)) {
1549: $failureMap = array_merge($failureMap, $referrerFK->getValidationFailures());
1550: }
1551: }
1552: }
1553:
1554: if ($this->collCouponOrders !== null) {
1555: foreach ($this->collCouponOrders as $referrerFK) {
1556: if (!$referrerFK->validate($columns)) {
1557: $failureMap = array_merge($failureMap, $referrerFK->getValidationFailures());
1558: }
1559: }
1560: }
1561:
1562:
1563: $this->alreadyInValidation = false;
1564: }
1565:
1566: return (!empty($failureMap) ? $failureMap : true);
1567: }
1568:
1569: 1570: 1571: 1572: 1573: 1574: 1575: 1576: 1577: 1578:
1579: public function getByName($name, $type = BasePeer::TYPE_PHPNAME)
1580: {
1581: $pos = OrderPeer::translateFieldName($name, $type, BasePeer::TYPE_NUM);
1582: $field = $this->getByPosition($pos);
1583:
1584: return $field;
1585: }
1586:
1587: 1588: 1589: 1590: 1591: 1592: 1593:
1594: public function getByPosition($pos)
1595: {
1596: switch ($pos) {
1597: case 0:
1598: return $this->getId();
1599: break;
1600: case 1:
1601: return $this->getRef();
1602: break;
1603: case 2:
1604: return $this->getCustomerId();
1605: break;
1606: case 3:
1607: return $this->getAddressInvoice();
1608: break;
1609: case 4:
1610: return $this->getAddressDelivery();
1611: break;
1612: case 5:
1613: return $this->getInvoiceDate();
1614: break;
1615: case 6:
1616: return $this->getCurrencyId();
1617: break;
1618: case 7:
1619: return $this->getCurrencyRate();
1620: break;
1621: case 8:
1622: return $this->getTransaction();
1623: break;
1624: case 9:
1625: return $this->getDeliveryNum();
1626: break;
1627: case 10:
1628: return $this->getInvoice();
1629: break;
1630: case 11:
1631: return $this->getPostage();
1632: break;
1633: case 12:
1634: return $this->getPayment();
1635: break;
1636: case 13:
1637: return $this->getCarrier();
1638: break;
1639: case 14:
1640: return $this->getStatusId();
1641: break;
1642: case 15:
1643: return $this->getLang();
1644: break;
1645: case 16:
1646: return $this->getCreatedAt();
1647: break;
1648: case 17:
1649: return $this->getUpdatedAt();
1650: break;
1651: default:
1652: return null;
1653: break;
1654: }
1655: }
1656:
1657: 1658: 1659: 1660: 1661: 1662: 1663: 1664: 1665: 1666: 1667: 1668: 1669: 1670: 1671:
1672: public function toArray($keyType = BasePeer::TYPE_PHPNAME, $includeLazyLoadColumns = true, $alreadyDumpedObjects = array(), $includeForeignObjects = false)
1673: {
1674: if (isset($alreadyDumpedObjects['Order'][$this->getPrimaryKey()])) {
1675: return '*RECURSION*';
1676: }
1677: $alreadyDumpedObjects['Order'][$this->getPrimaryKey()] = true;
1678: $keys = OrderPeer::getFieldNames($keyType);
1679: $result = array(
1680: $keys[0] => $this->getId(),
1681: $keys[1] => $this->getRef(),
1682: $keys[2] => $this->getCustomerId(),
1683: $keys[3] => $this->getAddressInvoice(),
1684: $keys[4] => $this->getAddressDelivery(),
1685: $keys[5] => $this->getInvoiceDate(),
1686: $keys[6] => $this->getCurrencyId(),
1687: $keys[7] => $this->getCurrencyRate(),
1688: $keys[8] => $this->getTransaction(),
1689: $keys[9] => $this->getDeliveryNum(),
1690: $keys[10] => $this->getInvoice(),
1691: $keys[11] => $this->getPostage(),
1692: $keys[12] => $this->getPayment(),
1693: $keys[13] => $this->getCarrier(),
1694: $keys[14] => $this->getStatusId(),
1695: $keys[15] => $this->getLang(),
1696: $keys[16] => $this->getCreatedAt(),
1697: $keys[17] => $this->getUpdatedAt(),
1698: );
1699: if ($includeForeignObjects) {
1700: if (null !== $this->aCurrency) {
1701: $result['Currency'] = $this->aCurrency->toArray($keyType, $includeLazyLoadColumns, $alreadyDumpedObjects, true);
1702: }
1703: if (null !== $this->aCustomer) {
1704: $result['Customer'] = $this->aCustomer->toArray($keyType, $includeLazyLoadColumns, $alreadyDumpedObjects, true);
1705: }
1706: if (null !== $this->aOrderAddressRelatedByAddressInvoice) {
1707: $result['OrderAddressRelatedByAddressInvoice'] = $this->aOrderAddressRelatedByAddressInvoice->toArray($keyType, $includeLazyLoadColumns, $alreadyDumpedObjects, true);
1708: }
1709: if (null !== $this->aOrderAddressRelatedByAddressDelivery) {
1710: $result['OrderAddressRelatedByAddressDelivery'] = $this->aOrderAddressRelatedByAddressDelivery->toArray($keyType, $includeLazyLoadColumns, $alreadyDumpedObjects, true);
1711: }
1712: if (null !== $this->aOrderStatus) {
1713: $result['OrderStatus'] = $this->aOrderStatus->toArray($keyType, $includeLazyLoadColumns, $alreadyDumpedObjects, true);
1714: }
1715: if (null !== $this->collOrderProducts) {
1716: $result['OrderProducts'] = $this->collOrderProducts->toArray(null, true, $keyType, $includeLazyLoadColumns, $alreadyDumpedObjects);
1717: }
1718: if (null !== $this->collCouponOrders) {
1719: $result['CouponOrders'] = $this->collCouponOrders->toArray(null, true, $keyType, $includeLazyLoadColumns, $alreadyDumpedObjects);
1720: }
1721: }
1722:
1723: return $result;
1724: }
1725:
1726: 1727: 1728: 1729: 1730: 1731: 1732: 1733: 1734: 1735: 1736:
1737: public function setByName($name, $value, $type = BasePeer::TYPE_PHPNAME)
1738: {
1739: $pos = OrderPeer::translateFieldName($name, $type, BasePeer::TYPE_NUM);
1740:
1741: $this->setByPosition($pos, $value);
1742: }
1743:
1744: 1745: 1746: 1747: 1748: 1749: 1750: 1751:
1752: public function setByPosition($pos, $value)
1753: {
1754: switch ($pos) {
1755: case 0:
1756: $this->setId($value);
1757: break;
1758: case 1:
1759: $this->setRef($value);
1760: break;
1761: case 2:
1762: $this->setCustomerId($value);
1763: break;
1764: case 3:
1765: $this->setAddressInvoice($value);
1766: break;
1767: case 4:
1768: $this->setAddressDelivery($value);
1769: break;
1770: case 5:
1771: $this->setInvoiceDate($value);
1772: break;
1773: case 6:
1774: $this->setCurrencyId($value);
1775: break;
1776: case 7:
1777: $this->setCurrencyRate($value);
1778: break;
1779: case 8:
1780: $this->setTransaction($value);
1781: break;
1782: case 9:
1783: $this->setDeliveryNum($value);
1784: break;
1785: case 10:
1786: $this->setInvoice($value);
1787: break;
1788: case 11:
1789: $this->setPostage($value);
1790: break;
1791: case 12:
1792: $this->setPayment($value);
1793: break;
1794: case 13:
1795: $this->setCarrier($value);
1796: break;
1797: case 14:
1798: $this->setStatusId($value);
1799: break;
1800: case 15:
1801: $this->setLang($value);
1802: break;
1803: case 16:
1804: $this->setCreatedAt($value);
1805: break;
1806: case 17:
1807: $this->setUpdatedAt($value);
1808: break;
1809: }
1810: }
1811:
1812: 1813: 1814: 1815: 1816: 1817: 1818: 1819: 1820: 1821: 1822: 1823: 1824: 1825: 1826: 1827: 1828:
1829: public function fromArray($arr, $keyType = BasePeer::TYPE_PHPNAME)
1830: {
1831: $keys = OrderPeer::getFieldNames($keyType);
1832:
1833: if (array_key_exists($keys[0], $arr)) $this->setId($arr[$keys[0]]);
1834: if (array_key_exists($keys[1], $arr)) $this->setRef($arr[$keys[1]]);
1835: if (array_key_exists($keys[2], $arr)) $this->setCustomerId($arr[$keys[2]]);
1836: if (array_key_exists($keys[3], $arr)) $this->setAddressInvoice($arr[$keys[3]]);
1837: if (array_key_exists($keys[4], $arr)) $this->setAddressDelivery($arr[$keys[4]]);
1838: if (array_key_exists($keys[5], $arr)) $this->setInvoiceDate($arr[$keys[5]]);
1839: if (array_key_exists($keys[6], $arr)) $this->setCurrencyId($arr[$keys[6]]);
1840: if (array_key_exists($keys[7], $arr)) $this->setCurrencyRate($arr[$keys[7]]);
1841: if (array_key_exists($keys[8], $arr)) $this->setTransaction($arr[$keys[8]]);
1842: if (array_key_exists($keys[9], $arr)) $this->setDeliveryNum($arr[$keys[9]]);
1843: if (array_key_exists($keys[10], $arr)) $this->setInvoice($arr[$keys[10]]);
1844: if (array_key_exists($keys[11], $arr)) $this->setPostage($arr[$keys[11]]);
1845: if (array_key_exists($keys[12], $arr)) $this->setPayment($arr[$keys[12]]);
1846: if (array_key_exists($keys[13], $arr)) $this->setCarrier($arr[$keys[13]]);
1847: if (array_key_exists($keys[14], $arr)) $this->setStatusId($arr[$keys[14]]);
1848: if (array_key_exists($keys[15], $arr)) $this->setLang($arr[$keys[15]]);
1849: if (array_key_exists($keys[16], $arr)) $this->setCreatedAt($arr[$keys[16]]);
1850: if (array_key_exists($keys[17], $arr)) $this->setUpdatedAt($arr[$keys[17]]);
1851: }
1852:
1853: 1854: 1855: 1856: 1857:
1858: public function buildCriteria()
1859: {
1860: $criteria = new Criteria(OrderPeer::DATABASE_NAME);
1861:
1862: if ($this->isColumnModified(OrderPeer::ID)) $criteria->add(OrderPeer::ID, $this->id);
1863: if ($this->isColumnModified(OrderPeer::REF)) $criteria->add(OrderPeer::REF, $this->ref);
1864: if ($this->isColumnModified(OrderPeer::CUSTOMER_ID)) $criteria->add(OrderPeer::CUSTOMER_ID, $this->customer_id);
1865: if ($this->isColumnModified(OrderPeer::ADDRESS_INVOICE)) $criteria->add(OrderPeer::ADDRESS_INVOICE, $this->address_invoice);
1866: if ($this->isColumnModified(OrderPeer::ADDRESS_DELIVERY)) $criteria->add(OrderPeer::ADDRESS_DELIVERY, $this->address_delivery);
1867: if ($this->isColumnModified(OrderPeer::INVOICE_DATE)) $criteria->add(OrderPeer::INVOICE_DATE, $this->invoice_date);
1868: if ($this->isColumnModified(OrderPeer::CURRENCY_ID)) $criteria->add(OrderPeer::CURRENCY_ID, $this->currency_id);
1869: if ($this->isColumnModified(OrderPeer::CURRENCY_RATE)) $criteria->add(OrderPeer::CURRENCY_RATE, $this->currency_rate);
1870: if ($this->isColumnModified(OrderPeer::TRANSACTION)) $criteria->add(OrderPeer::TRANSACTION, $this->transaction);
1871: if ($this->isColumnModified(OrderPeer::DELIVERY_NUM)) $criteria->add(OrderPeer::DELIVERY_NUM, $this->delivery_num);
1872: if ($this->isColumnModified(OrderPeer::INVOICE)) $criteria->add(OrderPeer::INVOICE, $this->invoice);
1873: if ($this->isColumnModified(OrderPeer::POSTAGE)) $criteria->add(OrderPeer::POSTAGE, $this->postage);
1874: if ($this->isColumnModified(OrderPeer::PAYMENT)) $criteria->add(OrderPeer::PAYMENT, $this->payment);
1875: if ($this->isColumnModified(OrderPeer::CARRIER)) $criteria->add(OrderPeer::CARRIER, $this->carrier);
1876: if ($this->isColumnModified(OrderPeer::STATUS_ID)) $criteria->add(OrderPeer::STATUS_ID, $this->status_id);
1877: if ($this->isColumnModified(OrderPeer::LANG)) $criteria->add(OrderPeer::LANG, $this->lang);
1878: if ($this->isColumnModified(OrderPeer::CREATED_AT)) $criteria->add(OrderPeer::CREATED_AT, $this->created_at);
1879: if ($this->isColumnModified(OrderPeer::UPDATED_AT)) $criteria->add(OrderPeer::UPDATED_AT, $this->updated_at);
1880:
1881: return $criteria;
1882: }
1883:
1884: 1885: 1886: 1887: 1888: 1889: 1890: 1891:
1892: public function buildPkeyCriteria()
1893: {
1894: $criteria = new Criteria(OrderPeer::DATABASE_NAME);
1895: $criteria->add(OrderPeer::ID, $this->id);
1896:
1897: return $criteria;
1898: }
1899:
1900: 1901: 1902: 1903:
1904: public function getPrimaryKey()
1905: {
1906: return $this->getId();
1907: }
1908:
1909: 1910: 1911: 1912: 1913: 1914:
1915: public function setPrimaryKey($key)
1916: {
1917: $this->setId($key);
1918: }
1919:
1920: 1921: 1922: 1923:
1924: public function isPrimaryKeyNull()
1925: {
1926:
1927: return null === $this->getId();
1928: }
1929:
1930: 1931: 1932: 1933: 1934: 1935: 1936: 1937: 1938: 1939: 1940:
1941: public function copyInto($copyObj, $deepCopy = false, $makeNew = true)
1942: {
1943: $copyObj->setRef($this->getRef());
1944: $copyObj->setCustomerId($this->getCustomerId());
1945: $copyObj->setAddressInvoice($this->getAddressInvoice());
1946: $copyObj->setAddressDelivery($this->getAddressDelivery());
1947: $copyObj->setInvoiceDate($this->getInvoiceDate());
1948: $copyObj->setCurrencyId($this->getCurrencyId());
1949: $copyObj->setCurrencyRate($this->getCurrencyRate());
1950: $copyObj->setTransaction($this->getTransaction());
1951: $copyObj->setDeliveryNum($this->getDeliveryNum());
1952: $copyObj->setInvoice($this->getInvoice());
1953: $copyObj->setPostage($this->getPostage());
1954: $copyObj->setPayment($this->getPayment());
1955: $copyObj->setCarrier($this->getCarrier());
1956: $copyObj->setStatusId($this->getStatusId());
1957: $copyObj->setLang($this->getLang());
1958: $copyObj->setCreatedAt($this->getCreatedAt());
1959: $copyObj->setUpdatedAt($this->getUpdatedAt());
1960:
1961: if ($deepCopy && !$this->startCopy) {
1962:
1963:
1964: $copyObj->setNew(false);
1965:
1966: $this->startCopy = true;
1967:
1968: foreach ($this->getOrderProducts() as $relObj) {
1969: if ($relObj !== $this) {
1970: $copyObj->addOrderProduct($relObj->copy($deepCopy));
1971: }
1972: }
1973:
1974: foreach ($this->getCouponOrders() as $relObj) {
1975: if ($relObj !== $this) {
1976: $copyObj->addCouponOrder($relObj->copy($deepCopy));
1977: }
1978: }
1979:
1980:
1981: $this->startCopy = false;
1982: }
1983:
1984: if ($makeNew) {
1985: $copyObj->setNew(true);
1986: $copyObj->setId(NULL);
1987: }
1988: }
1989:
1990: 1991: 1992: 1993: 1994: 1995: 1996: 1997: 1998: 1999: 2000: 2001:
2002: public function copy($deepCopy = false)
2003: {
2004:
2005: $clazz = get_class($this);
2006: $copyObj = new $clazz();
2007: $this->copyInto($copyObj, $deepCopy);
2008:
2009: return $copyObj;
2010: }
2011:
2012: 2013: 2014: 2015: 2016: 2017: 2018: 2019: 2020:
2021: public function getPeer()
2022: {
2023: if (self::$peer === null) {
2024: self::$peer = new OrderPeer();
2025: }
2026:
2027: return self::$peer;
2028: }
2029:
2030: 2031: 2032: 2033: 2034: 2035: 2036:
2037: public function setCurrency(Currency $v = null)
2038: {
2039: if ($v === null) {
2040: $this->setCurrencyId(NULL);
2041: } else {
2042: $this->setCurrencyId($v->getId());
2043: }
2044:
2045: $this->aCurrency = $v;
2046:
2047:
2048:
2049: if ($v !== null) {
2050: $v->addOrder($this);
2051: }
2052:
2053:
2054: return $this;
2055: }
2056:
2057:
2058: 2059: 2060: 2061: 2062: 2063: 2064: 2065:
2066: public function getCurrency(PropelPDO $con = null, $doQuery = true)
2067: {
2068: if ($this->aCurrency === null && ($this->currency_id !== null) && $doQuery) {
2069: $this->aCurrency = CurrencyQuery::create()->findPk($this->currency_id, $con);
2070: 2071: 2072: 2073: 2074: 2075: 2076:
2077: }
2078:
2079: return $this->aCurrency;
2080: }
2081:
2082: 2083: 2084: 2085: 2086: 2087: 2088:
2089: public function setCustomer(Customer $v = null)
2090: {
2091: if ($v === null) {
2092: $this->setCustomerId(NULL);
2093: } else {
2094: $this->setCustomerId($v->getId());
2095: }
2096:
2097: $this->aCustomer = $v;
2098:
2099:
2100:
2101: if ($v !== null) {
2102: $v->addOrder($this);
2103: }
2104:
2105:
2106: return $this;
2107: }
2108:
2109:
2110: 2111: 2112: 2113: 2114: 2115: 2116: 2117:
2118: public function getCustomer(PropelPDO $con = null, $doQuery = true)
2119: {
2120: if ($this->aCustomer === null && ($this->customer_id !== null) && $doQuery) {
2121: $this->aCustomer = CustomerQuery::create()->findPk($this->customer_id, $con);
2122: 2123: 2124: 2125: 2126: 2127: 2128:
2129: }
2130:
2131: return $this->aCustomer;
2132: }
2133:
2134: 2135: 2136: 2137: 2138: 2139: 2140:
2141: public function setOrderAddressRelatedByAddressInvoice(OrderAddress $v = null)
2142: {
2143: if ($v === null) {
2144: $this->setAddressInvoice(NULL);
2145: } else {
2146: $this->setAddressInvoice($v->getId());
2147: }
2148:
2149: $this->aOrderAddressRelatedByAddressInvoice = $v;
2150:
2151:
2152:
2153: if ($v !== null) {
2154: $v->addOrderRelatedByAddressInvoice($this);
2155: }
2156:
2157:
2158: return $this;
2159: }
2160:
2161:
2162: 2163: 2164: 2165: 2166: 2167: 2168: 2169:
2170: public function getOrderAddressRelatedByAddressInvoice(PropelPDO $con = null, $doQuery = true)
2171: {
2172: if ($this->aOrderAddressRelatedByAddressInvoice === null && ($this->address_invoice !== null) && $doQuery) {
2173: $this->aOrderAddressRelatedByAddressInvoice = OrderAddressQuery::create()->findPk($this->address_invoice, $con);
2174: 2175: 2176: 2177: 2178: 2179: 2180:
2181: }
2182:
2183: return $this->aOrderAddressRelatedByAddressInvoice;
2184: }
2185:
2186: 2187: 2188: 2189: 2190: 2191: 2192:
2193: public function setOrderAddressRelatedByAddressDelivery(OrderAddress $v = null)
2194: {
2195: if ($v === null) {
2196: $this->setAddressDelivery(NULL);
2197: } else {
2198: $this->setAddressDelivery($v->getId());
2199: }
2200:
2201: $this->aOrderAddressRelatedByAddressDelivery = $v;
2202:
2203:
2204:
2205: if ($v !== null) {
2206: $v->addOrderRelatedByAddressDelivery($this);
2207: }
2208:
2209:
2210: return $this;
2211: }
2212:
2213:
2214: 2215: 2216: 2217: 2218: 2219: 2220: 2221:
2222: public function getOrderAddressRelatedByAddressDelivery(PropelPDO $con = null, $doQuery = true)
2223: {
2224: if ($this->aOrderAddressRelatedByAddressDelivery === null && ($this->address_delivery !== null) && $doQuery) {
2225: $this->aOrderAddressRelatedByAddressDelivery = OrderAddressQuery::create()->findPk($this->address_delivery, $con);
2226: 2227: 2228: 2229: 2230: 2231: 2232:
2233: }
2234:
2235: return $this->aOrderAddressRelatedByAddressDelivery;
2236: }
2237:
2238: 2239: 2240: 2241: 2242: 2243: 2244:
2245: public function setOrderStatus(OrderStatus $v = null)
2246: {
2247: if ($v === null) {
2248: $this->setStatusId(NULL);
2249: } else {
2250: $this->setStatusId($v->getId());
2251: }
2252:
2253: $this->aOrderStatus = $v;
2254:
2255:
2256:
2257: if ($v !== null) {
2258: $v->addOrder($this);
2259: }
2260:
2261:
2262: return $this;
2263: }
2264:
2265:
2266: 2267: 2268: 2269: 2270: 2271: 2272: 2273:
2274: public function getOrderStatus(PropelPDO $con = null, $doQuery = true)
2275: {
2276: if ($this->aOrderStatus === null && ($this->status_id !== null) && $doQuery) {
2277: $this->aOrderStatus = OrderStatusQuery::create()->findPk($this->status_id, $con);
2278: 2279: 2280: 2281: 2282: 2283: 2284:
2285: }
2286:
2287: return $this->aOrderStatus;
2288: }
2289:
2290:
2291: 2292: 2293: 2294: 2295: 2296: 2297: 2298:
2299: public function initRelation($relationName)
2300: {
2301: if ('OrderProduct' == $relationName) {
2302: $this->initOrderProducts();
2303: }
2304: if ('CouponOrder' == $relationName) {
2305: $this->initCouponOrders();
2306: }
2307: }
2308:
2309: 2310: 2311: 2312: 2313: 2314: 2315: 2316: 2317:
2318: public function clearOrderProducts()
2319: {
2320: $this->collOrderProducts = null;
2321: $this->collOrderProductsPartial = null;
2322:
2323: return $this;
2324: }
2325:
2326: 2327: 2328: 2329: 2330:
2331: public function resetPartialOrderProducts($v = true)
2332: {
2333: $this->collOrderProductsPartial = $v;
2334: }
2335:
2336: 2337: 2338: 2339: 2340: 2341: 2342: 2343: 2344: 2345: 2346: 2347:
2348: public function initOrderProducts($overrideExisting = true)
2349: {
2350: if (null !== $this->collOrderProducts && !$overrideExisting) {
2351: return;
2352: }
2353: $this->collOrderProducts = new PropelObjectCollection();
2354: $this->collOrderProducts->setModel('OrderProduct');
2355: }
2356:
2357: 2358: 2359: 2360: 2361: 2362: 2363: 2364: 2365: 2366: 2367: 2368: 2369: 2370:
2371: public function getOrderProducts($criteria = null, PropelPDO $con = null)
2372: {
2373: $partial = $this->collOrderProductsPartial && !$this->isNew();
2374: if (null === $this->collOrderProducts || null !== $criteria || $partial) {
2375: if ($this->isNew() && null === $this->collOrderProducts) {
2376:
2377: $this->initOrderProducts();
2378: } else {
2379: $collOrderProducts = OrderProductQuery::create(null, $criteria)
2380: ->filterByOrder($this)
2381: ->find($con);
2382: if (null !== $criteria) {
2383: if (false !== $this->collOrderProductsPartial && count($collOrderProducts)) {
2384: $this->initOrderProducts(false);
2385:
2386: foreach($collOrderProducts as $obj) {
2387: if (false == $this->collOrderProducts->contains($obj)) {
2388: $this->collOrderProducts->append($obj);
2389: }
2390: }
2391:
2392: $this->collOrderProductsPartial = true;
2393: }
2394:
2395: $collOrderProducts->getInternalIterator()->rewind();
2396: return $collOrderProducts;
2397: }
2398:
2399: if($partial && $this->collOrderProducts) {
2400: foreach($this->collOrderProducts as $obj) {
2401: if($obj->isNew()) {
2402: $collOrderProducts[] = $obj;
2403: }
2404: }
2405: }
2406:
2407: $this->collOrderProducts = $collOrderProducts;
2408: $this->collOrderProductsPartial = false;
2409: }
2410: }
2411:
2412: return $this->collOrderProducts;
2413: }
2414:
2415: 2416: 2417: 2418: 2419: 2420: 2421: 2422: 2423: 2424:
2425: public function setOrderProducts(PropelCollection $orderProducts, PropelPDO $con = null)
2426: {
2427: $orderProductsToDelete = $this->getOrderProducts(new Criteria(), $con)->diff($orderProducts);
2428:
2429: $this->orderProductsScheduledForDeletion = unserialize(serialize($orderProductsToDelete));
2430:
2431: foreach ($orderProductsToDelete as $orderProductRemoved) {
2432: $orderProductRemoved->setOrder(null);
2433: }
2434:
2435: $this->collOrderProducts = null;
2436: foreach ($orderProducts as $orderProduct) {
2437: $this->addOrderProduct($orderProduct);
2438: }
2439:
2440: $this->collOrderProducts = $orderProducts;
2441: $this->collOrderProductsPartial = false;
2442:
2443: return $this;
2444: }
2445:
2446: 2447: 2448: 2449: 2450: 2451: 2452: 2453: 2454:
2455: public function countOrderProducts(Criteria $criteria = null, $distinct = false, PropelPDO $con = null)
2456: {
2457: $partial = $this->collOrderProductsPartial && !$this->isNew();
2458: if (null === $this->collOrderProducts || null !== $criteria || $partial) {
2459: if ($this->isNew() && null === $this->collOrderProducts) {
2460: return 0;
2461: }
2462:
2463: if($partial && !$criteria) {
2464: return count($this->getOrderProducts());
2465: }
2466: $query = OrderProductQuery::create(null, $criteria);
2467: if ($distinct) {
2468: $query->distinct();
2469: }
2470:
2471: return $query
2472: ->filterByOrder($this)
2473: ->count($con);
2474: }
2475:
2476: return count($this->collOrderProducts);
2477: }
2478:
2479: 2480: 2481: 2482: 2483: 2484: 2485:
2486: public function addOrderProduct(OrderProduct $l)
2487: {
2488: if ($this->collOrderProducts === null) {
2489: $this->initOrderProducts();
2490: $this->collOrderProductsPartial = true;
2491: }
2492: if (!in_array($l, $this->collOrderProducts->getArrayCopy(), true)) {
2493: $this->doAddOrderProduct($l);
2494: }
2495:
2496: return $this;
2497: }
2498:
2499: 2500: 2501:
2502: protected function doAddOrderProduct($orderProduct)
2503: {
2504: $this->collOrderProducts[]= $orderProduct;
2505: $orderProduct->setOrder($this);
2506: }
2507:
2508: 2509: 2510: 2511:
2512: public function removeOrderProduct($orderProduct)
2513: {
2514: if ($this->getOrderProducts()->contains($orderProduct)) {
2515: $this->collOrderProducts->remove($this->collOrderProducts->search($orderProduct));
2516: if (null === $this->orderProductsScheduledForDeletion) {
2517: $this->orderProductsScheduledForDeletion = clone $this->collOrderProducts;
2518: $this->orderProductsScheduledForDeletion->clear();
2519: }
2520: $this->orderProductsScheduledForDeletion[]= clone $orderProduct;
2521: $orderProduct->setOrder(null);
2522: }
2523:
2524: return $this;
2525: }
2526:
2527: 2528: 2529: 2530: 2531: 2532: 2533: 2534: 2535:
2536: public function clearCouponOrders()
2537: {
2538: $this->collCouponOrders = null;
2539: $this->collCouponOrdersPartial = null;
2540:
2541: return $this;
2542: }
2543:
2544: 2545: 2546: 2547: 2548:
2549: public function resetPartialCouponOrders($v = true)
2550: {
2551: $this->collCouponOrdersPartial = $v;
2552: }
2553:
2554: 2555: 2556: 2557: 2558: 2559: 2560: 2561: 2562: 2563: 2564: 2565:
2566: public function initCouponOrders($overrideExisting = true)
2567: {
2568: if (null !== $this->collCouponOrders && !$overrideExisting) {
2569: return;
2570: }
2571: $this->collCouponOrders = new PropelObjectCollection();
2572: $this->collCouponOrders->setModel('CouponOrder');
2573: }
2574:
2575: 2576: 2577: 2578: 2579: 2580: 2581: 2582: 2583: 2584: 2585: 2586: 2587: 2588:
2589: public function getCouponOrders($criteria = null, PropelPDO $con = null)
2590: {
2591: $partial = $this->collCouponOrdersPartial && !$this->isNew();
2592: if (null === $this->collCouponOrders || null !== $criteria || $partial) {
2593: if ($this->isNew() && null === $this->collCouponOrders) {
2594:
2595: $this->initCouponOrders();
2596: } else {
2597: $collCouponOrders = CouponOrderQuery::create(null, $criteria)
2598: ->filterByOrder($this)
2599: ->find($con);
2600: if (null !== $criteria) {
2601: if (false !== $this->collCouponOrdersPartial && count($collCouponOrders)) {
2602: $this->initCouponOrders(false);
2603:
2604: foreach($collCouponOrders as $obj) {
2605: if (false == $this->collCouponOrders->contains($obj)) {
2606: $this->collCouponOrders->append($obj);
2607: }
2608: }
2609:
2610: $this->collCouponOrdersPartial = true;
2611: }
2612:
2613: $collCouponOrders->getInternalIterator()->rewind();
2614: return $collCouponOrders;
2615: }
2616:
2617: if($partial && $this->collCouponOrders) {
2618: foreach($this->collCouponOrders as $obj) {
2619: if($obj->isNew()) {
2620: $collCouponOrders[] = $obj;
2621: }
2622: }
2623: }
2624:
2625: $this->collCouponOrders = $collCouponOrders;
2626: $this->collCouponOrdersPartial = false;
2627: }
2628: }
2629:
2630: return $this->collCouponOrders;
2631: }
2632:
2633: 2634: 2635: 2636: 2637: 2638: 2639: 2640: 2641: 2642:
2643: public function setCouponOrders(PropelCollection $couponOrders, PropelPDO $con = null)
2644: {
2645: $couponOrdersToDelete = $this->getCouponOrders(new Criteria(), $con)->diff($couponOrders);
2646:
2647: $this->couponOrdersScheduledForDeletion = unserialize(serialize($couponOrdersToDelete));
2648:
2649: foreach ($couponOrdersToDelete as $couponOrderRemoved) {
2650: $couponOrderRemoved->setOrder(null);
2651: }
2652:
2653: $this->collCouponOrders = null;
2654: foreach ($couponOrders as $couponOrder) {
2655: $this->addCouponOrder($couponOrder);
2656: }
2657:
2658: $this->collCouponOrders = $couponOrders;
2659: $this->collCouponOrdersPartial = false;
2660:
2661: return $this;
2662: }
2663:
2664: 2665: 2666: 2667: 2668: 2669: 2670: 2671: 2672:
2673: public function countCouponOrders(Criteria $criteria = null, $distinct = false, PropelPDO $con = null)
2674: {
2675: $partial = $this->collCouponOrdersPartial && !$this->isNew();
2676: if (null === $this->collCouponOrders || null !== $criteria || $partial) {
2677: if ($this->isNew() && null === $this->collCouponOrders) {
2678: return 0;
2679: }
2680:
2681: if($partial && !$criteria) {
2682: return count($this->getCouponOrders());
2683: }
2684: $query = CouponOrderQuery::create(null, $criteria);
2685: if ($distinct) {
2686: $query->distinct();
2687: }
2688:
2689: return $query
2690: ->filterByOrder($this)
2691: ->count($con);
2692: }
2693:
2694: return count($this->collCouponOrders);
2695: }
2696:
2697: 2698: 2699: 2700: 2701: 2702: 2703:
2704: public function addCouponOrder(CouponOrder $l)
2705: {
2706: if ($this->collCouponOrders === null) {
2707: $this->initCouponOrders();
2708: $this->collCouponOrdersPartial = true;
2709: }
2710: if (!in_array($l, $this->collCouponOrders->getArrayCopy(), true)) {
2711: $this->doAddCouponOrder($l);
2712: }
2713:
2714: return $this;
2715: }
2716:
2717: 2718: 2719:
2720: protected function doAddCouponOrder($couponOrder)
2721: {
2722: $this->collCouponOrders[]= $couponOrder;
2723: $couponOrder->setOrder($this);
2724: }
2725:
2726: 2727: 2728: 2729:
2730: public function removeCouponOrder($couponOrder)
2731: {
2732: if ($this->getCouponOrders()->contains($couponOrder)) {
2733: $this->collCouponOrders->remove($this->collCouponOrders->search($couponOrder));
2734: if (null === $this->couponOrdersScheduledForDeletion) {
2735: $this->couponOrdersScheduledForDeletion = clone $this->collCouponOrders;
2736: $this->couponOrdersScheduledForDeletion->clear();
2737: }
2738: $this->couponOrdersScheduledForDeletion[]= clone $couponOrder;
2739: $couponOrder->setOrder(null);
2740: }
2741:
2742: return $this;
2743: }
2744:
2745: 2746: 2747:
2748: public function clear()
2749: {
2750: $this->id = null;
2751: $this->ref = null;
2752: $this->customer_id = null;
2753: $this->address_invoice = null;
2754: $this->address_delivery = null;
2755: $this->invoice_date = null;
2756: $this->currency_id = null;
2757: $this->currency_rate = null;
2758: $this->transaction = null;
2759: $this->delivery_num = null;
2760: $this->invoice = null;
2761: $this->postage = null;
2762: $this->payment = null;
2763: $this->carrier = null;
2764: $this->status_id = null;
2765: $this->lang = null;
2766: $this->created_at = null;
2767: $this->updated_at = null;
2768: $this->alreadyInSave = false;
2769: $this->alreadyInValidation = false;
2770: $this->alreadyInClearAllReferencesDeep = false;
2771: $this->clearAllReferences();
2772: $this->resetModified();
2773: $this->setNew(true);
2774: $this->setDeleted(false);
2775: }
2776:
2777: 2778: 2779: 2780: 2781: 2782: 2783: 2784: 2785:
2786: public function clearAllReferences($deep = false)
2787: {
2788: if ($deep && !$this->alreadyInClearAllReferencesDeep) {
2789: $this->alreadyInClearAllReferencesDeep = true;
2790: if ($this->collOrderProducts) {
2791: foreach ($this->collOrderProducts as $o) {
2792: $o->clearAllReferences($deep);
2793: }
2794: }
2795: if ($this->collCouponOrders) {
2796: foreach ($this->collCouponOrders as $o) {
2797: $o->clearAllReferences($deep);
2798: }
2799: }
2800: if ($this->aCurrency instanceof Persistent) {
2801: $this->aCurrency->clearAllReferences($deep);
2802: }
2803: if ($this->aCustomer instanceof Persistent) {
2804: $this->aCustomer->clearAllReferences($deep);
2805: }
2806: if ($this->aOrderAddressRelatedByAddressInvoice instanceof Persistent) {
2807: $this->aOrderAddressRelatedByAddressInvoice->clearAllReferences($deep);
2808: }
2809: if ($this->aOrderAddressRelatedByAddressDelivery instanceof Persistent) {
2810: $this->aOrderAddressRelatedByAddressDelivery->clearAllReferences($deep);
2811: }
2812: if ($this->aOrderStatus instanceof Persistent) {
2813: $this->aOrderStatus->clearAllReferences($deep);
2814: }
2815:
2816: $this->alreadyInClearAllReferencesDeep = false;
2817: }
2818:
2819: if ($this->collOrderProducts instanceof PropelCollection) {
2820: $this->collOrderProducts->clearIterator();
2821: }
2822: $this->collOrderProducts = null;
2823: if ($this->collCouponOrders instanceof PropelCollection) {
2824: $this->collCouponOrders->clearIterator();
2825: }
2826: $this->collCouponOrders = null;
2827: $this->aCurrency = null;
2828: $this->aCustomer = null;
2829: $this->aOrderAddressRelatedByAddressInvoice = null;
2830: $this->aOrderAddressRelatedByAddressDelivery = null;
2831: $this->aOrderStatus = null;
2832: }
2833:
2834: 2835: 2836: 2837: 2838:
2839: public function __toString()
2840: {
2841: return (string) $this->exportTo(OrderPeer::DEFAULT_STRING_FORMAT);
2842: }
2843:
2844: 2845: 2846: 2847: 2848:
2849: public function isAlreadyInSave()
2850: {
2851: return $this->alreadyInSave;
2852: }
2853:
2854:
2855:
2856: 2857: 2858: 2859: 2860:
2861: public function keepUpdateDateUnchanged()
2862: {
2863: $this->modifiedColumns[] = OrderPeer::UPDATED_AT;
2864:
2865: return $this;
2866: }
2867:
2868: }
2869: