CoolCMS API

Unit extends Unit
in package

Admin variant of a unit of measure (`cms_system_units`), hydrated from the Api endpoint `api/system/unit`; maps translations (full name).

Tags
extends
Attributes
#[Entity]
#[Table]
$name: 'cms_system_units'
#[TableAlias]
'unit'

Table of Contents

Properties

$active  : bool
$code  : string
$id  : int|null
$sort  : int
$translations  : Collection

Methods

__construct()  : mixed
addTranslation()  : $this
callInitMethods()  : void
Calls `init{TraitName}()` for every used trait that defines such a method.
getActive()  : bool
getAllTraits()  : array<string, string>
Returns all traits the class uses, including those used by parent classes and nested traits.
getCode()  : string
getId()  : int|null
getSort()  : int
getTranslation()  : TTranslation|null
getTranslations()  : Collection<int, TTranslation>
isActive()  : bool
isPersisted()  : bool
removeTranslation()  : $this
setActive()  : TTranslation>
setCode()  : TTranslation>
setId()  : $this
setSort()  : TTranslation>
setTranslations()  : $this
translationCollectionInit()  : void
getTraitsRecursive()  : array<string, string>
Walks the trait list recursively and collects nested traits too.

Properties

$active

protected bool $active = true
Attributes
#[Column]
$name: 'active'
$type: 'boolean'

$code

protected string $code = ''
Attributes
#[Column]
$name: 'code'
$type: 'string'
$length: 20

$id

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

$sort

protected int $sort = 0
Attributes
#[Column]
$name: 'sort'
$type: 'integer'

$translations

protected Collection $translations
Attributes
#[CollectionOf]
\App\UI\Admin\System\Models\Entities\UnitText::class
$owned: true
#[OneToMany]
$targetEntity: \App\UI\Admin\System\Models\Entities\UnitText::class
$mappedBy: 'parent'
$cascade: ["persist", "remove"]
$orphanRemoval: true
$fetch: "LAZY"

Methods

__construct()

public __construct([int|null $id = null ][, string $code = '' ][, int $sort = 0 ][, bool $active = true ][, Collection $translations = new ArrayCollection() ]) : mixed
Parameters
$id : int|null = null
$code : string = ''
$sort : int = 0
$active : bool = true
$translations : Collection = new ArrayCollection()

addTranslation()

public addTranslation(TTranslation $translation) : $this
Parameters
$translation : TTranslation
Return values
$this

callInitMethods()

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

public callInitMethods() : void

getActive()

public getActive() : 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>

getCode()

public getCode() : string
Return values
string

getSort()

public getSort() : int
Return values
int

getTranslation()

public getTranslation(int $langId) : TTranslation|null
Parameters
$langId : int
Return values
TTranslation|null

getTranslations()

public getTranslations() : Collection<int, TTranslation>
Return values
Collection<int, TTranslation>

isActive()

public isActive() : bool
Return values
bool

removeTranslation()

public removeTranslation(TTranslation $translation) : $this
Parameters
$translation : TTranslation
Return values
$this

setActive()

public setActive(bool $active) : TTranslation>
Parameters
$active : bool
Return values
TTranslation>

setCode()

public setCode(string $code) : TTranslation>
Parameters
$code : string
Return values
TTranslation>

setId()

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

setSort()

public setSort(int $sort) : TTranslation>
Parameters
$sort : int
Return values
TTranslation>

setTranslations()

public setTranslations(Collection<int, TTranslation>|array<int, TTranslation> $translations) : $this
Parameters
$translations : Collection<int, TTranslation>|array<int, TTranslation>
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