$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 * @return array */ public function toArray(array $expand = array()) { return array( 'id' => $this->id, 'filename' => $this->filename, 'mimeType' => $this->mimeType, 'downloads' => $this->downloads, 'created' => !is_null($this->created) ? $this->created->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['filename']) && $this->filename = $data['filename']; isset($data['mimeType']) && $this->mimeType = $data['mimeType']; isset($data['downloads']) && $this->downloads = $data['downloads']; } }