Methods

__construct()

__construct(integer  $id = null,string  $language = null,string  $sub = 'asset')

Asset constructor.

Parameters

integer $id

The asset id

string $language

The language to load in

string $sub

The type of the sub class

GetPath()

GetPath(): string

expose the storage path provide an interface to extract the current path of this object

Returns

string —

the object storage path

GetMainPath()

GetMainPath(): string

Get the main file Download the main file to local storage

Returns

string —

Absolute path to file or empty

RootPath()

RootPath(): string

expose root path provide an interface to the date storage path of this asset

Returns

string —

the absolute path to the storage folder

IsProcessed()

IsProcessed(): boolean

check is locked state provide the is locked and in process status

Returns

boolean —

is locked or not

SetDerivativeReplaced()

SetDerivativeReplaced(string  $derivative,string  $file): \FAA\Obj\Result

Set a derivative as replaced

This method updates the corresponding attributes, the marker list and saves the asset

Parameters

string $derivative

The attribute to set as replaced

string $file

File path with extension that represents the new derivative

Returns

\FAA\Obj\Result —

A system result object

ReplacedDerivatives()

ReplacedDerivatives(): array|mixed

Get replaced derivatives

Returns

array|mixed

ImprovedPublicUrl()

ImprovedPublicUrl(\FAA\Obj\Request  $request,string  $size,string  $prefix = null,boolean  $absolute = false): string

Parameters

\FAA\Obj\Request $request

A system http request object

string $size

The derivative type

string $prefix

A prefix, can be name of the parent content

boolean $absolute

When true, the current master domain will be attached

Returns

string —

A public url with improved naming convention

Locked()

Locked(boolean  $value = true)

set is locked state provide the is locked and in process status

Parameters

boolean $value

The desired state

AssignMaster()

AssignMaster(string  $file,boolean  $no_clear = false): \FAA\Obj\Result

add uploaded master file to asset moves the uploaded file to the asset folder and triggers the resize job

Parameters

string $file

Upload folder relative storage path of new asset

boolean $no_clear

When set, do not delete the source folder afterwards

Returns

\FAA\Obj\Result —

A system result object

Save()

Save(boolean  $force_new_id = false,boolean  $skip = false): \FAA\Obj\Result

Save asset instance

Save object entry in file system and git repository. Store the current payload inside the system storage and commit the changes to the local repository. Will trigger the renderer when not defined otherwise.

Parameters

boolean $force_new_id

Indicate force new id on demand (local id empty)

boolean $skip

When true do not check size changed

Returns

\FAA\Obj\Result —

A default system result object

GeneralSearchFields()

GeneralSearchFields(): array

Get the general search fields

Returns

array

SearchFields()

SearchFields(): array

Get search fields Create a array of search fields

Returns

array —

A list of search fields

CorrectRotation()

CorrectRotation(integer  $degree): \FAA\Obj\Result

Correct an images rotation by given degree.

Uses the asset service to render a new base image, update the local image and then forces a new rendering operation.

Parameters

integer $degree

The rotation direction

Returns

\FAA\Obj\Result —

A system result object

ForceAssetRendering()

ForceAssetRendering(boolean  $full = false): \FAA\Obj\Result

Render the asset entirely again

Removes the locally stored content hashes of the derivatives and creates a job to render the files again. This file does an asset save. When it is not explicitly requested the replaced assets wont be affected.

Parameters

boolean $full

When true also the replaced will be rendered new

Returns

\FAA\Obj\Result —

A system result object

Delete()

Delete(boolean  $skip = false): \FAA\Obj\Result

Delete a whole asset

As an asset is an extended form of the generic content the whole folder has to be deleted This method will also delete the folder and the asset in asset storage.

Parameters

boolean $skip

Skip hooks on demand

Returns

\FAA\Obj\Result —

A system result object

GetNextOfSequence()

GetNextOfSequence()

get a new id allocate a new id, force all new ids to be fetched from asset type storage

CreatePath()

CreatePath(): string

Get the path

As a sidefacct the path is generated on the fly.

Returns

string —

The local path