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