public function toObject() { $response = new stdClass(); $response->dataType1 = $this->dataType1; $response->dataType2 = $this->dataType2; $response->chart = $this->chart->toObject(); return $response; }