class Asset extends AbstractElement (View source)

Traits

Properties

protected AbstractDao $dao from AbstractModel
protected int $__dataVersionTimestamp from AbstractElement
static array $types possible types of an asset
int $id Unique ID
int $parentId ID of the parent asset
Asset $parent
string $type Type
string $filename Name of the file
string $path Path of the file, without the filename, only the full path of the parent asset
string $mimetype Mime-Type of the file
int $creationDate Timestamp of creation
int $modificationDate Timestamp of modification
resource $stream
int $userOwner ID of the owner user
int $userModification ID of the user who make the latest changes
array $properties List of properties
array $versions List of versions
array $metadata
string $locked enum('self','propagate') nullable
array $customSettings List of some custom settings [key] => value Here there can be stored some data, eg. the video thumbnail files, .
bool $hasMetaData
Dependency $dependencies Dependencies of this asset
array $childs Contains the child elements
bool $hasChilds Indicator if there are childs
array $siblings Contains a list of sibling documents
bool $hasSiblings Indicator if document has siblings or not
array $scheduledTasks Contains all scheduled tasks
protected bool $_dataChanged Indicator if data has changed

Methods

Dao
getDao()

No description

setDao($dao)

No description

getResource() deprecated

No description

initDao(null $key = null, bool $forceDetection = false)

No description

static string|null
locateDaoClass(string $modelClass)

No description

$this
setValues(array $data = [])

No description

$this
setValue($key, $value)

No description

array
__sleep()

No description

mixed
__call($method, $args)

No description

__clone()

No description

array
getObjectVars()

returns object values without the dao

array
__debugInfo()

No description

void
beginTransaction()

No description

void
commit()

No description

void
rollBack()

No description

void
configure()

No description

array
getValidTableColumns(string $table, bool $cache)

No description

void
resetValidTableColumnsCache(string $table)

No description

updateModificationInfos()

No description

mixed
getProperty(string $name, bool $asContainer = false)

Get specific property data or the property object itself ($asContainer=true) by its name, if the property doesn't exists return null

bool
hasProperty($name)

No description

removeProperty($name)

No description

string
getCacheTag()

get the cache tag for the element

array
getCacheTags(array $tags = [])

Get the cache tags for the element, resolve all dependencies to tag the cache entries This is necessary to update the cache if there is a change in an depended object

array
resolveDependencies()

Resolves the dependencies of the element and returns an array of them - Used by update()

$this
isLocked()

Returns true if the element is locked

array
getUserPermissions()

No description

bool
isAllowed(string $type)

This is used for user-permissions, pass a permission type (eg. list, view, save) an you know if the current user is allowed to perform the requested action

unlockPropagate()

No description

validatePathLength()

No description

bool
hasNoChilds()

Inverted hasChilds()

string
__toString()

No description

int
__getDataVersionTimestamp()

No description

__setDataVersionTimestamp(int $_dataVersionTimestamp)

No description

bool
__isBasedOnLatestData()

No description

mixed
getChilds() deprecated

No description

mixed
setChilds() deprecated

No description

mixed
hasChilds() deprecated

No description

static array
getTypes()

No description

getByPath(string $path, bool $force = false)

Static helper to get an asset by the passed path

getById($id, bool $force = false)

Static helper to get an asset by the passed ID

static Asset
create(int $parentId, array $data = [], bool $save = true)

Helper to quickly create a new asset

static mixed
getList(array $config = [])

No description

static int
getTotalCount(array $config = [])

No description

static int|string
getTypeFromMimeMapping($mimeType, $filename)

returns the asset type of a filename and mimetype

string
getFileSystemPath()

Get full path to the asset on the filesystem

$this
save()

No description

correctPath()

No description

update(array $params = [])

No description

null|Version
saveVersion(bool $setModificationDate = true, bool $callPluginHook = true, string $versionNote = null)

No description

string
getFullPath()

Returns the full path of the document including the filename

string
getRealPath()

No description

string
getRealFullPath()

No description

array
getChildren()

No description

bool
hasChildren()

No description

array
getSiblings()

Get a list of the sibling assets

bool
hasSiblings()

Returns true if the asset has at least one sibling

string
getLocked()

Returns true if the element is locked

$this
setLocked(bool $locked)

No description

deletePhysicalFile()

Deletes file from filesystem

delete()

No description

clearDependentCache(array $additionalTags = [])

No description

getDependencies()

No description

int
getCreationDate()

No description

int
getId()

No description

string
getFilename()

No description

string
getKey()

Alias for getFilename()

int
getModificationDate()

No description

int
getParentId()

No description

string
getPath()

No description

string
getType()

No description

$this
setCreationDate(int $creationDate)

No description

$this
setId(int $id)

No description

$this
setFilename(string $filename)

No description

$this
setModificationDate(int $modificationDate)

No description

$this
setParentId(int $parentId)

No description

$this
setPath(string $path)

No description

$this
setType(string $type)

No description

mixed
getData()

No description

$this
setData(mixed $data)

No description

resource
getStream()

No description

$this
setStream($stream)

No description

closeStream()

No description

null|string
getChecksum(string $type = 'md5')

No description

bool
getDataChanged()

No description

$this
setDataChanged(bool $changed = true)

No description

array
getProperties()

No description

$this
setProperties(array $properties)

No description

$this
setProperty($name, $type, $data, bool $inherited = false, bool $inheritable = false)

No description

int
getUserOwner()

No description

int
getUserModification()

No description

$this
setUserOwner(int $userOwner)

No description

$this
setUserModification(int $userModification)

No description

array
getVersions()

No description

$this
setVersions(array $versions)

No description

string
getTemporaryFile()

returns the path to a temp file

$this
setCustomSetting(string $key, mixed $value)

No description

null
getCustomSetting($key)

No description

removeCustomSetting($key)

No description

array
getCustomSettings()

No description

$this
setCustomSettings(array $customSettings)

No description

string
getMimetype()

No description

$this
setMimetype(string $mimetype)

No description

setMetadata(array $metadata)

No description

bool
getHasMetaData()

No description

setHasMetaData(bool $hasMetaData)

No description

addMetadata(string $name, string $type, null $data = null, null $language = null)

No description

array
getMetadata(null $name = null, null $language = null)

No description

array
getScheduledTasks()

No description

$this
setScheduledTasks($scheduledTasks)

No description

saveScheduledTasks()

No description

string
getFileSize(string $format = 'noformatting', int $precision = 2)

Get filesize

getParent()

No description

$this
setParent(Asset $parent)

No description

string
getImageThumbnailSavePath()

No description

string
getVideoThumbnailSavePath()

No description

__wakeup()

No description

removeInheritedProperties()

No description

renewInheritedProperties()

No description

__destruct()

No description

Details

Dao getDao()

Return Value

Dao

AbstractModel setDao($dao)

Parameters

$dao

Return Value

AbstractModel

AbstractDao getResource() deprecated

deprecated

Return Value

AbstractDao

initDao(null $key = null, bool $forceDetection = false)

Parameters

null $key
bool $forceDetection

Exceptions

Exception

static string|null locateDaoClass(string $modelClass)

Parameters

string $modelClass

Return Value

string|null

$this setValues(array $data = [])

Parameters

array $data

Return Value

$this

$this setValue($key, $value)

Parameters

$key
$value

Return Value

$this

array __sleep()

Return Value

array

mixed __call($method, $args)

Parameters

$method
$args

Return Value

mixed

Exceptions

Exception

__clone()

array getObjectVars()

returns object values without the dao

Return Value

array

array __debugInfo()

Return Value

array

void beginTransaction()

Return Value

void

void commit()

Return Value

void

void rollBack()

Return Value

void

void configure()

Return Value

void

array getValidTableColumns(string $table, bool $cache)

Parameters

string $table
bool $cache

Return Value

array

void resetValidTableColumnsCache(string $table)

Parameters

string $table

Return Value

void

protected updateModificationInfos()

mixed getProperty(string $name, bool $asContainer = false)

Get specific property data or the property object itself ($asContainer=true) by its name, if the property doesn't exists return null

Parameters

string $name
bool $asContainer

Return Value

mixed

bool hasProperty($name)

Parameters

$name

Return Value

bool

removeProperty($name)

Parameters

$name

string getCacheTag()

get the cache tag for the element

Return Value

string

array getCacheTags(array $tags = [])

Get the cache tags for the element, resolve all dependencies to tag the cache entries This is necessary to update the cache if there is a change in an depended object

Parameters

array $tags

Return Value

array

array resolveDependencies()

Resolves the dependencies of the element and returns an array of them - Used by update()

Return Value

array

$this isLocked()

Returns true if the element is locked

Return Value

$this

array getUserPermissions()

Return Value

array

bool isAllowed(string $type)

This is used for user-permissions, pass a permission type (eg. list, view, save) an you know if the current user is allowed to perform the requested action

Parameters

string $type

Return Value

bool

unlockPropagate()

protected validatePathLength()

bool hasNoChilds()

Inverted hasChilds()

Return Value

bool

string __toString()

Return Value

string

int __getDataVersionTimestamp()

Return Value

int

__setDataVersionTimestamp(int $_dataVersionTimestamp)

Parameters

int $_dataVersionTimestamp

bool __isBasedOnLatestData()

Return Value

bool

mixed getChilds() deprecated

deprecated

Return Value

mixed

mixed setChilds() deprecated

deprecated

Return Value

mixed

mixed hasChilds() deprecated

deprecated

Return Value

mixed

static array getTypes()

Return Value

array

static Asset|Archive|Audio|Document|Folder|Image|Text|Unknown|Video getByPath(string $path, bool $force = false)

Static helper to get an asset by the passed path

Parameters

string $path
bool $force

Return Value

Asset|Archive|Audio|Document|Folder|Image|Text|Unknown|Video

static ElementInterface getById($id, bool $force = false)

Static helper to get an asset by the passed ID

Parameters

$id
bool $force

Return Value

ElementInterface $resource

static Asset create(int $parentId, array $data = [], bool $save = true)

Helper to quickly create a new asset

Parameters

int $parentId
array $data
bool $save

Return Value

Asset

static mixed getList(array $config = [])

Parameters

array $config

Return Value

mixed

Exceptions

Exception

static int getTotalCount(array $config = [])

Parameters

array $config

Return Value

int total count

static int|string getTypeFromMimeMapping($mimeType, $filename)

returns the asset type of a filename and mimetype

Parameters

$mimeType
$filename

Return Value

int|string

string getFileSystemPath()

Get full path to the asset on the filesystem

Return Value

string

$this save()

Return Value

$this

Exceptions

Exception

correctPath()

Exceptions

Exception

protected update(array $params = [])

Parameters

array $params additional parameters (e.g. "versionNote" for the version note)

Exceptions

Exception

null|Version saveVersion(bool $setModificationDate = true, bool $callPluginHook = true, string $versionNote = null)

Parameters

bool $setModificationDate
bool $callPluginHook
string $versionNote version note

Return Value

null|Version

Exceptions

Exception

string getFullPath()

Returns the full path of the document including the filename

Return Value

string

string getRealPath()

Return Value

string

string getRealFullPath()

Return Value

string

array getChildren()

Return Value

array

bool hasChildren()

Return Value

bool

array getSiblings()

Get a list of the sibling assets

Return Value

array

bool hasSiblings()

Returns true if the asset has at least one sibling

Return Value

bool

string getLocked()

Returns true if the element is locked

Return Value

string

$this setLocked(bool $locked)

Parameters

bool $locked

Return Value

$this

protected deletePhysicalFile()

Deletes file from filesystem

delete()

Exceptions

Exception

clearDependentCache(array $additionalTags = [])

Parameters

array $additionalTags

Dependency getDependencies()

Return Value

Dependency

int getCreationDate()

Return Value

int

int getId()

Return Value

int $id

string getFilename()

Return Value

string

string getKey()

Alias for getFilename()

Return Value

string

int getModificationDate()

Return Value

int

int getParentId()

Return Value

int

string getPath()

Return Value

string

string getType()

Return Value

string

$this setCreationDate(int $creationDate)

Parameters

int $creationDate

Return Value

$this

$this setId(int $id)

Parameters

int $id

Return Value

$this

$this setFilename(string $filename)

Parameters

string $filename

Return Value

$this

$this setModificationDate(int $modificationDate)

Parameters

int $modificationDate

Return Value

$this

$this setParentId(int $parentId)

Parameters

int $parentId

Return Value

$this

$this setPath(string $path)

Parameters

string $path

Return Value

$this

$this setType(string $type)

Parameters

string $type

Return Value

$this

mixed getData()

Return Value

mixed

$this setData(mixed $data)

Parameters

mixed $data

Return Value

$this

resource getStream()

Return Value

resource

$this setStream($stream)

Parameters

$stream

Return Value

$this

protected closeStream()

null|string getChecksum(string $type = 'md5')

Parameters

string $type

Return Value

null|string

Exceptions

Exception

bool getDataChanged()

Return Value

bool

$this setDataChanged(bool $changed = true)

Parameters

bool $changed

Return Value

$this

array getProperties()

Return Value

array

$this setProperties(array $properties)

Parameters

array $properties

Return Value

$this

$this setProperty($name, $type, $data, bool $inherited = false, bool $inheritable = false)

Parameters

$name
$type
$data
bool $inherited
bool $inheritable

Return Value

$this

int getUserOwner()

Return Value

int

int getUserModification()

Return Value

int

$this setUserOwner(int $userOwner)

Parameters

int $userOwner

Return Value

$this

$this setUserModification(int $userModification)

Parameters

int $userModification

Return Value

$this

array getVersions()

Return Value

array

$this setVersions(array $versions)

Parameters

array $versions

Return Value

$this

string getTemporaryFile()

returns the path to a temp file

Return Value

string

$this setCustomSetting(string $key, mixed $value)

Parameters

string $key
mixed $value

Return Value

$this

null getCustomSetting($key)

Parameters

$key

Return Value

null

removeCustomSetting($key)

Parameters

$key

array getCustomSettings()

Return Value

array

$this setCustomSettings(array $customSettings)

Parameters

array $customSettings

Return Value

$this

string getMimetype()

Return Value

string

$this setMimetype(string $mimetype)

Parameters

string $mimetype

Return Value

$this

setMetadata(array $metadata)

Parameters

array $metadata

bool getHasMetaData()

Return Value

bool

setHasMetaData(bool $hasMetaData)

Parameters

bool $hasMetaData

addMetadata(string $name, string $type, null $data = null, null $language = null)

Parameters

string $name
string $type can be "folder", "image", "input", "audio", "video", "document", "archive" or "unknown"
null $data
null $language

array getMetadata(null $name = null, null $language = null)

Parameters

null $name
null $language

Return Value

array

array getScheduledTasks()

Return Value

array

$this setScheduledTasks($scheduledTasks)

Parameters

$scheduledTasks

Return Value

$this

saveScheduledTasks()

string getFileSize(string $format = 'noformatting', int $precision = 2)

Get filesize

Parameters

string $format ('GB','MB','KB','B')
int $precision

Return Value

string

Asset getParent()

Return Value

Asset

$this setParent(Asset $parent)

Parameters

Asset $parent

Return Value

$this

string getImageThumbnailSavePath()

Return Value

string

string getVideoThumbnailSavePath()

Return Value

string

__wakeup()

removeInheritedProperties()

renewInheritedProperties()

__destruct()