id; } /** * 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 postUpdate() { } /** * 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 ) { $dateTimeFormat = \Utility\Registry::getConfigParam('DateTimeFormat'); $includeAll = empty($intersect); $data = array(); ($includeAll || isset($intersect['id'])) && $data['id'] = $this->id; ($includeAll || isset($intersect['group'])) && $data['group'] = (in_array('group', $expand) || $expandAll || $showIdentifiers) && !is_null($this->group) ? (!$showIdentifiers || in_array('group', $expand) ? $this->group->toArray( $expand, $intersect, $showIdentifiers, ($expandAll - 1) ) : $this->group->id) : null; ($includeAll || isset($intersect['email'])) && $data['email'] = $this->email; ($includeAll || isset($intersect['firstName'])) && $data['firstName'] = $this->firstName; ($includeAll || isset($intersect['familyName'])) && $data['familyName'] = $this->familyName; ($includeAll || isset($intersect['fullName'])) && $data['fullName'] = $this->firstName . ' ' . $this->familyName; ($includeAll || isset($intersect['mobile'])) && $data['mobile'] = $this->mobile; ($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; return $data; } /** * Populate from an array. * @param array $data */ public function fromArray($data = array()) { isset($data['id']) && $this->id = $data['id']; isset($data['group']) && $this->group = $data['group']; isset($data['email']) && $this->email = $data['email']; isset($data['firstName']) && $this->firstName = $data['firstName']; isset($data['familyName']) && $this->familyName = $data['familyName']; isset($data['mobile']) && $this->mobile = $data['mobile']; } }