$property; } // /** // * Magic setter to save protected properties. // * // * @param string $property // * @param mixed $value // */ // public function __set($property, $value) // { // if ('password' == $property) // { // $this->customerHash = md5($value); // return; // } // $this->$property = $value; // } /** * @ORM\PrePersist */ public function setCreateTime() { $this->created = new \DateTime("now"); } /** * @ORM\PreUpdate */ public function setUpdateTime() { $this->updated = new \DateTime("now"); } /** * Convert the object to an array. * @param array $expand * @param array $intersect * @param boolean $showIdentifiers * @param integer $expandAll * @return array */ public function toArray( array $expand = array(), array $intersect = array(), $showIdentifiers = false, $expandAll = 0 ) { $intersect = array_flip($intersect); $dateTimeFormat = \Utility\Registry::getConfigParam('DateTimeFormat'); $includeAll = empty($intersect); $data = array(); ($includeAll || isset($intersect['id'])) && $data['id'] = $this->id; ($includeAll || isset($intersect['customerHash'])) && $data['customerHash'] = $this->customerHash; ($includeAll || isset($intersect['stock'])) && $data['stock'] = $this->stock; ($includeAll || isset($intersect['valuation'])) && $data['valuation'] = $this->valuation; ($includeAll || isset($intersect['created'])) && $data['created'] = !is_null($this->created) ? $this->created->format($dateTimeFormat) : null; ($includeAll || isset($intersect['updated'])) && $data['updated'] = !is_null($this->updated) ? $this->updated->format($dateTimeFormat) : null; ($includeAll || isset($intersect['archived'])) && $data['archived'] = $this->archived; return $data; } /** * Populate from an array. * @param array $data */ public function fromArray($data = array()) { isset($data['id']) && $this->id = $data['id']; isset($data['customerHash']) && $this->customerHash = $data['customerHash']; isset($data['stock']) && $this->stock = $data['stock']; isset($data['valuation']) && $this->valuation = $data['valuation']; } }