CoolCMS API

ImageUsage extends BaseEntity
in package
implements IdentifiableInterface uses IdentifiableTrait

AbstractYes

Image usage (`cms_system_asset_usages`): module + purpose, e.g. `blog-articles`.

usageKey is the "asset type" the manager returns from getAssetVariantType().

Usages are created only by migration (the label is the translation admin.system.assetUsages.<usageKey>). The admin changes only keepOriginal and the assigned variants, which are saved atomically by the Api operation api/system/asset-usage/save-assignments (table cms_system_asset_usage_variants), not through a collection on the entity.

Attributes
#[MappedSuperclass]
#[TableAlias]
$alias: 'imageUsage'

Table of Contents

Interfaces

IdentifiableInterface
Entity with a simple integer primary key. Most entities have one (often via {@see \App\Core\Traits\Shared\Models\Entities\IdentifiableTrait}); texts and links with a composite key do not, which is why `getId()` is not on {@see \App\Core\Base\BaseEntity}. Code that needs the id of a generic entity asks for this interface (parameter type, template bound, `instanceof`).

Properties

$id  : int|null
$insertDatetime  : DateTime
$keepOriginal  : bool
$moduleId  : int
$position  : int
$updateDatetime  : DateTime|null
$usageKey  : string

Methods

__construct()  : mixed
callInitMethods()  : void
Calls `init{TraitName}()` for every used trait that defines such a method.
getAllTraits()  : array<string, string>
Returns all traits the class uses, including those used by parent classes and nested traits.
getId()  : int|null
getInsertDatetime()  : DateTime
getKeepOriginal()  : bool
getModuleId()  : int
getPosition()  : int
getUpdateDatetime()  : DateTime|null
getUsageKey()  : string
isPersisted()  : bool
setId()  : $this
setInsertDatetime()  : $this
setKeepOriginal()  : $this
setModuleId()  : $this
setPosition()  : $this
setUpdateDatetime()  : $this
setUsageKey()  : $this
getTraitsRecursive()  : array<string, string>
Walks the trait list recursively and collects nested traits too.

Properties

$id

protected int|null $id = null
Attributes
#[Column]
$name: 'usage_id'
$type: 'integer'
$options: ['unsigned' => true]
#[GeneratedValue]
#[Id]

$insertDatetime

protected DateTime $insertDatetime = new DateTime()
Attributes
#[Column]
$name: 'insert_datetime'
$type: 'datetime'
#[ExternalReadonly]

$keepOriginal

protected bool $keepOriginal = true
Attributes
#[Column]
$name: 'keep_original'
$type: 'boolean'
$options: ['default' => true]

$moduleId

protected int $moduleId = 0
Attributes
#[Column]
$name: 'module_id'
$type: 'integer'
$options: ['unsigned' => true]
#[ExternalReadonly]

$position

protected int $position = 0
Attributes
#[Column]
$name: 'position'
$type: 'integer'
$options: ['unsigned' => true, 'default' => 0]

$updateDatetime

protected DateTime|null $updateDatetime = null
Attributes
#[Column]
$name: 'update_datetime'
$type: 'datetime'
$nullable: true
#[ExternalReadonly]

$usageKey

protected string $usageKey = ''
Attributes
#[Column]
$name: 'usage_key'
$type: 'string'
$length: 64
$unique: true
#[ExternalReadonly]

Methods

__construct()

public __construct([int|null $id = null ][, string $usageKey = '' ][, int $moduleId = 0 ][, bool $keepOriginal = true ][, int $position = 0 ][, DateTime $insertDatetime = new DateTime() ][, DateTime|null $updateDatetime = null ]) : mixed
Parameters
$id : int|null = null
$usageKey : string = ''
$moduleId : int = 0
$keepOriginal : bool = true
$position : int = 0
$insertDatetime : DateTime = new DateTime()
$updateDatetime : DateTime|null = null

callInitMethods()

Calls `init{TraitName}()` for every used trait that defines such a method.

public callInitMethods() : void

getAllTraits()

Returns all traits the class uses, including those used by parent classes and nested traits.

public getAllTraits() : array<string, string>
Return values
array<string, string>

getInsertDatetime()

public getInsertDatetime() : DateTime
Return values
DateTime

getKeepOriginal()

public getKeepOriginal() : bool
Return values
bool

getModuleId()

public getModuleId() : int
Return values
int

getPosition()

public getPosition() : int
Return values
int

getUpdateDatetime()

public getUpdateDatetime() : DateTime|null
Return values
DateTime|null

getUsageKey()

public getUsageKey() : string
Return values
string

setId()

public setId(int|null $id) : $this
Parameters
$id : int|null
Return values
$this

setInsertDatetime()

public setInsertDatetime(DateTime $insertDatetime) : $this
Parameters
$insertDatetime : DateTime
Return values
$this

setKeepOriginal()

public setKeepOriginal(bool $keepOriginal) : $this
Parameters
$keepOriginal : bool
Return values
$this

setModuleId()

public setModuleId(int $moduleId) : $this
Parameters
$moduleId : int
Return values
$this

setPosition()

public setPosition(int $position) : $this
Parameters
$position : int
Return values
$this

setUpdateDatetime()

public setUpdateDatetime(DateTime|null $updateDatetime) : $this
Parameters
$updateDatetime : DateTime|null
Return values
$this

setUsageKey()

public setUsageKey(string $usageKey) : $this
Parameters
$usageKey : string
Return values
$this

getTraitsRecursive()

Walks the trait list recursively and collects nested traits too.

private static getTraitsRecursive(array<string, string> $traits) : array<string, string>
Parameters
$traits : array<string, string>
Return values
array<string, string>
On this page

Search results