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