ImageVariant
extends BaseEntity
in package
implements
IdentifiableInterface
uses
IdentifiableTrait
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
- #[MappedSuperclass]
- #[TableAlias]
- $alias: 'imageVariant'
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
- $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'
$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
$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
boolgetAllTraits()
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>getId()
public
getId() : int|null
Return values
int|nullgetInsertDatetime()
public
getInsertDatetime() : DateTime
Return values
DateTimegetMaxHeight()
public
getMaxHeight() : int
Return values
intgetMaxWidth()
public
getMaxWidth() : int
Return values
intgetName()
public
getName() : string
Return values
stringgetPosition()
public
getPosition() : int
Return values
intgetResizeMode()
public
getResizeMode() : string
Return values
stringgetResizeModeEnum()
public
getResizeModeEnum() : ImageResizeMode
Return values
ImageResizeModegetUpdateDatetime()
public
getUpdateDatetime() : DateTime|null
Return values
DateTime|nullgetWatermark()
public
getWatermark() : bool
Return values
boolisPersisted()
public
isPersisted() : bool
Return values
boolsetActivated()
public
setActivated(bool $activated) : $this
Parameters
- $activated : bool
Return values
$thissetId()
public
setId(int|null $id) : $this
Parameters
- $id : int|null
Return values
$thissetInsertDatetime()
public
setInsertDatetime(DateTime $insertDatetime) : $this
Parameters
- $insertDatetime : DateTime
Return values
$thissetMaxHeight()
public
setMaxHeight(int $maxHeight) : $this
Parameters
- $maxHeight : int
Return values
$thissetMaxWidth()
public
setMaxWidth(int $maxWidth) : $this
Parameters
- $maxWidth : int
Return values
$thissetName()
public
setName(string $name) : $this
Parameters
- $name : string
Return values
$thissetPosition()
public
setPosition(int $position) : $this
Parameters
- $position : int
Return values
$thissetResizeMode()
public
setResizeMode(string $resizeMode) : $this
Parameters
- $resizeMode : string
Return values
$thissetUpdateDatetime()
public
setUpdateDatetime(DateTime|null $updateDatetime) : $this
Parameters
- $updateDatetime : DateTime|null
Return values
$thissetWatermark()
public
setWatermark(bool $watermark) : $this
Parameters
- $watermark : bool
Return values
$thisgetTraitsRecursive()
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>