type = $data["type"]; $this->location = new Location($data["location"]); $this->text = $data["text"]; $this->author = new Author($data["author"]); $this->date = $data["date"]; $this->id = $data["id"]; } public function toArray() { $array = [ "type" => $this->type, "location" => $this->location->toArray(), "text" => $this->text, "author" => $this->author->toArray(), "date" => $this->date, "id" => $this->id, "readby" => $this->readby, ]; return $array; } }