CoolCMS API

ImageVariant extends ImageVariant
in package

Image variant (`cms_system_asset_variants`): technical data of a downscaled image shared by all usages (size, mode, watermark).

The entity is named ImageVariant because AssetVariant is already a value object (AssetVariant); the table and the Api endpoint (api/system/asset-variant) carry the name "asset variant".

name is a technical key a-z0-9- and never changes after creation: for a variant without an alias it is the folder name on disk. The Api layer guards it (FieldAccess update: None, the field is not taken from the payload on edit at all); the form only displays it.

Attributes
#[Entity]
#[Table]
$name: 'cms_system_asset_variants'
#[TableAlias]
'imageVariant'

Table of Contents

Properties

$activated  : bool
$id  : int|null
$insertDatetime  : DateTime
$maxHeight  : int
$maxWidth  : int
$name  : string
$position  : int
$resizeMode  : string
$updateDatetime  : DateTime|null
$watermark  : bool

Methods

__construct()  : mixed
callInitMethods()  : void
Calls `init{TraitName}()` for every used trait that defines such a method.
getActivated()  : bool
getAllTraits()  : array<string, string>
Returns all traits the class uses, including those used by parent classes and nested traits.
getId()  : int|null
getInsertDatetime()  : DateTime
getMaxHeight()  : int
getMaxWidth()  : int
getName()  : string
getPosition()  : int
getResizeMode()  : string
getResizeModeEnum()  : ImageResizeMode
getUpdateDatetime()  : DateTime|null
getWatermark()  : bool
isPersisted()  : bool
setActivated()  : $this
setId()  : $this
setInsertDatetime()  : $this
setMaxHeight()  : $this
setMaxWidth()  : $this
setName()  : $this
setPosition()  : $this
setResizeMode()  : $this
setUpdateDatetime()  : $this
setWatermark()  : $this
getTraitsRecursive()  : array<string, string>
Walks the trait list recursively and collects nested traits too.

Properties

$activated

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

$id

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

$insertDatetime

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

$maxHeight

protected int $maxHeight = 0
Attributes
#[Column]
$name: 'max_height'
$type: 'smallint'
$options: ['unsigned' => true]

$maxWidth

protected int $maxWidth = 0
Attributes
#[Column]
$name: 'max_width'
$type: 'smallint'
$options: ['unsigned' => true]

$name

protected string $name = ''
Attributes
#[Column]
$name: 'name'
$type: 'string'
$length: 32
$unique: true
#[FieldAccess]
$read: Audience::All
$insert: Audience::All
$update: Audience::None

$position

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

$resizeMode

protected string $resizeMode = ImageResizeMode::Fit->value
Attributes
#[Column]
$name: 'resize_mode'
$type: 'string'
$length: 16

$updateDatetime

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

$watermark

protected bool $watermark = false
Attributes
#[Column]
$name: 'watermark'
$type: 'boolean'
$options: ['default' => false]

Methods

__construct()

public __construct([int|null $id = null ][, string $name = '' ][, int $maxWidth = 0 ][, int $maxHeight = 0 ][, string $resizeMode = ImageResizeMode::Fit->value ][, bool $watermark = false ][, int $position = 0 ][, bool $activated = true ][, DateTime $insertDatetime = new DateTime() ][, DateTime|null $updateDatetime = null ]) : mixed
Parameters
$id : int|null = null
$name : string = ''
$maxWidth : int = 0
$maxHeight : int = 0
$resizeMode : string = ImageResizeMode::Fit->value
$watermark : bool = false
$position : int = 0
$activated : bool = true
$insertDatetime : DateTime = new DateTime()
$updateDatetime : DateTime|null = null

callInitMethods()

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

public callInitMethods() : void

getActivated()

public getActivated() : bool
Return values
bool

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

getMaxHeight()

public getMaxHeight() : int
Return values
int

getMaxWidth()

public getMaxWidth() : int
Return values
int

getName()

public getName() : string
Return values
string

getPosition()

public getPosition() : int
Return values
int

getResizeMode()

public getResizeMode() : string
Return values
string

getUpdateDatetime()

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

getWatermark()

public getWatermark() : bool
Return values
bool

setActivated()

public setActivated(bool $activated) : $this
Parameters
$activated : bool
Return values
$this

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

setMaxHeight()

public setMaxHeight(int $maxHeight) : $this
Parameters
$maxHeight : int
Return values
$this

setMaxWidth()

public setMaxWidth(int $maxWidth) : $this
Parameters
$maxWidth : int
Return values
$this

setName()

public setName(string $name) : $this
Parameters
$name : string
Return values
$this

setPosition()

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

setResizeMode()

public setResizeMode(string $resizeMode) : $this
Parameters
$resizeMode : string
Return values
$this

setUpdateDatetime()

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

setWatermark()

public setWatermark(bool $watermark) : $this
Parameters
$watermark : bool
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