/** * update document * * @param DocumentEntity $doc document entity * @return DocumentEntity */ public function put(DocumentEntity $doc) { $doc->setPureContent(); if ($doc->getAuthor() != null && $doc->getAuthor() instanceof Guest === false) { $doc->userId = $doc->getAuthor()->getId(); $doc->writer = $doc->getAuthor()->getDisplayName(); } $doc->updatedAt = date('Y-m-d H:i:s'); if ($doc->userId === null) { throw new Exceptions\RequiredValueException(); } if ($doc->instanceId === null) { throw new Exceptions\RequiredValueException(); } $doc = $this->rawPut($doc); $this->removeCache($doc); return $doc; }