diff options
Diffstat (limited to 'lib/private/Metadata/FileMetadata.php')
-rw-r--r-- | lib/private/Metadata/FileMetadata.php | 16 |
1 files changed, 12 insertions, 4 deletions
diff --git a/lib/private/Metadata/FileMetadata.php b/lib/private/Metadata/FileMetadata.php index 9ad0f9d35c6..a9808a86998 100644 --- a/lib/private/Metadata/FileMetadata.php +++ b/lib/private/Metadata/FileMetadata.php @@ -28,16 +28,24 @@ use OCP\DB\Types; /** * @method string getGroupName() * @method void setGroupName(string $groupName) - * @method array getMetadata() - * @method void setMetadata(array $metadata) + * @method string getValue() + * @method void setValue(string $value) * @see \OC\Core\Migrations\Version240000Date20220404230027 */ class FileMetadata extends Entity { protected ?string $groupName = null; - protected ?array $metadata = null; + protected ?string $value = null; public function __construct() { $this->addType('groupName', 'string'); - $this->addType('metadata', Types::JSON); + $this->addType('value', Types::STRING); + } + + public function getDecodedValue(): array { + return json_decode($this->getValue(), true) ?? []; + } + + public function setArrayAsValue(array $value): void { + $this->setValue(json_encode($value, JSON_THROW_ON_ERROR)); } } |