$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"); } /** * Convert the object to an array. * @param array $expand * @param array $intersect * @return array */ public function toArray(array $expand = array('attachment'), array $intersect = array()) { $dateTimeFormat = \Utility\Registry::getConfigParam('DateTimeFormat'); $includeAll = empty($intersect); $data = array(); ($includeAll || isset($intersect['id'])) && $data['id'] = $this->id; ($includeAll || isset($intersect['profile'])) && $data['profile'] = in_array('profile', $expand) && !is_null($this->profile) ? $this->profile->toArray($expand, $intersect) : null; ($includeAll || isset($intersect['ipAddress'])) && $data['ipAddress'] = $this->ipAddress; ($includeAll || isset($intersect['created'])) && $data['created'] = !is_null($this->created) ? $this->created->format($dateTimeFormat) : null; return $data; } /** * Populate from an array. * @param array $data */ public function fromArray($data = array()) { isset($data['id']) && $this->id = $data['id']; isset($data['profile']) && $this->profile = $data['profile']; isset($data['ipAddress']) && $this->ipAddress = $data['ipAddress']; } }