ProductCategory
extends ProductCategory
in package
Product category as a nested set (`lft`/`rgt`/`level` + `parentId`, one tree without scope, like Blog `Category`). Many-to-many to `Product` is mapped on the owning side {@see Product::$categories}; there is no back collection here.
Tags
Attributes
- #[Entity]
- #[Table]
- $name: 'cms_mod_eshop_product_categories'
- #[TableAlias]
- 'productCategory'
Table of Contents
Properties
- $active : bool
- $asset : TImage|null
- $iconClass : string|null
- $id : int|null
- $level : int
- $lft : int
- $parameterRels : Collection<int, CategoryParameterRel>
- Parameter targeting, not owned (no cascade or orphan removal): saved through `meta['parameterRels']` and the Api `afterSave`, not through the object graph (see {@see \App\UI\Api\Eshop\Models\Managers\Traits\ProductCategoryManager\CategoryParameterRelSyncTrait}).
- $parentId : int|null
- $preferred : bool
- $rgt : int
- $translations : Collection
- $useDefaultParameters : bool
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.
- getAsset() : TImage|null
- getIconClass() : string|null
- getId() : int|null
- getLevel() : int
- getLft() : int
- getParameterRels() : Collection<int, CategoryParameterRel>
- getParentId() : int|null
- getPreferred() : bool
- getRgt() : int
- getTranslation() : TTranslation|null
- getTranslations() : Collection<int, TTranslation>
- getUseDefaultParameters() : bool
- isActive() : bool
- isPersisted() : bool
- isPreferred() : bool
- isUseDefaultParameters() : bool
- removeTranslation() : $this
- setActive() : $this
- setAsset() : $this
- setIconClass() : $this
- setId() : $this
- setLevel() : $this
- setLft() : $this
- setParentId() : $this
- setPreferred() : $this
- setRgt() : $this
- setTranslations() : $this
- setUseDefaultParameters() : $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'
$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
= 1
Attributes
- #[Column]
- $name: 'level'
- $type: 'integer'
- $options: ['unsigned' => true]
$lft
protected
int
$lft
= 0
Attributes
- #[Column]
- $name: 'lft'
- $type: 'integer'
$parameterRels
Parameter targeting, not owned (no cascade or orphan removal): saved through `meta['parameterRels']` and the Api `afterSave`, not through the object graph (see {@see \App\UI\Api\Eshop\Models\Managers\Traits\ProductCategoryManager\CategoryParameterRelSyncTrait}).
protected
Collection<int, CategoryParameterRel>
$parameterRels
Attributes
- #[OneToMany]
- $targetEntity: \App\UI\Api\Eshop\Models\Entities\CategoryParameterRel::class
- $mappedBy: 'category'
- $fetch: 'LAZY'
$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'
$rgt
protected
int
$rgt
= 0
Attributes
- #[Column]
- $name: 'rgt'
- $type: 'integer'
$translations
protected
Collection
$translations
Attributes
- #[OneToMany]
- $targetEntity: \App\UI\Api\Eshop\Models\Entities\ProductCategoryText::class
- $mappedBy: 'parent'
- $cascade: ['persist', 'remove']
- $orphanRemoval: true
- $fetch: 'LAZY'
$useDefaultParameters
protected
bool
$useDefaultParameters
= true
Attributes
- #[Column]
- $name: 'use_default_parameters'
- $type: 'boolean'
Methods
__construct()
public
__construct([int|null $id = null ][, int|null $parentId = null ][, int $level = 1 ][, int $lft = 0 ][, int $rgt = 0 ][, mixed $asset = null ][, string|null $iconClass = null ][, bool $useDefaultParameters = true ][, bool $preferred = false ][, bool $active = true ][, Collection $translations = new ArrayCollection() ]) : mixed
Parameters
- $id : int|null = null
- $parentId : int|null = null
- $level : int = 1
- $lft : int = 0
- $rgt : int = 0
- $asset : mixed = null
- $iconClass : string|null = null
- $useDefaultParameters : bool = true
- $preferred : bool = false
- $active : bool = true
- $translations : Collection = new ArrayCollection()
addTranslation()
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
getActive()
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|nullgetIconClass()
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
intgetParameterRels()
public
getParameterRels() : Collection<int, CategoryParameterRel>
Return values
Collection<int, CategoryParameterRel>getParentId()
public
getParentId() : int|null
Return values
int|nullgetPreferred()
public
getPreferred() : bool
Return values
boolgetRgt()
public
getRgt() : int
Return values
intgetTranslation()
public
getTranslation(int $langId) : TTranslation|null
Parameters
- $langId : int
Return values
TTranslation|nullgetTranslations()
public
getTranslations() : Collection<int, TTranslation>
Return values
Collection<int, TTranslation>getUseDefaultParameters()
public
getUseDefaultParameters() : bool
Return values
boolisActive()
public
isActive() : bool
Return values
boolisPersisted()
public
isPersisted() : bool
Return values
boolisPreferred()
public
isPreferred() : bool
Return values
boolisUseDefaultParameters()
public
isUseDefaultParameters() : bool
Return values
boolremoveTranslation()
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
$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 $parentId) : $this
Parameters
- $parentId : int|null
Return values
$thissetPreferred()
public
setPreferred(bool $preferred) : $this
Parameters
- $preferred : bool
Return values
$thissetRgt()
public
setRgt(int $rgt) : $this
Parameters
- $rgt : int
Return values
$thissetTranslations()
public
setTranslations(Collection<int, TTranslation>|array<int, TTranslation> $translations) : $this
Parameters
- $translations : Collection<int, TTranslation>|array<int, TTranslation>
Return values
$thissetUseDefaultParameters()
public
setUseDefaultParameters(bool $useDefaultParameters) : $this
Parameters
- $useDefaultParameters : bool
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>