stock = new \Doctrine\Common\Collections\ArrayCollection(); } /** * Magic getter to expose protected properties. * @param string $property * @return mixed */ public function __get($property) { return $this->$property; } /** * Magic setter to save protected properties. * @param string $property * @param mixed $value */ public function __set($property, $value) { $this->$property = $value; } /** * @ORM\PrePersist */ public function setCreateTime() { $this->created = new \DateTime("now"); } /** * @ORM\PreUpdate */ public function setUpdateTime() { $this->updated = new \DateTime("now"); } public function fromArray($data) { isset($data['hash']) && $this->hash = $data['hash']; isset($data['source']) && $this->source = $data['source']; isset($data['type']) && $this->type = $data['type']; isset($data['file']) && $this->file = $data['file']; isset($data['dealerCode']) && $this->dealerCode = $data['dealerCode']; isset($data['company']) && $this->company = $data['company']; isset($data['dateSold']) && $this->dateSold = $data['dateSold']; isset($data['stockNumber']) && $this->stockNumber = $data['stockNumber']; isset($data['registrationNumber']) && $this->registrationNumber = $data['registrationNumber']; isset($data['vinNumber']) && $this->vinNumber = $data['vinNumber']; isset($data['engineNumber']) && $this->engineNumber = $data['engineNumber']; isset($data['make']) && $this->make = $data['make']; isset($data['soldTo']) && $this->soldTo = $data['soldTo']; isset($data['amount']) && $this->amount = $data['amount']; } public function toArray() { return array( 'id' => $this->id, 'hash' => $this->hash, 'source' => $this->source, 'type' => $this->type, 'file' => $this->file, 'dealerCode' => $this->dealerCode, 'company' => !is_null($this->company) ? $this->company->toArray() : null, 'dateSold' => !is_null($this->dateSold) ? $this->dateSold->format(\Utility\Registry::getConfigParam('DateFormat')) : null, 'stockNumber' => $this->stockNumber, 'registrationNumber' => $this->registrationNumber, 'vinNumber' => $this->vinNumber, 'engineNumber' => $this->engineNumber, 'make' => $this->make, 'soldTo' => $this->soldTo, 'amount' => $this->amount ); } }