mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2026-01-02 15:31:24 +00:00
Update StoredObjectManager to handle versioned StoredObjects
The StoredObjectManager and related test cases have been updated to handle versioned StoredObjects, allowing the same methods to work with either a StoredObject or its versions. The changes also involve return information for the write method and enhancements to the write test procedure. This provides more functionality and flexibility for handling StoredObjects in different versions.
This commit is contained in:
@@ -12,36 +12,56 @@ declare(strict_types=1);
|
||||
namespace Chill\DocStoreBundle\Service;
|
||||
|
||||
use Chill\DocStoreBundle\Entity\StoredObject;
|
||||
use Chill\DocStoreBundle\Entity\StoredObjectVersion;
|
||||
use Chill\DocStoreBundle\Exception\StoredObjectManagerException;
|
||||
|
||||
interface StoredObjectManagerInterface
|
||||
{
|
||||
public function getLastModified(StoredObject $document): \DateTimeInterface;
|
||||
/**
|
||||
* @param StoredObject|StoredObjectVersion $document if a StoredObject is given, the last version will be used
|
||||
*/
|
||||
public function getLastModified(StoredObject|StoredObjectVersion $document): \DateTimeInterface;
|
||||
|
||||
public function getContentLength(StoredObject $document): int;
|
||||
/**
|
||||
* @param StoredObject|StoredObjectVersion $document if a StoredObject is given, the last version will be used
|
||||
*/
|
||||
public function getContentLength(StoredObject|StoredObjectVersion $document): int;
|
||||
|
||||
/**
|
||||
* Get the content of a StoredObject.
|
||||
*
|
||||
* @param StoredObject $document the document
|
||||
* @param StoredObject|StoredObjectVersion $document if a StoredObject is given, the last version will be used
|
||||
*
|
||||
* @return string the retrieved content in clear
|
||||
*
|
||||
* @throws StoredObjectManagerException if unable to read or decrypt the content
|
||||
*/
|
||||
public function read(StoredObject $document): string;
|
||||
public function read(StoredObject|StoredObjectVersion $document): string;
|
||||
|
||||
/**
|
||||
* Set the content of a StoredObject.
|
||||
*
|
||||
* @param StoredObject $document the document
|
||||
* @param $clearContent The content to store in clear
|
||||
* @param string $clearContent The content to store in clear
|
||||
* @param string|null $contentType The new content type. If set to null, the content-type is supposed not to change. If there is no content type, an empty string will be used.
|
||||
*
|
||||
* @return StoredObjectVersion the newly created @see{StoredObjectVersion} for the given @see{StoredObject}
|
||||
*
|
||||
* @throws StoredObjectManagerException
|
||||
*/
|
||||
public function write(StoredObject $document, string $clearContent): void;
|
||||
public function write(StoredObject $document, string $clearContent, ?string $contentType = null): StoredObjectVersion;
|
||||
|
||||
public function etag(StoredObject $document): string;
|
||||
/**
|
||||
* return or compute the etag for the document.
|
||||
*
|
||||
* @param StoredObject|StoredObjectVersion $document if a StoredObject is given, the last version will be used
|
||||
*
|
||||
* @return string the etag of this document
|
||||
*/
|
||||
public function etag(StoredObject|StoredObjectVersion $document): string;
|
||||
|
||||
/**
|
||||
* Clears the cache for the stored object.
|
||||
*/
|
||||
public function clearCache(): void;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user