$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 * @param array $intersect * @return array */ public function toArray(array $expand = array(), array $intersect = array()) { $includeAll = empty($intersect); $data = array(); ($includeAll || isset($intersect['id'])) && $data['id'] = $this->id; ($includeAll || isset($intersect['model'])) && in_array('model', $expand) && $data['model'] = $this->model->toArray($expand, $intersect); ($includeAll || isset($intersect['category'])) && in_array('category', $expand) && $data['category'] = $this->category->toArray($expand, $intersect); ($includeAll || isset($intersect['name'])) && $data['name'] = $this->name; ($includeAll || isset($intersect['mmCode'])) && $data['mmCode'] = $this->mmCode; ($includeAll || isset($intersect['introYear'])) && in_array('introYear', $expand) && $data['introYear'] = $this->introYear->toArray($expand, $intersect); ($includeAll || isset($intersect['introMonth'])) && $data['introMonth'] = $this->introMonth; ($includeAll || isset($intersect['discYear'])) && in_array('discYear', $expand) && $data['discYear'] = !is_null($this->discYear) ? $this->discYear->toArray($expand, $intersect) : null; ($includeAll || isset($intersect['discMonth'])) && $data['discMonth'] = $this->discMonth; ($includeAll || isset($intersect['created'])) && $data['created'] = !is_null($this->created) ? $this->created->format(\Utility\Registry::getConfigParam('DateTimeFormat')) : null; ($includeAll || isset($intersect['updated'])) && $data['updated'] = !is_null($this->updated) ? $this->updated->format(\Utility\Registry::getConfigParam('DateTimeFormat')) : null; return $data; } /** * Convert the object to an array for synchronization. * @return array */ public function toSynchArray() { return array( 'id' => $this->id, 'model' => $this->model->id, 'category' => $this->category->id, 'name' => $this->name, 'mmCode' => $this->mmCode, 'introYear' => $this->introYear->id, 'diskYear' => !is_null($this->discYear) ? $this->discYear->id : 0 ); } /** * Populate from an array. * @param array $data */ public function fromArray($data = array()) { isset($data['id']) && $this->id = $data['id']; isset($data['model']) && $this->model = $data['model']; isset($data['category']) && $this->category = $data['category']; isset($data['name']) && $this->name = $data['name']; isset($data['mmCode']) && $this->mmCode = $data['mmCode']; isset($data['introYear']) && $this->introYear = $data['introYear']; isset($data['introMonth']) && $this->introMonth = $data['introMonth']; isset($data['discYear']) && $this->discYear = $data['discYear']; isset($data['discMonth']) && $this->discMonth = $data['discMonth']; isset($data['cylinders']) && $this->cylinders = $data['cylinders']; isset($data['cubicCapacity']) && $this->cubicCapacity = $data['cubicCapacity']; isset($data['kilowatts']) && $this->kilowatts = $data['kilowatts']; isset($data['bodyType']) && $this->bodyType = $data['bodyType']; isset($data['doors']) && $this->doors = $data['doors']; isset($data['createVersion']) && $this->createVersion = $data['createVersion']; isset($data['updateVersion']) && $this->updateVersion = $data['updateVersion']; } }