public function getDocumentById($id, $decode = true, $idMapper = null)
{
$response = $this->doRequest($this->buildEndpointUrl("document/id/" . $id), "GET");
$response = $response->data;
if ($response->type == "folder") {
$wsDocument = $this->fillWebserviceData("\\Pimcore\\Model\\Webservice\\Data\\Document\\Folder\\In", $response);
if (!$decode) {
return $wsDocument;
}
$doc = new Document\Folder();
$wsDocument->reverseMap($doc, $this->getDisableMappingExceptions(), $idMapper);
return $doc;
} else {
$type = ucfirst($response->type);
$class = "\\Pimcore\\Model\\Webservice\\Data\\Document\\" . $type . "\\In";
$wsDocument = $this->fillWebserviceData($class, $response);
if (!$decode) {
return $wsDocument;
}
if (!empty($type)) {
$type = "\\Pimcore\\Model\\Document\\" . ucfirst($wsDocument->type);
$document = new $type();
$wsDocument->reverseMap($document, $this->getDisableMappingExceptions(), $idMapper);
return $document;
}
}
}