2 namespace Stock\Entity;
4 use Doctrine\ORM\Mapping as ORM;
9 * A Trans Union HPI vs stock item.
12 * @ORM\HasLifecycleCallbacks
13 * @ORM\Table(name="tuhpi")
19 * Can archive records.
21 const ARCHIVE = false;
23 * Pull Synchronization Strategy for this table.
25 const PULL_SYNCH_STRATEGY = false;
27 * Push Synchronization Strategy for this table.
29 const PUSH_SYNCH_STRATEGY = false;
31 * Post insert action must be called after new entity is flushed to database.
33 const HAVE_POST_INSERT = true;
37 /* ------------------------------------ Identification ------------------------------------ */
40 * @ORM\Column(type="integer");
41 * @ORM\GeneratedValue(strategy="AUTO")
46 /* ------------------------------------ Ownership ------------------------------------ */
48 * @ORM\ManyToOne(targetEntity="\Company\Entity\Company")
49 * @ORM\JoinColumn(nullable=false, name="company_id")
54 * @ORM\ManyToOne(targetEntity="\User\Entity\Profile")
55 * @ORM\JoinColumn(nullable=false, name="created_by_profile_id")
60 * @ORM\ManyToOne(targetEntity="\Valuation\Entity\Valuation", cascade={"all"})
61 * @ORM\JoinColumn(nullable=true, name="stock_valuation_id")
66 * @ORM\ManyToOne(targetEntity="\PriceGuide\Entity\PriceGuide")
67 * @ORM\JoinColumn(nullable=true, name="price_guide_id")
69 protected $priceGuide;
72 * @ORM\ManyToOne(targetEntity="\Auction\Entity\Auction")
73 * @ORM\JoinColumn(nullable=true, name="auction_id")
79 * @ORM\ManyToOne(targetEntity="\Stock\Entity\Stock")
80 * @ORM\JoinColumn(nullable=false, name="stock_id")
85 /* ------------------------------------ Finance Information ------------------------------------ */
89 * @ORM\Column(type="string", length=15, nullable=true, name="transaction_number")
91 protected $transactionNumber;
94 * @ORM\Column(type="string", length=255, nullable=true, name="f_financeProvider")
96 protected $f_financeProvider;
99 * @ORM\Column(type="string", length=255, nullable=true, name="f_financeBranch")
101 protected $f_financeBranch;
104 * @ORM\Column(type="string", length=255, nullable=true, name="f_agreementOrAccountNumber")
106 protected $f_agreementOrAccountNumber;
109 * @ORM\Column(type="string", length=255, nullable=true, name="f_agreementType")
111 protected $f_agreementType;
114 * @ORM\Column(type="string", length=255, nullable=true, name="f_telephoneNumber")
116 protected $f_telephoneNumber;
119 * @ORM\Column(type="string", length=255, nullable=true, name="f_resultCode")
121 protected $f_resultCode;
124 /* ------------------------------------ Finance History ------------------------------------ */
127 * @ORM\Column(type="text", name="fh_data")
132 /* ------------------------------------ Accident History ------------------------------------ */
136 * @ORM\Column(type="text", name="ah_data")
141 * @ORM\Column(type="string", length=255, nullable=true, name="ah_assessmentDate")
143 protected $ah_assessmentDate;
147 * @ORM\Column(type="string", length=255, nullable=true, name="ah_vehicleDescription")
149 protected $ah_vehicleDescription;
152 * @ORM\Column(type="string", length=255, nullable=true, name="ah_vinMatch")
154 protected $ah_vinMatch;
157 * @ORM\Column(type="string", length=255, nullable=true, name="ah_regMatch")
159 protected $ah_regMatch;
162 * @ORM\Column(type="string", length=255, nullable=true, name="ah_estimatedRepairCost")
164 protected $ah_estimatedRepairCost;
167 * @ORM\Column(type="string", length=255, nullable=true, name="ah_assessmentNumber")
169 protected $ah_assessmentNumber;
172 * @ORM\Column(type="string", length=255, nullable=true, name="ah_engineMatch")
174 protected $ah_engineMatch;
177 * @ORM\Column(type="string", length=255, nullable=true, name="ah_estimatePercentageOfRetailValue")
179 protected $ah_estimatePercentageOfRetailValue;
182 * @ORM\Column(type="string", length=255, nullable=true, name="ah_resultCode")
184 protected $ah_resultCode;
187 /* ------------------------------------ Stolen Information ------------------------------------ */
191 * @ORM\Column(type="string", length=255, nullable=true, name="si_policeStation")
193 protected $si_policeStation;
197 * @ORM\Column(type="string", length=255, nullable=true, name="si_caseNumber")
199 protected $si_caseNumber;
202 * @ORM\Column(type="string", length=255, nullable=true, name="si_dateStolen")
204 protected $si_dateStolen;
208 * @ORM\Column(type="string", length=255, nullable=true, name="si_vinMatch")
210 protected $si_vinMatch;
213 * @ORM\Column(type="string", length=255, nullable=true, name="si_engineMatch")
215 protected $si_engineMatch;
218 * @ORM\Column(type="string", length=255, nullable=true, name="si_registrationMatch")
220 protected $si_registrationMatch;
223 * @ORM\Column(type="string", length=255, nullable=true, name="si_resultCode")
225 protected $si_resultCode;
228 /* ------------------------------------ Alert Information ------------------------------------ */
232 * @ORM\Column(type="string", length=255, nullable=true, name="ai_company")
234 protected $ai_company;
238 * @ORM\Column(type="string", length=255, nullable=true, name="ai_referenceNumber")
240 protected $ai_referenceNumber;
243 * @ORM\Column(type="string", length=255, nullable=true, name="ai_alertReason")
245 protected $ai_alertReason;
248 * @ORM\Column(type="string", length=255, nullable=true, name="ai_telephoneNumber")
250 protected $ai_telephoneNumber;
253 * @ORM\Column(type="string", length=255, nullable=true, name="ai_resultCode")
255 protected $ai_resultCode;
258 /* ------------------------------------ IVID History Information ------------------------------------ */
262 * @ORM\Column(type="string", length=255, nullable=true, name="ivid_responseCode")
264 protected $ivid_responseCode;
268 * @ORM\Column(type="string", length=255, nullable=true, name="ivid_responseDescription")
270 protected $ivid_responseDescription;
273 * @ORM\Column(type="string", length=255, nullable=true, name="ivid_referenceNumber")
275 protected $ivid_referenceNumber;
278 * @ORM\Column(type="string", length=255, nullable=true, name="ivid_contactNumber")
280 protected $ivid_contactNumber;
283 * @ORM\Column(type="string", length=255, nullable=true, name="ivid_resultCode")
285 protected $ivid_resultCode;
288 /* ------------------------------------ Microdot Information ------------------------------------ */
292 * @ORM\Column(type="string", length=255, nullable=true, name="mi_company")
294 protected $mi_company;
298 * @ORM\Column(type="string", length=255, nullable=true, name="mi_referenceNumber")
300 protected $mi_referenceNumber;
303 * @ORM\Column(type="string", length=255, nullable=true, name="mi_contactNumber")
305 protected $mi_contactNumber;
308 * @ORM\Column(type="string", length=255, nullable=true, name="mi_dateApplied")
310 protected $mi_dateApplied;
313 * @ORM\Column(type="string", length=255, nullable=true, name="mi_resultCode")
315 protected $mi_resultCode;
318 /* ------------------------------------ VESA Information ------------------------------------ */
322 * @ORM\Column(type="string", length=255, nullable=true, name="vesa_CertificateNumber")
324 protected $vesa_CertificateNumber;
327 * @ORM\Column(type="string", length=255, nullable=true, name="vesa_dateFitted")
329 protected $vesa_dateFitted;
332 * @ORM\Column(type="string", length=255, nullable=true, name="vesa_brandName")
334 protected $vesa_brandName;
337 * @ORM\Column(type="string", length=255, nullable=true, name="vesa_brandModel")
339 protected $vesa_brandModel;
342 * @ORM\Column(type="string", length=255, nullable=true, name="vesa_deviceDescriptionType")
344 protected $vesa_deviceDescriptionType;
347 * @ORM\Column(type="string", length=255, nullable=true, name="vesa_resultCode")
349 protected $vesa_resultCode;
352 /* ------------------------------------ Registration History ------------------------------------ */
355 * @ORM\Column(type="text", name="rh_data")
361 /* ------------------------------------ Enquiry History ------------------------------------ */
365 * @ORM\Column(type="text", name="eh_data")
371 /* ------------------------------------ Mileage History ------------------------------------ */
375 * @ORM\Column(type="text", name="mh_data")
379 /* ------------------------------------ VehicleOptionCodes ------------------------------------ */
383 * @ORM\Column(type="integer", nullable=false, name="vc_month");
385 protected $vc_month = 0;
389 * @ORM\Column(type="integer", nullable=false, name="vc_year");
391 protected $vc_year = 0;
394 * @ORM\Column(type="integer", nullable=false, name="vc_newOptionCode");
396 protected $vc_newOptionCode = 0;
399 * @ORM\Column(type="integer", nullable=false, name="vc_usedOptionCode");
401 protected $vc_usedOptionCode = 0;
404 * @ORM\Column(type="integer", nullable=false, name="vc_maximumRange");
406 protected $vc_maximumRange = 0;
409 * @ORM\Column(type="integer", nullable=false, name="vc_minimunRange");
411 protected $vc_minimunRange = 0;
414 * @ORM\Column(type="integer", nullable=false, name="vc_newPrice");
416 protected $vc_newPrice = 0;
419 * @ORM\Column(type="integer", nullable=false, name="vc_retailPrice");
421 protected $vc_retailPrice = 0;
425 * @ORM\Column(type="integer", nullable=false, name="vc_tradePrice");
427 protected $vc_tradePrice = 0;
430 * @ORM\Column(type="string", length=255, nullable=true, name="vc_resultCode")
432 protected $vc_resultCode;
436 /* ------------------------------------ VehicleOptionCodes ------------------------------------ */
438 * @ORM\Column(type="string", length=50, nullable=true, name="vci_hpiNumber");
440 protected $vci_HPINumber;
443 * @ORM\Column(type="string", length=50, nullable=true, name="vci_matchColour");
445 protected $vci_matchColour;
448 * @ORM\Column(type="string", length=50, nullable=true, name="vci_matchEngineNumber");
450 protected $vci_matchEngineNumber;
453 * @ORM\Column(type="string", length=50, nullable=true, name="vci_matchManufacturer");
455 protected $vci_matchManufacturer;
458 * @ORM\Column(type="string", length=50, nullable=true, name="vci_matchModel");
460 protected $vci_matchModel;
463 * @ORM\Column(type="string", length=250, nullable=true, name="vci_matchString");
465 protected $vci_matchString;
468 * @ORM\Column(type="string", length=50, nullable=true, name="vci_matchVehicleRegistration");
470 protected $vci_matchVehicleRegistration;
473 * @ORM\Column(type="string", length=50, nullable=true, name="vci_matchVinorChassis");
475 protected $vci_matchVinorChassis;
478 * @ORM\Column(type="string", length=50, nullable=true, name="vci_matchYear");
480 protected $vci_matchYear;
484 /* ------------------------------------ VehicleValueInfo ------------------------------------ */
489 * @ORM\Column(type="integer", nullable=false, name="vvi_guideMonth");
491 protected $vvi_guideMonth = 0;
494 * @ORM\Column(type="integer", nullable=false, name="vvi_guideYear");
496 protected $vvi_guideYear = 0;
499 * @ORM\Column(type="integer", nullable=false, name="vvi_newListPrice");
501 protected $vvi_newListPrice = 0;
504 * @ORM\Column(type="integer", nullable=false, name="vvi_retailPrice");
506 protected $vvi_retailPrice = 0;
509 * @ORM\Column(type="integer", nullable=false, name="vvi_tradePrice");
511 protected $vvi_tradePrice = 0;
514 * @ORM\Column(type="integer", nullable=false, name="vvi_costPrice");
516 protected $vvi_costPrice = 0;
519 * @ORM\Column(type="integer", nullable=false, name="vvi_adjustedRetailPrice_mileageAndCondition");
521 protected $vvi_adjustedRetailPrice_mileageAndCondition = 0;
524 * @ORM\Column(type="integer", nullable=false, name="vvi_AdjustedTradePrice_MileageAndCondition");
526 protected $vvi_AdjustedTradePrice_MileageAndCondition = 0;
529 * @ORM\Column(type="integer", nullable=false, name="vvi_adjustedRetailPrice");
531 protected $vvi_adjustedRetailPrice = 0;
534 * @ORM\Column(type="integer", nullable=false, name="vvi_adjustedTradePrice");
536 protected $vvi_adjustedTradePrice = 0;
539 * @ORM\Column(type="integer", nullable=false, name="vvi_estimatedRetailPrice");
541 protected $vvi_estimatedRetailPrice = 0;
544 * @ORM\Column(type="integer", nullable=false, name="vvi_estimatedTradePrice");
546 protected $vvi_estimatedTradePrice = 0;
549 * @ORM\Column(type="integer", nullable=false, name="vvi_estimatedCostPrice");
551 protected $vvi_estimatedCostPrice = 0;
554 * @ORM\Column(type="integer", nullable=false, name="vvi_adjustedEstimatedRetailPrice_mileageAndCondition");
556 protected $vvi_adjustedEstimatedRetailPrice_mileageAndCondition = 0;
559 * @ORM\Column(type="integer", nullable=false, name="vvi_adjustedEstimatedTradePrice_mileageAndCondition");
561 protected $vvi_adjustedEstimatedTradePrice_mileageAndCondition = 0;
564 * @ORM\Column(type="integer", nullable=false, name="vvi_adjustedEstimatedcostprice_mileageandcondition");
566 protected $vvi_adjustedEstimatedcostprice_mileageandcondition = 0;
569 * @ORM\Column(type="integer", nullable=false, name="vvi_adjustedEstimatedRetailPrice");
571 protected $vvi_adjustedEstimatedRetailPrice = 0;
574 * @ORM\Column(type="integer", nullable=false, name="vvi_adjustedEstimatedTradePrice");
576 protected $vvi_adjustedEstimatedTradePrice = 0;
579 * @ORM\Column(type="integer", nullable=false, name="vvi_adjustedEstimatedCostPrice");
581 protected $vvi_adjustedEstimatedCostPrice = 0;
585 * @ORM\Column(type="string", length=255, nullable=true, name="vvi_resultCode")
587 protected $vvi_resultCode;
591 * @ORM\Column(type="string", length=255, nullable=true, name="hpi_type")
595 /* ------------------------------------ Error codes ------------------------------------ */
599 * @ORM\Column(type="integer", nullable=true, name="error_code");
601 protected $error_code = 0;
605 /* ------------------------------------ Tracking ------------------------------------ */
609 * @ORM\Column(type="datetime", nullable=true);
614 * @ORM\Column(type="string", length=25, nullable=true, name="previous_status");
616 protected $previousState;
619 * @ORM\Column(type="string", length=25, nullable=true, name="status");
624 * @ORM\Column(type="datetime");
629 * @ORM\Column(type="datetime", nullable=true);
634 * @ORM\Column(type="boolean");
636 protected $archived = false;
641 * Initialize collections.
643 public function __construct()
645 $this->accessories = new \Doctrine\Common\Collections\ArrayCollection();
646 $this->damages = new \Doctrine\Common\Collections\ArrayCollection();
651 * Magic getter to expose protected properties.
653 * @param string $property
656 public function __get($property)
658 return $this->$property;
662 * Magic setter to save protected properties.
664 * @param string $property
665 * @param mixed $value
667 public function __set($property, $value)
669 $this->$property = $value;
675 public function setCreateTime()
677 if (\Utility\Registry::isAuthenticated())
679 $this->company = \Utility\Registry::resolveCompanyContext($this->company);
680 $this->createdBy = \Utility\Registry::resolveProfileContext($this->createdBy);
682 $this->created = new \DateTime("now");
688 public function setUpdateTime()
690 $this->updated = new \DateTime("now");
691 /* if ('' == $this->jobState
692 && is_null($this->loadedOnPriceGuide))
694 $this->loadedOnPriceGuide = new \DateTime("now");
701 * Convert the object to an array.
702 * @param array $expand
703 * @param array $intersect
704 * @param boolean $showIdentifiers
705 * @param integer $expandAll
708 public function toArray(
709 array $expand = array(), array $intersect = array(),
710 $showIdentifiers = false, $expandAll = 0
713 $intersect = array_flip($intersect);
714 $dateTimeFormat = \Utility\Registry::getConfigParam('DateTimeFormat');
715 $includeAll = empty($intersect);
717 ($includeAll || isset($intersect['id']))
718 && $data['id'] = $this->id;
720 ($includeAll || isset($intersect['company']))
721 && $data['company'] = (in_array('company', $expand) || $expandAll || $showIdentifiers)
722 && !is_null($this->company)
723 ? (!$showIdentifiers || in_array('company', $expand) ? $this->company->toArray(
724 $expand, $intersect, $showIdentifiers, ($expandAll - 1)
725 ) : $this->company->id)
727 ($includeAll || isset($intersect['createdBy']))
728 && $data['createdBy'] = (in_array('createdBy', $expand) || $expandAll || $showIdentifiers)
729 && !is_null($this->createdBy)
730 ? (!$showIdentifiers || in_array('createdBy', $expand) ? $this->createdBy->toArray(
731 $expand, $intersect, $showIdentifiers, ($expandAll - 1)
732 ) : $this->createdBy->id)
734 ($includeAll || isset($intersect['valuation']))
735 && $data['valuation'] = (in_array('valuation_', $expand) || $expandAll || $showIdentifiers)
736 && !is_null($this->valuation)
737 ? (!$showIdentifiers || in_array('valuation_', $expand) ? $this->valuation->toArray(
738 /* $expand, $intersect, $showIdentifiers, ($expandAll - 1) */
739 ) : $this->valuation->id)
742 ($includeAll || isset($intersect['priceGuide']))
743 && $data['priceGuide'] = (in_array('priceGuide', $expand) || $expandAll || $showIdentifiers)
744 && !is_null($this->priceGuide)
745 ? (!$showIdentifiers || in_array('priceGuide', $expand) ? $this->priceGuide->toArray(
746 $expand, $intersect, $showIdentifiers, ($expandAll - 1)
747 ) : $this->priceGuide->id)
750 ($includeAll || isset($intersect['auction']))
751 && $data['auction'] = (in_array('auction', $expand) || $expandAll || $showIdentifiers)
752 && !is_null($this->auction)
753 ? (!$showIdentifiers || in_array('auction', $expand) ? $this->auction->toArray(
754 $expand, $intersect, $showIdentifiers, ($expandAll - 1)
755 ) : $this->auction->id)
758 ($includeAll || isset($intersect['stock']))
759 && $data['stock'] = (in_array('stock', $expand) || $expandAll || $showIdentifiers)
760 && !is_null($this->stock)
761 ? (!$showIdentifiers || in_array('stock', $expand) ? $this->stock->toArray(
762 $expand, $intersect, $showIdentifiers, ($expandAll - 1)
763 ) : $this->stock->id)
767 if (2 == $showIdentifiers)
769 $data['mmCode'] = $this->type->mmCode;
770 $data['category'] = $this->type->category->id;
771 $data['make'] = $this->type->model->make->id;
772 $data['model'] = $this->type->model->id;
778 /* ($includeAll || isset($intersect['referenceNumber']))
779 && $data['referenceNumber'] = $this->referenceNumber; */
780 ($includeAll || isset($intersect['transactionNumber']))
781 && $data['transactionNumber'] = $this->transactionNumber;
783 /* ------------------------------------ Finance Information ------------------------------------ */
785 ($includeAll || isset($intersect['f_financeProvider']))
786 && $data['f_financeProvider'] = $this->f_financeProvider;
789 ($includeAll || isset($intersect['f_financeBranch']))
790 && $data['f_financeBranch'] = $this->f_financeBranch;
792 ($includeAll || isset($intersect['f_agreementOrAccountNumber']))
793 && $data['f_agreementOrAccountNumber'] = $this->f_agreementOrAccountNumber;
795 ($includeAll || isset($intersect['f_agreementType']))
796 && $data['f_agreementType'] = $this->f_agreementType;
798 ($includeAll || isset($intersect['f_telephoneNumber']))
799 && $data['f_telephoneNumber'] = $this->f_telephoneNumber;
801 ($includeAll || isset($intersect['f_resultCode']))
802 && $data['f_resultCode'] = $this->f_resultCode;
805 /* ------------------------------------ Finance History ------------------------------------ */
808 ($includeAll || isset($intersect['fh_data']))
809 && $data['fh_data'] = unserialize($this->fh_data);
812 /* ------------------------------------ Accident History ------------------------------------ */
814 ($includeAll || isset($intersect['ah_data']))
815 && $data['ah_data'] = unserialize($this->ah_data);
819 /* ------------------------------------ Stolen Information ------------------------------------ */
821 ($includeAll || isset($intersect['si_policeStation']))
822 && $data['si_policeStation'] = $this->si_policeStation;
824 ($includeAll || isset($intersect['si_caseNumber']))
825 && $data['si_caseNumber'] = $this->si_caseNumber;
827 ($includeAll || isset($intersect['si_dateStolen']))
828 && $data['si_dateStolen'] = $this->si_dateStolen;
830 ($includeAll || isset($intersect['si_vinMatch']))
831 && $data['si_vinMatch'] = $this->si_vinMatch;
833 ($includeAll || isset($intersect['si_engineMatch']))
834 && $data['si_engineMatch'] = $this->si_engineMatch;
836 ($includeAll || isset($intersect['si_registrationMatch']))
837 && $data['si_registrationMatch'] = $this->si_registrationMatch;
839 ($includeAll || isset($intersect['si_resultCode']))
840 && $data['si_resultCode'] = $this->si_resultCode;
843 /* ------------------------------------ Alert Information ------------------------------------ */
845 ($includeAll || isset($intersect['ai_company']))
846 && $data['ai_company'] = $this->ai_company;
848 ($includeAll || isset($intersect['ai_referenceNumber']))
849 && $data['ai_referenceNumber'] = $this->ai_referenceNumber;
851 ($includeAll || isset($intersect['ai_alertReason']))
852 && $data['ai_alertReason'] = $this->ai_alertReason;
854 ($includeAll || isset($intersect['ai_telephoneNumber']))
855 && $data['ai_telephoneNumber'] = $this->ai_telephoneNumber;
857 ($includeAll || isset($intersect['ai_resultCode']))
858 && $data['ai_resultCode'] = $this->ai_resultCode;
861 /* ------------------------------------ IVID History Information ------------------------------------ */
863 ($includeAll || isset($intersect['ivid_responseCode']))
864 && $data['ivid_responseCode'] = $this->ivid_responseCode;
866 ($includeAll || isset($intersect['ivid_responseDescription']))
867 && $data['ivid_responseDescription'] = $this->ivid_responseDescription;
869 ($includeAll || isset($intersect['ivid_referenceNumber']))
870 && $data['ivid_referenceNumber'] = $this->ivid_referenceNumber;
872 ($includeAll || isset($intersect['ivid_contactNumber']))
873 && $data['ivid_contactNumber'] = $this->ivid_contactNumber;
875 ($includeAll || isset($intersect['ivid_resultCode']))
876 && $data['ivid_resultCode'] = $this->ivid_resultCode;
879 /* ------------------------------------ Microdot Information ------------------------------------ */
881 ($includeAll || isset($intersect['mi_company']))
882 && $data['mi_company'] = $this->mi_company;
884 ($includeAll || isset($intersect['mi_referenceNumber']))
885 && $data['mi_referenceNumber'] = $this->mi_referenceNumber;
887 ($includeAll || isset($intersect['mi_contactNumber']))
888 && $data['mi_contactNumber'] = $this->mi_contactNumber;
890 ($includeAll || isset($intersect['mi_dateApplied']))
891 && $data['mi_dateApplied'] = $this->mi_dateApplied;
893 ($includeAll || isset($intersect['mi_resultCode']))
894 && $data['mi_resultCode'] = $this->mi_resultCode;
898 /* ------------------------------------ VESA Information ------------------------------------ */
900 ($includeAll || isset($intersect['vesa_CertificateNumber']))
901 && $data['vesa_CertificateNumber'] = $this->vesa_CertificateNumber;
903 ($includeAll || isset($intersect['vesa_dateFitted']))
904 && $data['vesa_dateFitted'] = $this->vesa_dateFitted;
906 ($includeAll || isset($intersect['vesa_brandName']))
907 && $data['vesa_brandName'] = $this->vesa_brandName;
909 ($includeAll || isset($intersect['vesa_brandModel']))
910 && $data['vesa_brandModel'] = $this->vesa_brandModel;
912 ($includeAll || isset($intersect['vesa_deviceDescriptionType']))
913 && $data['vesa_deviceDescriptionType'] = $this->vesa_deviceDescriptionType;
915 ($includeAll || isset($intersect['vesa_resultCode']))
916 && $data['vesa_resultCode'] = $this->vesa_resultCode;
920 /* ------------------------------------ Registration History ------------------------------------ */
922 ($includeAll || isset($intersect['rh_data']))
923 && $data['rh_data'] = unserialize($this->rh_data);
927 /* ------------------------------------ Enquiry History ------------------------------------ */
929 ($includeAll || isset($intersect['eh_data']))
930 && $data['eh_data'] = unserialize($this->eh_data);
934 /* ------------------------------------ Mileage History ------------------------------------ */
936 ($includeAll || isset($intersect['mh_data']))
937 && $data['mh_data'] = unserialize($this->mh_data);
940 /* ------------------------------------ VehicleOptionCodes ------------------------------------ */
942 ($includeAll || isset($intersect['vc_month']))
943 && $data['vc_month'] = $this->vc_month;
945 ($includeAll || isset($intersect['vc_year']))
946 && $data['vc_year'] = $this->vc_year;
948 ($includeAll || isset($intersect['vc_newOptionCode']))
949 && $data['vc_newOptionCode'] = $this->vc_newOptionCode;
951 ($includeAll || isset($intersect['vc_usedOptionCode']))
952 && $data['vc_usedOptionCode'] = $this->vc_usedOptionCode;
954 ($includeAll || isset($intersect['vc_maximumRange']))
955 && $data['vc_maximumRange'] = $this->vc_maximumRange;
957 ($includeAll || isset($intersect['vc_minimunRange']))
958 && $data['vc_minimunRange'] = $this->vc_minimunRange;
960 ($includeAll || isset($intersect['vc_newPrice']))
961 && $data['vc_newPrice'] = $this->vc_newPrice;
963 ($includeAll || isset($intersect['vc_retailPrice']))
964 && $data['vc_retailPrice'] = $this->vc_retailPrice;
966 ($includeAll || isset($intersect['vc_tradePrice']))
967 && $data['vc_tradePrice'] = $this->vc_tradePrice;
970 ($includeAll || isset($intersect['vc_resultCode']))
971 && $data['vc_resultCode'] = $this->vc_resultCode;
975 /* ------------------------------------ VehicleConfirmationInfo ------------------------------------ */
977 ($includeAll || isset($intersect['vci_HPINumber']))
978 && $data['vci_HPINumber'] = $this->vci_HPINumber;
980 ($includeAll || isset($intersect['vci_matchColour']))
981 && $data['vci_matchColour'] = $this->vci_matchColour;
983 ($includeAll || isset($intersect['vci_matchEngineNumber']))
984 && $data['vci_matchEngineNumber'] = $this->vci_matchEngineNumber;
986 ($includeAll || isset($intersect['vci_matchManufacturer']))
987 && $data['vci_matchManufacturer'] = $this->vci_matchManufacturer;
989 ($includeAll || isset($intersect['vci_matchModel']))
990 && $data['vci_matchModel'] = $this->vci_matchModel;
992 ($includeAll || isset($intersect['vci_matchString']))
993 && $data['vci_matchString'] = $this->vci_matchString;
995 ($includeAll || isset($intersect['vci_matchVehicleRegistration']))
996 && $data['vci_matchVehicleRegistration'] = $this->vci_matchVehicleRegistration;
998 ($includeAll || isset($intersect['vci_matchVinorChassis']))
999 && $data['vci_matchVinorChassis'] = $this->vci_matchVinorChassis;
1001 ($includeAll || isset($intersect['vci_matchYear']))
1002 && $data['vci_matchYear'] = $this->vci_matchYear;
1004 /* ------------------------------------ VehicleValueInfo ------------------------------------ */
1006 ($includeAll || isset($intersect['vvi_guideMonth']))
1007 && $data['vvi_guideMonth'] = $this->vvi_guideMonth;
1009 ($includeAll || isset($intersect['vvi_guideYear']))
1010 && $data['vvi_guideYear'] = $this->vvi_guideYear;
1012 ($includeAll || isset($intersect['vvi_newListPrice']))
1013 && $data['vvi_newListPrice'] = $this->vvi_newListPrice;
1015 ($includeAll || isset($intersect['vvi_retailPrice']))
1016 && $data['vvi_retailPrice'] = $this->vvi_retailPrice;
1018 ($includeAll || isset($intersect['vvi_tradePrice']))
1019 && $data['vvi_tradePrice'] = $this->vvi_tradePrice;
1021 ($includeAll || isset($intersect['vvi_costPrice']))
1022 && $data['vvi_costPrice'] = $this->vvi_costPrice;
1024 ($includeAll || isset($intersect['vvi_adjustedRetailPrice_mileageAndCondition']))
1025 && $data['vvi_adjustedRetailPrice_mileageAndCondition'] = $this->vvi_adjustedRetailPrice_mileageAndCondition;
1027 ($includeAll || isset($intersect['vvi_AdjustedTradePrice_MileageAndCondition']))
1028 && $data['vvi_AdjustedTradePrice_MileageAndCondition'] = $this->vvi_AdjustedTradePrice_MileageAndCondition;
1030 ($includeAll || isset($intersect['vvi_adjustedRetailPrice']))
1031 && $data['vvi_adjustedRetailPrice'] = $this->vvi_adjustedRetailPrice;
1033 ($includeAll || isset($intersect['vvi_adjustedTradePrice']))
1034 && $data['vvi_adjustedTradePrice'] = $this->vvi_adjustedTradePrice;
1036 ($includeAll || isset($intersect['vvi_estimatedRetailPrice']))
1037 && $data['vvi_estimatedRetailPrice'] = $this->vvi_estimatedRetailPrice;
1039 ($includeAll || isset($intersect['vvi_estimatedTradePrice']))
1040 && $data['vvi_estimatedTradePrice'] = $this->vvi_estimatedTradePrice;
1042 ($includeAll || isset($intersect['vvi_estimatedCostPrice']))
1043 && $data['vvi_estimatedCostPrice'] = $this->vvi_estimatedCostPrice;
1045 ($includeAll || isset($intersect['vvi_adjustedEstimatedRetailPrice_mileageAndCondition']))
1046 && $data['vvi_adjustedEstimatedRetailPrice_mileageAndCondition'] = $this->vvi_adjustedEstimatedRetailPrice_mileageAndCondition;
1048 ($includeAll || isset($intersect['vvi_adjustedEstimatedTradePrice_mileageAndCondition']))
1049 && $data['vvi_adjustedEstimatedTradePrice_mileageAndCondition'] = $this->vvi_adjustedEstimatedTradePrice_mileageAndCondition;
1051 ($includeAll || isset($intersect['vvi_adjustedEstimatedcostprice_mileageandcondition']))
1052 && $data['vvi_adjustedEstimatedcostprice_mileageandcondition'] = $this->vvi_adjustedEstimatedcostprice_mileageandcondition;
1054 ($includeAll || isset($intersect['vvi_adjustedEstimatedRetailPrice']))
1055 && $data['vvi_adjustedEstimatedRetailPrice'] = $this->vvi_adjustedEstimatedRetailPrice;
1057 ($includeAll || isset($intersect['vvi_adjustedEstimatedTradePrice']))
1058 && $data['vvi_adjustedEstimatedTradePrice'] = $this->vvi_adjustedEstimatedTradePrice;
1060 ($includeAll || isset($intersect['vvi_adjustedEstimatedCostPrice']))
1061 && $data['vvi_adjustedEstimatedCostPrice'] = $this->vvi_adjustedEstimatedCostPrice;
1063 ($includeAll || isset($intersect['vvi_resultCode']))
1064 && $data['vvi_resultCode'] = $this->vvi_resultCode;
1066 ($includeAll || isset($intersect['hpi_type']))
1067 && $data['hpi_type'] = $this->hpi_type;
1069 /* ------------------------------------ Error codes ------------------------------------ */
1071 ($includeAll || isset($intersect['error_code']))
1072 && $data['error_code'] = $this->error_code;
1074 ($includeAll || isset($intersect['jobState']))
1075 && $data['jobState'] = $this->jobState;
1077 ($includeAll || isset($intersect['created']))
1078 && $data['created'] = !is_null($this->created)
1079 ? $this->created->format($dateTimeFormat)
1081 ($includeAll || isset($intersect['updated']))
1082 && $data['updated'] = !is_null($this->updated)
1083 ? $this->updated->format($dateTimeFormat)
1085 ($includeAll || isset($intersect['reset']))
1086 && $data['reset'] = !is_null($this->reset)
1087 ? $this->reset->format($dateTimeFormat)
1093 * Internal utility to change accessories collection into array.
1094 * @param boolean $showIdentifiers
1097 public function accessoriesToArray($showIdentifiers = false)
1100 $iterator = $this->accessories->getIterator();
1101 if (2 == $showIdentifiers)
1103 foreach ($iterator as $accessory)
1105 $data[] = $accessory->accessory->id;
1110 foreach ($iterator as $accessory)
1112 $data[] = $showIdentifiers
1113 ? array('id' => $accessory->accessory->id)
1114 : $accessory->toArray();
1121 * Internal utility to change damages collection into array.
1122 * @param boolean $showIdentifiers
1125 public function damagesToArray($showIdentifiers = false)
1128 $iterator = $this->damages->getIterator();
1129 foreach ($iterator as $damage)
1131 $data[] = $damage->toArray(array(), array(), $showIdentifiers);
1137 * Populate from an array.
1138 * @param array $data
1140 public function fromArray($data = array())
1143 && $this->id = $data['id'];
1144 isset($data['company'])
1145 && $this->company = $data['company'];
1147 isset($data['createdBy'])
1148 && $this->createdBy = $data['createdBy'];
1150 isset($data['valuation'])
1151 && $this->valuation = $data['valuation'];
1153 isset($data['priceGuide'])
1154 && $this->priceGuide = $data['priceGuide'];
1156 isset($data['auction'])
1157 && $this->auction = $data['auction'];
1159 isset($data['stock'])
1160 && $this->stock = $data['stock'];
1162 isset($data['transactionNumber'])
1163 && $this->transactionNumber = $data['transactionNumber'];
1166 /* ------------------------------------ Finance Information ------------------------------------ */
1168 isset($data['f_financeProvider'])
1169 && $this->f_financeProvider = $data['f_financeProvider'];
1171 isset($data['f_financeBranch'])
1172 && $this->f_financeBranch = $data['f_financeBranch'];
1174 isset($data['f_agreementOrAccountNumber'])
1175 && $this->f_agreementOrAccountNumber = $data['f_agreementOrAccountNumber'];
1177 isset($data['f_agreementType'])
1178 && $this->f_agreementType = $data['f_agreementType'];
1180 isset($data['f_telephoneNumber'])
1181 && $this->f_telephoneNumber = $data['f_telephoneNumber'];
1183 isset($data['f_resultCode'])
1184 && $this->f_resultCode = $data['f_resultCode'];
1189 /* ------------------------------------ Finance History ------------------------------------ */
1192 isset($data['fh_data'])
1193 && $this->fh_data = is_array($data['fh_data'])
1194 ? serialize($data['fh_data'])
1195 : serialize(array());
1199 /* ------------------------------------ Accident History ------------------------------------ */
1201 isset($data['ah_data'])
1202 && $this->ah_data = is_array($data['ah_data'])
1203 ? serialize($data['ah_data'])
1204 : serialize(array());
1207 /* ------------------------------------ Stolen Information ------------------------------------ */
1209 isset($data['si_policeStation'])
1210 && $this->si_policeStation = $data['si_policeStation'];
1212 isset($data['si_caseNumber'])
1213 && $this->si_caseNumber = $data['si_caseNumber'];
1215 isset($data['si_dateStolen'])
1216 && $this->si_dateStolen = $data['si_dateStolen'];
1218 isset($data['si_vinMatch'])
1219 && $this->si_vinMatch = $data['si_vinMatch'];
1221 isset($data['si_engineMatch'])
1222 && $this->si_engineMatch = $data['si_engineMatch'];
1224 isset($data['si_registrationMatch'])
1225 && $this->si_registrationMatch = $data['si_registrationMatch'];
1227 isset($data['si_resultCode'])
1228 && $this->si_resultCode = $data['si_resultCode'];
1231 /* ------------------------------------ Alert Information ------------------------------------ */
1233 isset($data['ai_company'])
1234 && $this->ai_company = $data['ai_company'];
1236 isset($data['ai_referenceNumber'])
1237 && $this->ai_referenceNumber = $data['ai_referenceNumber'];
1239 isset($data['ai_alertReason'])
1240 && $this->ai_alertReason = $data['ai_alertReason'];
1242 isset($data['ai_telephoneNumber'])
1243 && $this->ai_telephoneNumber = $data['ai_telephoneNumber'];
1245 isset($data['ai_resultCode'])
1246 && $this->ai_resultCode = $data['ai_resultCode'];
1248 /* ------------------------------------ IVID History Information ------------------------------------ */
1250 isset($data['ivid_responseCode'])
1251 && $this->ivid_responseCode = $data['ivid_responseCode'];
1253 isset($data['ivid_responseDescription'])
1254 && $this->ivid_responseDescription = $data['ivid_responseDescription'];
1256 isset($data['ivid_referenceNumber'])
1257 && $this->ivid_referenceNumber = $data['ivid_referenceNumber'];
1259 isset($data['ivid_contactNumber'])
1260 && $this->ivid_contactNumber = $data['ivid_contactNumber'];
1262 isset($data['ivid_resultCode'])
1263 && $this->ivid_resultCode = $data['ivid_resultCode'];
1265 /* ------------------------------------ Microdot Information ------------------------------------ */
1267 isset($data['mi_company'])
1268 && $this->mi_company = $data['mi_company'];
1270 isset($data['mi_referenceNumber'])
1271 && $this->mi_referenceNumber = $data['mi_referenceNumber'];
1273 isset($data['mi_contactNumber'])
1274 && $this->mi_contactNumber = $data['mi_contactNumber'];
1276 isset($data['mi_dateApplied'])
1277 && $this->mi_dateApplied = $data['mi_dateApplied'];
1279 isset($data['mi_resultCode'])
1280 && $this->mi_resultCode = $data['mi_resultCode'];
1284 /* ------------------------------------ VESA Information ------------------------------------ */
1286 isset($data['vesa_CertificateNumber'])
1287 && $this->vesa_CertificateNumber = $data['vesa_CertificateNumber'];
1289 isset($data['vesa_dateFitted'])
1290 && $this->vesa_dateFitted = $data['vesa_dateFitted'];
1292 isset($data['vesa_brandName'])
1293 && $this->vesa_brandName = $data['vesa_brandName'];
1295 isset($data['vesa_brandModel'])
1296 && $this->vesa_brandModel = $data['vesa_brandModel'];
1298 isset($data['vesa_deviceDescriptionType'])
1299 && $this->vesa_deviceDescriptionType = $data['vesa_deviceDescriptionType'];
1301 isset($data['vesa_resultCode'])
1302 && $this->vesa_resultCode = $data['vesa_resultCode'];
1305 /* ------------------------------------ Registration History ------------------------------------ */
1307 isset($data['rh_data'])
1308 && $this->rh_data = is_array($data['rh_data'])
1309 ? serialize($data['rh_data'])
1310 : serialize(array());
1313 /* ------------------------------------ Enquiry History ------------------------------------ */
1315 isset($data['eh_data'])
1316 && $this->eh_data = is_array($data['eh_data'])
1317 ? serialize($data['eh_data'])
1318 : serialize(array());
1321 /* ------------------------------------ Mileage History ------------------------------------ */
1323 isset($data['mh_data'])
1324 && $this->mh_data = is_array($data['mh_data'])
1325 ? serialize($data['mh_data'])
1326 : serialize(array());
1329 /* ------------------------------------ VehicleOptionCodes ------------------------------------ */
1331 isset($data['vc_month'])
1332 && $this->vc_month = $data['vc_month'];
1334 isset($data['vc_year'])
1335 && $this->vc_year = $data['vc_year'];
1337 isset($data['vc_newOptionCode'])
1338 && $this->vc_newOptionCode = $data['vc_newOptionCode'];
1340 isset($data['vc_usedOptionCode'])
1341 && $this->vc_usedOptionCode = $data['vc_usedOptionCode'];
1343 isset($data['vc_maximumRange'])
1344 && $this->vc_maximumRange = $data['vc_maximumRange'];
1346 isset($data['vc_minimunRange'])
1347 && $this->vc_minimunRange = $data['vc_minimunRange'];
1349 isset($data['vc_newPrice'])
1350 && $this->vc_newPrice = $data['vc_newPrice'];
1352 isset($data['vc_retailPrice'])
1353 && $this->vc_retailPrice = $data['vc_retailPrice'];
1355 isset($data['vc_tradePrice'])
1356 && $this->vc_tradePrice = $data['vc_tradePrice'];
1358 isset($data['vc_resultCode'])
1359 && $this->vc_resultCode = $data['vc_resultCode'];
1362 /* ------------------------------------ VehicleConfirmationInfo ------------------------------------ */
1364 isset($data['vci_HPINumber'])
1365 && $this->vci_HPINumber = $data['vci_HPINumber'];
1367 isset($data['vci_matchColour'])
1368 && $this->vci_matchColour = $data['vci_matchColour'];
1370 isset($data['vci_matchEngineNumber'])
1371 && $this->vci_matchEngineNumber = $data['vci_matchEngineNumber'];
1373 isset($data['vci_matchManufacturer'])
1374 && $this->vci_matchManufacturer = $data['vci_matchManufacturer'];
1376 isset($data['vci_matchModel'])
1377 && $this->vci_matchModel = $data['vci_matchModel'];
1379 isset($data['vci_matchString'])
1380 && $this->vci_matchString = $data['vci_matchString'];
1382 isset($data['vci_matchVehicleRegistration'])
1383 && $this->vci_matchVehicleRegistration = $data['vci_matchVehicleRegistration'];
1385 isset($data['vci_matchVinorChassis'])
1386 && $this->vci_matchVinorChassis = $data['vci_matchVinorChassis'];
1388 isset($data['vci_matchYear'])
1389 && $this->vci_matchYear = $data['vci_matchYear'];
1392 /* ------------------------------------ VehicleValueInfo ------------------------------------ */
1394 isset($data['vvi_guideMonth'])
1395 && $this->vvi_guideMonth = $data['vvi_guideMonth'];
1397 isset($data['vvi_guideYear'])
1398 && $this->vvi_guideYear = $data['vvi_guideYear'];
1400 isset($data['vvi_newListPrice'])
1401 && $this->vvi_newListPrice = $data['vvi_newListPrice'];
1403 isset($data['vvi_retailPrice'])
1404 && $this->vvi_retailPrice = $data['vvi_retailPrice'];
1406 isset($data['vvi_tradePrice'])
1407 && $this->vvi_tradePrice = $data['vvi_tradePrice'];
1409 isset($data['vvi_costPrice'])
1410 && $this->vvi_costPrice = $data['vvi_costPrice'];
1412 isset($data['vvi_adjustedRetailPrice_mileageAndCondition'])
1413 && $this->vvi_adjustedRetailPrice_mileageAndCondition = $data['vvi_adjustedRetailPrice_mileageAndCondition'];
1415 isset($data['vvi_AdjustedTradePrice_MileageAndCondition'])
1416 && $this->vvi_AdjustedTradePrice_MileageAndCondition = $data['vvi_AdjustedTradePrice_MileageAndCondition'];
1418 isset($data['vvi_adjustedRetailPrice'])
1419 && $this->vvi_adjustedRetailPrice = $data['vvi_adjustedRetailPrice'];
1421 isset($data['vvi_adjustedTradePrice'])
1422 && $this->vvi_adjustedTradePrice = $data['vvi_adjustedTradePrice'];
1424 isset($data['vvi_estimatedRetailPrice'])
1425 && $this->vvi_estimatedRetailPrice = $data['vvi_estimatedRetailPrice'];
1427 isset($data['vvi_estimatedTradePrice'])
1428 && $this->vvi_estimatedTradePrice = $data['vvi_estimatedTradePrice'];
1430 isset($data['vvi_estimatedCostPrice'])
1431 && $this->vvi_estimatedCostPrice = $data['vvi_estimatedCostPrice'];
1433 isset($data['vvi_adjustedEstimatedRetailPrice_mileageAndCondition'])
1434 && $this->vvi_adjustedEstimatedRetailPrice_mileageAndCondition = $data['vvi_adjustedEstimatedRetailPrice_mileageAndCondition'];
1436 isset($data['vvi_adjustedEstimatedTradePrice_mileageAndCondition'])
1437 && $this->vvi_adjustedEstimatedTradePrice_mileageAndCondition = $data['vvi_adjustedEstimatedTradePrice_mileageAndCondition'];
1439 isset($data['vvi_adjustedEstimatedcostprice_mileageandcondition'])
1440 && $this->vvi_adjustedEstimatedcostprice_mileageandcondition = $data['vvi_adjustedEstimatedcostprice_mileageandcondition'];
1442 isset($data['vvi_adjustedEstimatedRetailPrice'])
1443 && $this->vvi_adjustedEstimatedRetailPrice = $data['vvi_adjustedEstimatedRetailPrice'];
1445 isset($data['vvi_adjustedEstimatedTradePrice'])
1446 && $this->vvi_adjustedEstimatedTradePrice = $data['vvi_adjustedEstimatedTradePrice'];
1448 isset($data['vvi_adjustedEstimatedCostPrice'])
1449 && $this->vvi_adjustedEstimatedCostPrice = $data['vvi_adjustedEstimatedCostPrice'];
1451 isset($data['vvi_resultCode'])
1452 && $this->vvi_resultCode = $data['vvi_resultCode'];
1454 isset($data['hpi_type'])
1455 && $this->hpi_type = $data['hpi_type'];
1457 /* ------------------------------------ Error codes ------------------------------------ */
1458 isset($data['error_code'])
1459 && $this->error_code = $data['error_code'];