Repository navigation
Expand file tree
/
Copy pathOrder.php
More file actions
2468 lines (2038 loc) · 63.7 KB
/
Copy pathOrder.php
File metadata and controls
2468 lines (2038 loc) · 63.7 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
<?php
namespace SOB\Propel2\Base;
use DateTime;
use Exception;
use PDO;
use Propel\Runtime\ActiveQuery\Criteria;
use Propel\Runtime\ActiveQuery\ModelCriteria;
use Propel\Runtime\ActiveRecord\ActiveRecordInterface;
use Propel\Runtime\Connection\ConnectionInterface;
use Propel\Runtime\Exception\BadMethodCallException;
use Propel\Runtime\Exception\LogicException;
use Propel\Runtime\Exception\PropelException;
use Propel\Runtime\Map\TableMap;
use Propel\Runtime\Parser\AbstractParser;
use Propel\Runtime\Propel;
use Propel\Runtime\Util\PropelDateTime;
use SOB\Propel2\Map\OrderTableMap;
use SOB\Propel2\OrderQuery as ChildOrderQuery;
/**
* Base class that represents a row from the 'order' table.
*
*
*
* @package propel.generator.SOB.Propel2.Base
*/
abstract class Order implements ActiveRecordInterface
{
/**
* TableMap class name
*
* @var string
*/
public const TABLE_MAP = '\\SOB\\Propel2\\Map\\OrderTableMap';
/**
* Flag to prevent endless save loop, if this object is referenced
* by another object which falls in this transaction.
*
* @var bool
*/
protected $alreadyInSave = false;
/**
* The value for the customer_id field.
*
* @var int|null
*/
protected $customer_id;
/**
* attribute to determine whether this object has been deleted.
* @var bool
*/
protected $deleted = false;
/**
* The value for the employee_id field.
*
* @var int|null
*/
protected $employee_id;
/**
* The columns that have been modified in current object.
* Tracking modified columns allows us to only update modified columns.
* @var array
*/
protected $modifiedColumns = [];
/**
* attribute to determine if this object has previously been saved.
* @var bool
*/
protected $new = true;
/**
* The value for the notes field.
*
* @var string|null
*/
protected $notes;
/**
* The value for the order_date field.
*
* Note: this column has a database default value of: (expression) CURRENT_TIMESTAMP
* @var DateTime
*/
protected $order_date;
/**
* The value for the order_id field.
*
* @var int
*/
protected $order_id;
/**
* The value for the order_status_id field.
*
* Note: this column has a database default value of: 0
* @var int|null
*/
protected $order_status_id;
/**
* The value for the order_tax_status_id field.
*
* @var int|null
*/
protected $order_tax_status_id;
/**
* The value for the paid_date field.
*
* @var DateTime|null
*/
protected $paid_date;
/**
* The value for the payment_type field.
*
* @var string|null
*/
protected $payment_type;
/**
* The value for the ship_address field.
*
* @var string|null
*/
protected $ship_address;
/**
* The value for the ship_city field.
*
* @var string|null
*/
protected $ship_city;
/**
* The value for the ship_country_region field.
*
* @var string|null
*/
protected $ship_country_region;
/**
* The value for the ship_name field.
*
* @var string|null
*/
protected $ship_name;
/**
* The value for the ship_state_province field.
*
* @var string|null
*/
protected $ship_state_province;
/**
* The value for the ship_zip_postal_code field.
*
* @var string|null
*/
protected $ship_zip_postal_code;
/**
* The value for the shipped_date field.
*
* @var DateTime|null
*/
protected $shipped_date;
/**
* The value for the shipper_id field.
*
* @var int|null
*/
protected $shipper_id;
/**
* The value for the shipping_fee field.
*
* Note: this column has a database default value of: '0.0000'
* @var string|null
*/
protected $shipping_fee;
/**
* The value for the tax_rate field.
*
* Note: this column has a database default value of: 0.0
* @var float|null
*/
protected $tax_rate;
/**
* The value for the taxes field.
*
* Note: this column has a database default value of: '0.0000'
* @var string|null
*/
protected $taxes;
/**
* The (virtual) columns that are added at runtime
* The formatters can add supplementary columns based on a resultset
* @var array
*/
protected $virtualColumns = [];
/**
* Initializes internal state of SOB\Propel2\Base\Order object.
* @see applyDefaults()
*/
public function __construct()
{
$this->applyDefaultValues();
}
/**
* Derived method to catches calls to undefined methods.
*
* Provides magic import/export method support (fromXML()/toXML(), fromYAML()/toYAML(), etc.).
* Allows to define default __call() behavior if you overwrite __call()
*
* @param string $name
*
* @return array|string
*/
public function __call($name, $params)
{
if (0 === \strpos($name, 'get')) {
$virtualColumn = \substr($name, 3);
if ($this->hasVirtualColumn($virtualColumn)) {
return $this->getVirtualColumn($virtualColumn);
}
$virtualColumn = \lcfirst($virtualColumn);
if ($this->hasVirtualColumn($virtualColumn)) {
return $this->getVirtualColumn($virtualColumn);
}
}
if (0 === \strpos($name, 'from')) {
$format = \substr($name, 4);
$inputData = $params[0];
$keyType = $params[1] ?? TableMap::TYPE_PHPNAME;
return $this->importFrom($format, $inputData, $keyType);
}
if (0 === \strpos($name, 'to')) {
$format = \substr($name, 2);
$includeLazyLoadColumns = $params[0] ?? true;
$keyType = $params[1] ?? TableMap::TYPE_PHPNAME;
return $this->exportTo($format, $includeLazyLoadColumns, $keyType);
}
throw new BadMethodCallException(\sprintf('Call to undefined method: %s.', $name));
}
/**
* Clean up internal collections prior to serializing
* Avoids recursive loops that turn into segmentation faults when serializing
*
* @return array<string>
*/
public function __sleep() : array
{
$this->clearAllReferences();
$cls = new \ReflectionClass($this);
$propertyNames = [];
$serializableProperties = \array_diff($cls->getProperties(), $cls->getProperties(\ReflectionProperty::IS_STATIC));
foreach($serializableProperties as $property) {
$propertyNames[] = $property->getName();
}
return $propertyNames;
}
/**
* Return the string representation of this object
*
* @return string
*/
public function __toString()
{
return (string)$this->exportTo(OrderTableMap::DEFAULT_STRING_FORMAT);
}
/**
* Applies default values to this object.
* This method should be called from the object's constructor (or
* equivalent initialization method).
* @see __construct()
*/
public function applyDefaultValues() : void
{
$this->shipping_fee = '0.0000';
$this->taxes = '0.0000';
$this->tax_rate = 0.0;
$this->order_status_id = 0;
}
/**
* Build a Criteria object containing the values of all modified columns in this object.
*
* @return \Propel\Runtime\ActiveQuery\Criteria The Criteria object containing all modified values.
*/
public function buildCriteria() : Criteria
{
$criteria = new Criteria(OrderTableMap::DATABASE_NAME);
if ($this->isColumnModified(OrderTableMap::COL_ORDER_ID)) {
$criteria->add(OrderTableMap::COL_ORDER_ID, $this->order_id);
}
if ($this->isColumnModified(OrderTableMap::COL_EMPLOYEE_ID)) {
$criteria->add(OrderTableMap::COL_EMPLOYEE_ID, $this->employee_id);
}
if ($this->isColumnModified(OrderTableMap::COL_CUSTOMER_ID)) {
$criteria->add(OrderTableMap::COL_CUSTOMER_ID, $this->customer_id);
}
if ($this->isColumnModified(OrderTableMap::COL_ORDER_DATE)) {
$criteria->add(OrderTableMap::COL_ORDER_DATE, $this->order_date);
}
if ($this->isColumnModified(OrderTableMap::COL_SHIPPED_DATE)) {
$criteria->add(OrderTableMap::COL_SHIPPED_DATE, $this->shipped_date);
}
if ($this->isColumnModified(OrderTableMap::COL_SHIPPER_ID)) {
$criteria->add(OrderTableMap::COL_SHIPPER_ID, $this->shipper_id);
}
if ($this->isColumnModified(OrderTableMap::COL_SHIP_NAME)) {
$criteria->add(OrderTableMap::COL_SHIP_NAME, $this->ship_name);
}
if ($this->isColumnModified(OrderTableMap::COL_SHIP_ADDRESS)) {
$criteria->add(OrderTableMap::COL_SHIP_ADDRESS, $this->ship_address);
}
if ($this->isColumnModified(OrderTableMap::COL_SHIP_CITY)) {
$criteria->add(OrderTableMap::COL_SHIP_CITY, $this->ship_city);
}
if ($this->isColumnModified(OrderTableMap::COL_SHIP_STATE_PROVINCE)) {
$criteria->add(OrderTableMap::COL_SHIP_STATE_PROVINCE, $this->ship_state_province);
}
if ($this->isColumnModified(OrderTableMap::COL_SHIP_ZIP_POSTAL_CODE)) {
$criteria->add(OrderTableMap::COL_SHIP_ZIP_POSTAL_CODE, $this->ship_zip_postal_code);
}
if ($this->isColumnModified(OrderTableMap::COL_SHIP_COUNTRY_REGION)) {
$criteria->add(OrderTableMap::COL_SHIP_COUNTRY_REGION, $this->ship_country_region);
}
if ($this->isColumnModified(OrderTableMap::COL_SHIPPING_FEE)) {
$criteria->add(OrderTableMap::COL_SHIPPING_FEE, $this->shipping_fee);
}
if ($this->isColumnModified(OrderTableMap::COL_TAXES)) {
$criteria->add(OrderTableMap::COL_TAXES, $this->taxes);
}
if ($this->isColumnModified(OrderTableMap::COL_PAYMENT_TYPE)) {
$criteria->add(OrderTableMap::COL_PAYMENT_TYPE, $this->payment_type);
}
if ($this->isColumnModified(OrderTableMap::COL_PAID_DATE)) {
$criteria->add(OrderTableMap::COL_PAID_DATE, $this->paid_date);
}
if ($this->isColumnModified(OrderTableMap::COL_NOTES)) {
$criteria->add(OrderTableMap::COL_NOTES, $this->notes);
}
if ($this->isColumnModified(OrderTableMap::COL_TAX_RATE)) {
$criteria->add(OrderTableMap::COL_TAX_RATE, $this->tax_rate);
}
if ($this->isColumnModified(OrderTableMap::COL_ORDER_TAX_STATUS_ID)) {
$criteria->add(OrderTableMap::COL_ORDER_TAX_STATUS_ID, $this->order_tax_status_id);
}
if ($this->isColumnModified(OrderTableMap::COL_ORDER_STATUS_ID)) {
$criteria->add(OrderTableMap::COL_ORDER_STATUS_ID, $this->order_status_id);
}
return $criteria;
}
/**
* Builds a Criteria object containing the primary key for this object.
*
* Unlike buildCriteria() this method includes the primary key values regardless
* of whether they have been modified.
*
* @throws LogicException if no primary key is defined
*
* @return \Propel\Runtime\ActiveQuery\Criteria The Criteria object containing value(s) for primary key(s).
*/
public function buildPkeyCriteria() : Criteria
{
$criteria = ChildOrderQuery::create();
$criteria->add(OrderTableMap::COL_ORDER_ID, $this->order_id);
return $criteria;
}
/**
* Clears the current object, sets all attributes to their default values and removes
* outgoing references as well as back-references (from other objects to this one. Results probably in a database
* change of those foreign objects when you call `save` there).
*
* @return $this
*/
public function clear()
{
$this->order_id = null;
$this->employee_id = null;
$this->customer_id = null;
$this->order_date = null;
$this->shipped_date = null;
$this->shipper_id = null;
$this->ship_name = null;
$this->ship_address = null;
$this->ship_city = null;
$this->ship_state_province = null;
$this->ship_zip_postal_code = null;
$this->ship_country_region = null;
$this->shipping_fee = null;
$this->taxes = null;
$this->payment_type = null;
$this->paid_date = null;
$this->notes = null;
$this->tax_rate = null;
$this->order_tax_status_id = null;
$this->order_status_id = null;
$this->alreadyInSave = false;
$this->clearAllReferences();
$this->applyDefaultValues();
$this->resetModified();
$this->setNew(true);
$this->setDeleted(false);
return $this;
}
/**
* Resets all references and back-references to other model objects or collections of model objects.
*
* This method is used to reset all php object references (not the actual reference in the database).
* Necessary for object serialisation.
*
* @param bool $deep Whether to also clear the references on all referrer objects.
* @return $this
*/
public function clearAllReferences(bool $deep = false)
{
if ($deep) {
} // if ($deep)
return $this;
}
/**
* Makes a copy of this object that will be inserted as a new row in table when saved.
* It creates a new object filling in the simple attributes, but skipping any primary
* keys that are defined for the table.
*
* If desired, this method can also make copies of all associated (fkey referrers)
* objects.
*
* @param bool $deepCopy Whether to also copy all rows that refer (by fkey) to the current row.
* @throws \Propel\Runtime\Exception\PropelException
* @return \SOB\Propel2\Order Clone of current object.
*/
public function copy(bool $deepCopy = false)
{
// we use get_class(), because this might be a subclass
$clazz = static::class;
$copyObj = new $clazz();
$this->copyInto($copyObj, $deepCopy);
return $copyObj;
}
/**
* Sets contents of passed object to values from current object.
*
* If desired, this method can also make copies of all associated (fkey referrers)
* objects.
*
* @param object $copyObj An object of \SOB\Propel2\Order (or compatible) type.
* @param bool $deepCopy Whether to also copy all rows that refer (by fkey) to the current row.
* @param bool $makeNew Whether to reset autoincrement PKs and make the object new.
* @throws \Propel\Runtime\Exception\PropelException
*/
public function copyInto(object $copyObj, bool $deepCopy = false, bool $makeNew = true) : void
{
$copyObj->setEmployeeId($this->getEmployeeId());
$copyObj->setCustomerId($this->getCustomerId());
$copyObj->setOrderDate($this->getOrderDate());
$copyObj->setShippedDate($this->getShippedDate());
$copyObj->setShipperId($this->getShipperId());
$copyObj->setShipName($this->getShipName());
$copyObj->setShipAddress($this->getShipAddress());
$copyObj->setShipCity($this->getShipCity());
$copyObj->setShipStateProvince($this->getShipStateProvince());
$copyObj->setShipZipPostalCode($this->getShipZipPostalCode());
$copyObj->setShipCountryRegion($this->getShipCountryRegion());
$copyObj->setShippingFee($this->getShippingFee());
$copyObj->setTaxes($this->getTaxes());
$copyObj->setPaymentType($this->getPaymentType());
$copyObj->setPaidDate($this->getPaidDate());
$copyObj->setNotes($this->getNotes());
$copyObj->setTaxRate($this->getTaxRate());
$copyObj->setOrderTaxStatusId($this->getOrderTaxStatusId());
$copyObj->setOrderStatusId($this->getOrderStatusId());
if ($makeNew) {
$copyObj->setNew(true);
$copyObj->setOrderId(null); // this is a auto-increment column, so set to default value
}
}
/**
* Removes this object from datastore and sets delete attribute.
*
* @throws \Propel\Runtime\Exception\PropelException
* @see Order::setDeleted()
* @see Order::isDeleted()
*/
public function delete(?ConnectionInterface $con = null) : void
{
if ($this->isDeleted()) {
throw new PropelException('This object has already been deleted.');
}
if (null === $con) {
$con = Propel::getServiceContainer()->getWriteConnection(OrderTableMap::DATABASE_NAME);
}
$con->transaction(function() use ($con) : void {
$deleteQuery = ChildOrderQuery::create()
->filterByPrimaryKey($this->getPrimaryKey());
$ret = $this->preDelete($con);
if ($ret) {
$deleteQuery->delete($con);
$this->postDelete($con);
$this->setDeleted(true);
}
});
}
/**
* Checks and repairs the internal consistency of the object.
*
* This method is executed after an already-instantiated object is re-hydrated
* from the database. It exists to check any foreign keys to make sure that
* the objects related to the current object are correct based on foreign key.
*
* You can override this method in the stub class, but you should always invoke
* the base method from the overridden method (i.e. parent::ensureConsistency()),
* in case your model changes.
*
* @throws \Propel\Runtime\Exception\PropelException
*/
public function ensureConsistency() : void
{
}
/**
* Compares this with another <code>Order</code> instance. If
* <code>obj</code> is an instance of <code>Order</code>, delegates to
* <code>equals(Order)</code>. Otherwise, returns <code>false</code>.
*
* @param mixed $obj The object to compare to.
* @return bool Whether equal to the object specified.
*/
public function equals($obj) : bool
{
if (! $obj instanceof static) {
return false;
}
if ($this === $obj) {
return true;
}
if (null === $this->getPrimaryKey() || null === $obj->getPrimaryKey()) {
return false;
}
return $this->getPrimaryKey() === $obj->getPrimaryKey();
}
/**
* Export the current object properties to a string, using a given parser format
* <code>
* $book = BookQuery::create()->findPk(9012);
* echo $book->exportTo('JSON');
* => {"Id":9012,"Title":"Don Juan","ISBN":"0140422161","Price":12.99,"PublisherId":1234,"AuthorId":5678}');
* </code>
*
* @param \Propel\Runtime\Parser\AbstractParser|string $parser An AbstractParser instance, or a format name ('XML', 'YAML', 'JSON', 'CSV')
* @param bool $includeLazyLoadColumns (optional) Whether to include lazy load(ed) columns. Defaults to TRUE.
* @param string $keyType (optional) One of the class type constants TableMap::TYPE_PHPNAME, TableMap::TYPE_CAMELNAME, TableMap::TYPE_COLNAME, TableMap::TYPE_FIELDNAME, TableMap::TYPE_NUM. Defaults to TableMap::TYPE_PHPNAME.
* @return string The exported data
*/
public function exportTo($parser, bool $includeLazyLoadColumns = true, string $keyType = TableMap::TYPE_PHPNAME) : string
{
if (! $parser instanceof AbstractParser) {
$parser = AbstractParser::getParser($parser);
}
return $parser->fromArray($this->toArray($keyType, $includeLazyLoadColumns, [], true));
}
/**
* Populates the object using an array.
*
* This is particularly useful when populating an object from one of the
* request arrays (e.g. $_POST). This method goes through the column
* names, checking to see whether a matching key exists in populated
* array. If so the setByName() method is called for that column.
*
* You can specify the key type of the array by additionally passing one
* of the class type constants TableMap::TYPE_PHPNAME, TableMap::TYPE_CAMELNAME,
* TableMap::TYPE_COLNAME, TableMap::TYPE_FIELDNAME, TableMap::TYPE_NUM.
* The default key type is the column's TableMap::TYPE_PHPNAME.
*
* @param array $arr An array to populate the object from.
* @param string $keyType The type of keys the array uses.
* @return $this
*/
public function fromArray(array $arr, string $keyType = TableMap::TYPE_PHPNAME)
{
$keys = OrderTableMap::getFieldNames($keyType);
if (\array_key_exists($keys[0], $arr)) {
$this->setOrderId($arr[$keys[0]]);
}
if (\array_key_exists($keys[1], $arr)) {
$this->setEmployeeId($arr[$keys[1]]);
}
if (\array_key_exists($keys[2], $arr)) {
$this->setCustomerId($arr[$keys[2]]);
}
if (\array_key_exists($keys[3], $arr)) {
$this->setOrderDate($arr[$keys[3]]);
}
if (\array_key_exists($keys[4], $arr)) {
$this->setShippedDate($arr[$keys[4]]);
}
if (\array_key_exists($keys[5], $arr)) {
$this->setShipperId($arr[$keys[5]]);
}
if (\array_key_exists($keys[6], $arr)) {
$this->setShipName($arr[$keys[6]]);
}
if (\array_key_exists($keys[7], $arr)) {
$this->setShipAddress($arr[$keys[7]]);
}
if (\array_key_exists($keys[8], $arr)) {
$this->setShipCity($arr[$keys[8]]);
}
if (\array_key_exists($keys[9], $arr)) {
$this->setShipStateProvince($arr[$keys[9]]);
}
if (\array_key_exists($keys[10], $arr)) {
$this->setShipZipPostalCode($arr[$keys[10]]);
}
if (\array_key_exists($keys[11], $arr)) {
$this->setShipCountryRegion($arr[$keys[11]]);
}
if (\array_key_exists($keys[12], $arr)) {
$this->setShippingFee($arr[$keys[12]]);
}
if (\array_key_exists($keys[13], $arr)) {
$this->setTaxes($arr[$keys[13]]);
}
if (\array_key_exists($keys[14], $arr)) {
$this->setPaymentType($arr[$keys[14]]);
}
if (\array_key_exists($keys[15], $arr)) {
$this->setPaidDate($arr[$keys[15]]);
}
if (\array_key_exists($keys[16], $arr)) {
$this->setNotes($arr[$keys[16]]);
}
if (\array_key_exists($keys[17], $arr)) {
$this->setTaxRate($arr[$keys[17]]);
}
if (\array_key_exists($keys[18], $arr)) {
$this->setOrderTaxStatusId($arr[$keys[18]]);
}
if (\array_key_exists($keys[19], $arr)) {
$this->setOrderStatusId($arr[$keys[19]]);
}
return $this;
}
/**
* Retrieves a field from the object by name passed in as a string.
*
* @param string $name name
* @param string $type The type of fieldname the $name is of:
* one of the class type constants TableMap::TYPE_PHPNAME, TableMap::TYPE_CAMELNAME
* TableMap::TYPE_COLNAME, TableMap::TYPE_FIELDNAME, TableMap::TYPE_NUM.
* Defaults to TableMap::TYPE_PHPNAME.
* @return mixed Value of field.
*/
public function getByName(string $name, string $type = TableMap::TYPE_PHPNAME)
{
$pos = OrderTableMap::translateFieldName($name, $type, TableMap::TYPE_NUM);
$field = $this->getByPosition($pos);
return $field;
}
/**
* Retrieves a field from the object by Position as specified in the xml schema.
* Zero-based.
*
* @param int $pos Position in XML schema
* @return mixed Value of field at $pos
*/
public function getByPosition(int $pos)
{
switch ($pos) {
case 0:
return $this->getOrderId();
case 1:
return $this->getEmployeeId();
case 2:
return $this->getCustomerId();
case 3:
return $this->getOrderDate();
case 4:
return $this->getShippedDate();
case 5:
return $this->getShipperId();
case 6:
return $this->getShipName();
case 7:
return $this->getShipAddress();
case 8:
return $this->getShipCity();
case 9:
return $this->getShipStateProvince();
case 10:
return $this->getShipZipPostalCode();
case 11:
return $this->getShipCountryRegion();
case 12:
return $this->getShippingFee();
case 13:
return $this->getTaxes();
case 14:
return $this->getPaymentType();
case 15:
return $this->getPaidDate();
case 16:
return $this->getNotes();
case 17:
return $this->getTaxRate();
case 18:
return $this->getOrderTaxStatusId();
case 19:
return $this->getOrderStatusId();
default:
return;
} // switch()
}
/**
* Get the [customer_id] column value.
*
* @return int|null
*/
public function getCustomerId()
{
return $this->customer_id;
}
/**
* Get the [employee_id] column value.
*
* @return int|null
*/
public function getEmployeeId()
{
return $this->employee_id;
}
/**
* Get the columns that have been modified in this object.
* @return array A unique list of the modified column names for this object.
*/
public function getModifiedColumns() : array
{
return $this->modifiedColumns ? \array_keys($this->modifiedColumns) : [];
}
/**
* Get the [notes] column value.
*
* @return string|null
*/
public function getNotes()
{
return $this->notes;
}
/**
* Get the [optionally formatted] temporal [order_date] column value.
*
*
* @param string|null $format The date/time format string (either date()-style or strftime()-style).
* If format is NULL, then the raw DateTime object will be returned.
*
* @throws \Propel\Runtime\Exception\PropelException - if unable to parse/validate the date/time value.
* @return string|DateTime Formatted date/time value as string or DateTime object (if format is NULL), and 0 if column value is 0000-00-00 00:00:00.
*
*
* @psalm-return ($format is null ? DateTime : string)
*/
public function getOrderDate($format = null)
{
if (null === $format) {
return $this->order_date;
}
return $this->order_date instanceof \DateTimeInterface ? $this->order_date->format($format) : null;
}
/**
* Get the [order_id] column value.
*
* @return int
*/
public function getOrderId()
{
return $this->order_id;
}
/**
* Get the [order_status_id] column value.
*
* @return int|null
*/
public function getOrderStatusId()
{
return $this->order_status_id;
}
/**
* Get the [order_tax_status_id] column value.
*
* @return int|null
*/
public function getOrderTaxStatusId()
{
return $this->order_tax_status_id;
}
/**
* Get the [optionally formatted] temporal [paid_date] column value.
*
*
* @param string|null $format The date/time format string (either date()-style or strftime()-style).
* If format is NULL, then the raw DateTime object will be returned.
*
* @throws \Propel\Runtime\Exception\PropelException - if unable to parse/validate the date/time value.
* @return string|DateTime|null Formatted date/time value as string or DateTime object (if format is NULL), NULL if column is NULL, and 0 if column value is 0000-00-00 00:00:00.
*
*
* @psalm-return ($format is null ? DateTime|null : string|null)
*/
public function getPaidDate($format = null)
{
if (null === $format) {
return $this->paid_date;
}
return $this->paid_date instanceof \DateTimeInterface ? $this->paid_date->format($format) : null;
}
/**
* Get the [payment_type] column value.
*
* @return string|null
*/
public function getPaymentType()
{
return $this->payment_type;
}
/**
* Returns the primary key for this object (row).
* @return int
*/
public function getPrimaryKey()
{
return $this->getOrderId();
}
/**
* Get the [ship_address] column value.
*
* @return string|null
*/
public function getShipAddress()
{
return $this->ship_address;
}
/**
* Get the [ship_city] column value.
*
* @return string|null
*/
public function getShipCity()
{
return $this->ship_city;
}
/**
* Get the [ship_country_region] column value.
*
* @return string|null
*/
public function getShipCountryRegion()
{
return $this->ship_country_region;
}
/**
* Get the [ship_name] column value.
*