Category
extends Category
in package
Discussion category stored as a nested-set tree (`lft`/`rgt`/`level` + `parentId`).
Tags
Attributes
- #[Entity]
- #[Table]
- $name: 'cms_mod_discussion_categories'
- #[TableAlias]
- 'category'
Table of Contents
Properties
- $active : bool
- $asset : TImage|null
- $assetPath : string|null
- $forFree : bool
- $iconClass : string|null
- $id : int|null
- $level : int
- $lft : int
- $parentId : int|null
- $preferred : bool
- $prices : Collection<int, CategoryPrice>
- $rgt : int
- $supplyKindId : int|null
- $translations : Collection
- $assetFile : FtpAsset|null
- Transient cache of the derived `FtpAsset` (not a database column).
Methods
- __construct() : mixed
- addPrice() : $this
- addTranslation() : $this
- callInitMethods() : void
- Calls `init{TraitName}()` for every used trait that defines such a method.
- clearPrices() : $this
- getActive() : bool
- getAllTraits() : array<string, string>
- Returns all traits the class uses, including those used by parent classes and nested traits.
- getAsset() : TImage|null
- getAssetFile() : FtpAsset|null
- Returns the `FtpAsset` derived from the path (lazy, works after Doctrine hydration too).
- getAssetPath() : string|null
- getForFree() : bool
- getIconClass() : string|null
- getId() : int|null
- getLevel() : int
- getLft() : int
- getParentId() : int|null
- getPreferred() : bool
- getPrices() : Collection<int, TPrice>
- getRgt() : int
- getSupplyKindId() : int|null
- getTranslation() : TTranslation|null
- getTranslations() : Collection<int, TTranslation>
- isActive() : bool
- isForFree() : bool
- isPersisted() : bool
- isPreferred() : bool
- priceCollectionInit() : void
- removePrice() : $this
- removeTranslation() : $this
- setActive() : $this
- setAsset() : $this
- setAssetPath() : $this
- setForFree() : $this
- setIconClass() : $this
- setId() : $this
- setLevel() : $this
- setLft() : $this
- setParentId() : $this
- setPreferred() : $this
- setPrices() : $this
- setRgt() : $this
- setSupplyKindId() : $this
- 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'
$asset
protected
TImage|null
$asset
= null
Attributes
- #[JoinColumn]
- $name: 'cms_system_images_image_id'
- $referencedColumnName: 'image_id'
- $nullable: true
- $onDelete: 'SET NULL'
- #[ManyToOne]
- $targetEntity: \App\UI\Api\System\Models\Entities\Asset::class
- $fetch: "LAZY"
$assetPath
protected
string|null
$assetPath
= null
Attributes
- #[Column]
- $name: 'asset_path'
- $type: 'string'
- $length: 255
- $nullable: true
$forFree
protected
bool
$forFree
= true
Attributes
- #[Column]
- $name: 'for_free'
- $type: 'boolean'
- $options: ['default' => true]
$iconClass
protected
string|null
$iconClass
= null
Attributes
- #[Column]
- $name: 'icon_class'
- $type: 'string'
- $length: 50
- $nullable: true
$id
protected
int|null
$id
= null
Attributes
- #[Column]
- $name: 'category_id'
- $type: 'integer'
- $options: ['unsigned' => true]
- #[GeneratedValue]
- #[Id]
$level
protected
int
$level
= 0
Attributes
- #[Column]
- $name: 'level'
- $type: 'integer'
- $options: ['unsigned' => true]
$lft
protected
int
$lft
= 0
Attributes
- #[Column]
- $name: 'lft'
- $type: 'integer'
- $options: ['unsigned' => true]
$parentId
protected
int|null
$parentId
= null
Attributes
- #[Column]
- $name: 'parent_id'
- $type: 'integer'
- $nullable: true
- $options: ['unsigned' => true]
$preferred
protected
bool
$preferred
= false
Attributes
- #[Column]
- $name: 'preferred'
- $type: 'boolean'
$prices
protected
Collection<int, CategoryPrice>
$prices
Attributes
- #[OneToMany]
- $targetEntity: \App\UI\Api\Discussion\Models\Entities\CategoryPrice::class
- $mappedBy: 'category'
- $cascade: ["persist", "remove"]
- $orphanRemoval: true
- $fetch: "LAZY"
$rgt
protected
int
$rgt
= 0
Attributes
- #[Column]
- $name: 'rgt'
- $type: 'integer'
- $options: ['unsigned' => true]
$supplyKindId
protected
int|null
$supplyKindId
= null
Attributes
- #[Column]
- $name: 'cms_system_supply_kinds_supply_kind_id'
- $type: 'integer'
- $nullable: true
- $options: ['unsigned' => true]
$translations
protected
Collection
$translations
Attributes
- #[JoinColumn]
- $name: 'cms_mod_discussion_categories_category_id'
- $referencedColumnName: 'category_id'
- #[OneToMany]
- $targetEntity: \App\UI\Api\Discussion\Models\Entities\CategoryText::class
- $mappedBy: 'parent'
- $cascade: ["persist", "remove"]
- $orphanRemoval: true
- $fetch: "LAZY"
$assetFile
Transient cache of the derived `FtpAsset` (not a database column).
private
FtpAsset|null
$assetFile
= null
Attributes
- #[Transient]
Methods
__construct()
public
__construct([int|null $id = null ][, mixed $asset = null ][, string|null $assetPath = null ][, int|null $parentId = null ][, int $lft = 0 ][, int $rgt = 0 ][, int $level = 0 ][, bool $forFree = true ][, int|null $supplyKindId = null ][, bool $preferred = false ][, bool $active = true ][, string|null $iconClass = null ][, Collection $translations = new ArrayCollection() ][, Collection $prices = new ArrayCollection() ]) : mixed
Parameters
- $id : int|null = null
- $asset : mixed = null
- $assetPath : string|null = null
- $parentId : int|null = null
- $lft : int = 0
- $rgt : int = 0
- $level : int = 0
- $forFree : bool = true
- $supplyKindId : int|null = null
- $preferred : bool = false
- $active : bool = true
- $iconClass : string|null = null
- $translations : Collection = new ArrayCollection()
- $prices : Collection = new ArrayCollection()
addPrice()
public
addPrice(TPrice $price) : $this
Parameters
- $price : TPrice
Return values
$thisaddTranslation()
public
addTranslation(TTranslation $translation) : $this
Parameters
- $translation : TTranslation
Return values
$thiscallInitMethods()
Calls `init{TraitName}()` for every used trait that defines such a method.
public
callInitMethods() : void
clearPrices()
public
clearPrices() : $this
Return values
$thisgetActive()
public
getActive() : 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>getAsset()
public
getAsset() : TImage|null
Return values
TImage|nullgetAssetFile()
Returns the `FtpAsset` derived from the path (lazy, works after Doctrine hydration too).
public
getAssetFile() : FtpAsset|null
Return values
FtpAsset|nullgetAssetPath()
public
getAssetPath() : string|null
Return values
string|nullgetForFree()
public
getForFree() : bool
Return values
boolgetIconClass()
public
getIconClass() : string|null
Return values
string|nullgetId()
public
getId() : int|null
Return values
int|nullgetLevel()
public
getLevel() : int
Return values
intgetLft()
public
getLft() : int
Return values
intgetParentId()
public
getParentId() : int|null
Return values
int|nullgetPreferred()
public
getPreferred() : bool
Return values
boolgetPrices()
public
getPrices() : Collection<int, TPrice>
Return values
Collection<int, TPrice>getRgt()
public
getRgt() : int
Return values
intgetSupplyKindId()
public
getSupplyKindId() : int|null
Return values
int|nullgetTranslation()
public
getTranslation(int $langId) : TTranslation|null
Parameters
- $langId : int
Return values
TTranslation|nullgetTranslations()
public
getTranslations() : Collection<int, TTranslation>
Return values
Collection<int, TTranslation>isActive()
public
isActive() : bool
Return values
boolisForFree()
public
isForFree() : bool
Return values
boolisPersisted()
public
isPersisted() : bool
Return values
boolisPreferred()
public
isPreferred() : bool
Return values
boolpriceCollectionInit()
public
priceCollectionInit() : void
removePrice()
public
removePrice(TPrice $price) : $this
Parameters
- $price : TPrice
Return values
$thisremoveTranslation()
public
removeTranslation(TTranslation $translation) : $this
Parameters
- $translation : TTranslation
Return values
$thissetActive()
public
setActive(bool $active) : $this
Parameters
- $active : bool
Return values
$thissetAsset()
public
setAsset(TImage|null $asset) : $this
Parameters
- $asset : TImage|null
Return values
$thissetAssetPath()
public
setAssetPath(string|null $assetPath) : $this
Parameters
- $assetPath : string|null
Return values
$thissetForFree()
public
setForFree(bool $forFree) : $this
Parameters
- $forFree : bool
Return values
$thissetIconClass()
public
setIconClass(string|null $iconClass) : $this
Parameters
- $iconClass : string|null
Return values
$thissetId()
public
setId(int|null $id) : $this
Parameters
- $id : int|null
Return values
$thissetLevel()
public
setLevel(int $level) : $this
Parameters
- $level : int
Return values
$thissetLft()
public
setLft(int $lft) : $this
Parameters
- $lft : int
Return values
$thissetParentId()
public
setParentId(int|null $id) : $this
Parameters
- $id : int|null
Return values
$thissetPreferred()
public
setPreferred(bool $preferred) : $this
Parameters
- $preferred : bool
Return values
$thissetPrices()
public
setPrices(Collection<int, TPrice>|array<int, TPrice> $prices) : $this
Parameters
- $prices : Collection<int, TPrice>|array<int, TPrice>
Return values
$thissetRgt()
public
setRgt(int $rgt) : $this
Parameters
- $rgt : int
Return values
$thissetSupplyKindId()
public
setSupplyKindId(int|null $supplyKindId) : $this
Parameters
- $supplyKindId : int|null
Return values
$thissetTranslations()
public
setTranslations(Collection<int, TTranslation>|array<int, TTranslation> $translations) : $this
Parameters
- $translations : Collection<int, TTranslation>|array<int, TTranslation>
Return values
$thistranslationCollectionInit()
public
translationCollectionInit() : void
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>