public function castToContent($obj) { $c = new Content(); if (isset($obj->contentID)) { $c->contentID = $obj->contentID; } if (isset($obj->text)) { $c->text = $obj->text; } if (isset($obj->cTypeID)) { $c->cTypeID = $obj->cTypeID; } if (isset($obj->ContentType)) { $ct = new ContentType(); $c->ContentType = $ct->castToContentType($obj->ContentType); } return $c; }