/**
* @param $id
* @throws \Exception
*/
public function getDocumentSnippetById($id)
{
try {
$snippet = Document::getById($id);
if ($snippet instanceof Document\Snippet) {
// load all data (eg. href, snippet, ... which are lazy loaded)
Document\Service::loadAllDocumentFields($snippet);
$className = Webservice\Data\Mapper::findWebserviceClass($snippet, "out");
$apiSnippet = Webservice\Data\Mapper::map($snippet, $className, "out");
return $apiSnippet;
}
throw new \Exception("Document Snippet with given ID (" . $id . ") does not exist.");
} catch (\Exception $e) {
\Logger::error($e);
throw $e;
}
}