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