StandaloneDigitalObjectWriteService
in package
implements
DigitalObjectWriteServiceInterface
uses
EntityWriteTrait
Standalone digital object write service using Laravel Query Builder only.
Clean implementation without Propel references or class_exists checks. Unlike the Propel version, create() is fully implemented:
- Save file to uploads/r/{objectId}/
- Insert object -> digital_object with SHA-256 checksum
- Detect MIME type
- For images: generate reference + thumbnail via ImageMagick
- Insert derivative digital_object rows
Table of Contents
Interfaces
- DigitalObjectWriteServiceInterface
- Contract for digital object write operations.
Methods
- create() : int
- Create a new digital object attached to an information object.
- createDerivative() : int
- Create a derivative record (reference image, thumbnail, track).
- delete() : bool
- Delete a digital object and its derivatives.
- saveProperty() : void
- Save or update a property on a digital object.
- updateFileMetadata() : void
- Update file metadata after processing (mime type, size, dimensions, etc.).
- updateMetadata() : void
- Update digital object metadata (media type, name, etc.).
Methods
create()
Create a new digital object attached to an information object.
public
create(int $objectId, string $filename, string $content[, int|null $usageId = null ]) : int
Handles file storage, asset creation, and usage-ID assignment.
Parameters
- $objectId : int
-
Parent information_object.id
- $filename : string
-
Original filename
- $content : string
-
Raw file content (binary)
- $usageId : int|null = null
-
Usage term ID (defaults to MASTER)
Return values
int —The new digital_object.id
createDerivative()
Create a derivative record (reference image, thumbnail, track).
public
createDerivative(int $parentId, array<string|int, mixed> $attributes) : int
Parameters
- $parentId : int
-
Parent digital_object.id (master)
- $attributes : array<string|int, mixed>
-
Derivative attributes (usage_id, name, path, etc.)
Return values
int —The new derivative digital_object.id
delete()
Delete a digital object and its derivatives.
public
delete(int $id) : bool
Parameters
- $id : int
-
digital_object.id
Return values
bool —True if deleted
saveProperty()
Save or update a property on a digital object.
public
saveProperty(int $objectId, string $name, string|null $value[, string $culture = 'en' ]) : void
Properties are stored in object → property → property_i18n.
Parameters
- $objectId : int
-
The object.id (digital object or parent)
- $name : string
-
Property name
- $value : string|null
-
Property value (null to delete)
- $culture : string = 'en'
-
Culture code
updateFileMetadata()
Update file metadata after processing (mime type, size, dimensions, etc.).
public
updateFileMetadata(int $id, array<string|int, mixed> $metadata) : void
Parameters
- $id : int
-
digital_object.id
- $metadata : array<string|int, mixed>
-
File metadata (byte_size, mime_type, etc.)
updateMetadata()
Update digital object metadata (media type, name, etc.).
public
updateMetadata(int $id, array<string|int, mixed> $attributes) : void
Parameters
- $id : int
-
digital_object.id
- $attributes : array<string|int, mixed>
-
Column => value pairs to update