Category
extends Category
in package
Admin variant of a company category, hydrated from `api/comcat/category`.
The nested-set tree (parentId, lft, rgt) comes from the Shared parent. Maps the
translations (CategoryText), the main image (asset) and the prices (CategoryPrice, owned).
Parameter targeting (categoryParameterRels) is mapped as not owned (read-only). It is saved
outside the object graph: the admin form sends meta['parameterRels'] and the Api
CategoryManager::afterSave syncs it (delete and insert) and propagates it to the subtree,
see CategoryParameterRelSyncTrait. That is why the collection is in the Api defaultSkipFields.
Tags
Attributes
- #[Entity]
- #[Table]
- $name: 'cms_mod_comcat_categories'
- #[TableAlias]
- 'category'
Table of Contents
Properties
- $active : bool
- $advertCount : int
- $asset : TAsset|null
- $assetPath : string|null
- $categoryParameterRels : Collection<int, CategoryParameterRel>
- Parameter targeting, not owned (no cascade or orphan removal): saved through `meta['parameterRels']` and the Api `afterSave`, not as an object graph.
- $credits : int
- $expirationInterval : int
- $forFree : bool
- $iconClass : string|null
- $id : int|null
- $imageId : int|null
- $level : int
- $lft : int
- $onlyForAdmin : bool
- $pageId : int|null
- $parentId : int|null
- $preferred : bool
- $prices : Collection<int, CategoryPrice>
- $rgt : int
- $supplyKindId : int|null
- $translations : Collection<int, CategoryText>
- $useDefaultParameters : bool
- $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
- getAdvertCount() : int
- getAllTraits() : array<string, string>
- Returns all traits the class uses, including those used by parent classes and nested traits.
- getAsset() : Asset|null
- getAssetFile() : FtpAsset|null
- Returns the `FtpAsset` derived from the path (lazy, works after Doctrine hydration too).
- getAssetPath() : string|null
- getCategoryParameterRels() : Collection<int, CategoryParameterRel>
- Elements are {@see CategoryParameterRelInterface}; declared by the concrete layer entities (the shared class leaves the mapping to them).
- getCredits() : int
- getExpirationInterval() : int
- getForFree() : bool
- getIconClass() : string|null
- getId() : int|null
- getImageId() : int|null
- getLevel() : int
- getLft() : int
- getMinPriceForPaymentRegion() : TPrice|null
- getOnlyForAdmin() : bool
- getPageId() : int|null
- getParentId() : int|null
- getPreferred() : bool
- getPrices() : Collection<int, TPrice>
- getRgt() : int
- getSupplyKindId() : int|null
- getTranslation() : TTranslation|null
- getTranslations() : Collection<int, TTranslation>
- getUseDefaultParameters() : bool
- `true` = the advert form uses the global default parameters instead of the category rels.
- isActive() : bool
- isForFree() : bool
- isOnlyForAdmin() : bool
- isPersisted() : bool
- isPreferred() : bool
- isUseDefaultParameters() : bool
- priceCollectionInit() : void
- removePrice() : $this
- removeTranslation() : $this
- setActive() : $this
- setAdvertCount() : $this
- setAsset() : $this
- setAssetPath() : $this
- setCredits() : $this
- setExpirationInterval() : $this
- setForFree() : $this
- setIconClass() : $this
- setId() : $this
- setImageId() : $this
- setLevel() : $this
- setLft() : $this
- setOnlyForAdmin() : $this
- setPageId() : $this
- setParentId() : $this
- setPreferred() : $this
- setPrices() : $this
- setRgt() : $this
- setSupplyKindId() : TAsset>
- 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'
$advertCount
protected
int
$advertCount
= 0
Attributes
- #[Column]
- $name: 'advert_count'
- $type: 'integer'
- $options: ['unsigned' => true]
$asset
protected
TAsset|null
$asset
= null
Attributes
- #[EntityOf]
- \App\UI\Admin\System\Models\Entities\Asset::class
- #[JoinColumn]
- $name: 'cms_system_images_image_id'
- $referencedColumnName: 'image_id'
- $nullable: true
- $onDelete: 'SET NULL'
- #[ManyToOne]
- $targetEntity: \App\UI\Admin\System\Models\Entities\Asset::class
- $fetch: "LAZY"
$assetPath
protected
string|null
$assetPath
= null
Attributes
- #[Column]
- $name: 'asset_path'
- $type: 'string'
- $length: 255
- $nullable: true
$categoryParameterRels
Parameter targeting, not owned (no cascade or orphan removal): saved through `meta['parameterRels']` and the Api `afterSave`, not as an object graph.
protected
Collection<int, CategoryParameterRel>
$categoryParameterRels
Attributes
- #[CollectionOf]
- \App\UI\Admin\Comcat\Models\Entities\CategoryParameterRel::class
- #[OneToMany]
- $targetEntity: \App\UI\Admin\Comcat\Models\Entities\CategoryParameterRel::class
- $mappedBy: 'category'
- $fetch: "LAZY"
$credits
protected
int
$credits
= 0
Attributes
- #[Column]
- $name: 'credits'
- $type: 'integer'
- $options: ['unsigned' => true]
$expirationInterval
protected
int
$expirationInterval
= 30
Attributes
- #[Column]
- $name: 'expiration_interval'
- $type: 'integer'
- $options: ['unsigned' => true]
$forFree
protected
bool
$forFree
= true
Attributes
- #[Column]
- $name: 'for_free'
- $type: 'boolean'
$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]
$imageId
protected
int|null
$imageId
= null
Attributes
- #[Column]
- $name: 'cms_system_images_image_id'
- $type: 'integer'
- $nullable: true
- $options: ['unsigned' => true]
$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'
- $options: ['unsigned' => true]
$onlyForAdmin
protected
bool
$onlyForAdmin
= false
Attributes
- #[Column]
- $name: 'only_for_admin'
- $type: 'boolean'
$pageId
protected
int|null
$pageId
= null
Attributes
- #[Column]
- $name: 'cms_system_pages_page_id'
- $type: 'integer'
- $nullable: true
- $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
- #[CollectionOf]
- \App\UI\Admin\Comcat\Models\Entities\CategoryPrice::class
- $owned: true
- #[OneToMany]
- $targetEntity: \App\UI\Admin\Comcat\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<int, CategoryText>
$translations
Attributes
- #[CollectionOf]
- \App\UI\Admin\Comcat\Models\Entities\CategoryText::class
- $owned: true
- #[OneToMany]
- $targetEntity: \App\UI\Admin\Comcat\Models\Entities\CategoryText::class
- $mappedBy: 'parent'
- $cascade: ["persist", "remove"]
- $orphanRemoval: true
- $fetch: "LAZY"
$useDefaultParameters
protected
bool
$useDefaultParameters
= true
Attributes
- #[Column]
- $name: 'use_default_parameters'
- $type: 'boolean'
$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 ][, int|null $parentId = null ][, int $level = 1 ][, int $lft = 0 ][, int $rgt = 0 ][, int|null $imageId = null ][, string|null $assetPath = null ][, string|null $iconClass = null ][, int $credits = 0 ][, bool $forFree = true ][, int $advertCount = 0 ][, bool $active = true ][, bool $useDefaultParameters = true ][, bool $onlyForAdmin = false ][, bool $preferred = false ][, int|null $pageId = null ][, int $expirationInterval = 30 ][, mixed $asset = null ][, Collection $translations = new ArrayCollection() ][, Collection $prices = new ArrayCollection() ][, int|null $supplyKindId = null ]) : mixed
Parameters
- $id : int|null = null
- $parentId : int|null = null
- $level : int = 1
- $lft : int = 0
- $rgt : int = 0
- $imageId : int|null = null
- $assetPath : string|null = null
- $iconClass : string|null = null
- $credits : int = 0
- $forFree : bool = true
- $advertCount : int = 0
- $active : bool = true
- $useDefaultParameters : bool = true
- $onlyForAdmin : bool = false
- $preferred : bool = false
- $pageId : int|null = null
- $expirationInterval : int = 30
- $asset : mixed = null
- $translations : Collection = new ArrayCollection()
- $prices : Collection = new ArrayCollection()
- $supplyKindId : int|null = null
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
boolgetAdvertCount()
public
getAdvertCount() : int
Return values
intgetAllTraits()
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() : Asset|null
Return values
Asset|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|nullgetCategoryParameterRels()
Elements are {@see CategoryParameterRelInterface}; declared by the concrete layer entities (the shared class leaves the mapping to them).
public
getCategoryParameterRels() : Collection<int, CategoryParameterRel>
Return values
Collection<int, CategoryParameterRel>getCredits()
public
getCredits() : int
Return values
intgetExpirationInterval()
public
getExpirationInterval() : int
Return values
intgetForFree()
public
getForFree() : bool
Return values
boolgetIconClass()
public
getIconClass() : string|null
Return values
string|nullgetId()
public
getId() : int|null
Return values
int|nullgetImageId()
public
getImageId() : int|null
Return values
int|nullgetLevel()
public
getLevel() : int
Return values
intgetLft()
public
getLft() : int
Return values
intgetMinPriceForPaymentRegion()
public
getMinPriceForPaymentRegion(int $paymentRegionId[, int|null $currencyId = null ]) : TPrice|null
Parameters
- $paymentRegionId : int
- $currencyId : int|null = null
Return values
TPrice|nullgetOnlyForAdmin()
public
getOnlyForAdmin() : bool
Return values
boolgetPageId()
public
getPageId() : int|null
Return values
int|nullgetParentId()
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>getUseDefaultParameters()
`true` = the advert form uses the global default parameters instead of the category rels.
public
getUseDefaultParameters() : bool
Return values
boolisActive()
public
isActive() : bool
Return values
boolisForFree()
public
isForFree() : bool
Return values
boolisOnlyForAdmin()
public
isOnlyForAdmin() : bool
Return values
boolisPersisted()
public
isPersisted() : bool
Return values
boolisPreferred()
public
isPreferred() : bool
Return values
boolisUseDefaultParameters()
public
isUseDefaultParameters() : 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
$thissetAdvertCount()
public
setAdvertCount(int $advertCount) : $this
Parameters
- $advertCount : int
Return values
$thissetAsset()
public
setAsset(TAsset|null $asset) : $this
Parameters
- $asset : TAsset|null
Return values
$thissetAssetPath()
public
setAssetPath(string|null $assetPath) : $this
Parameters
- $assetPath : string|null
Return values
$thissetCredits()
public
setCredits(int $credits) : $this
Parameters
- $credits : int
Return values
$thissetExpirationInterval()
public
setExpirationInterval(int $expirationInterval) : $this
Parameters
- $expirationInterval : int
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
$thissetImageId()
public
setImageId(int|null $imageId) : $this
Parameters
- $imageId : 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
$thissetOnlyForAdmin()
public
setOnlyForAdmin(bool $onlyForAdmin) : $this
Parameters
- $onlyForAdmin : bool
Return values
$thissetPageId()
public
setPageId(int|null $pageId) : $this
Parameters
- $pageId : int|null
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
$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) : TAsset>
Parameters
- $supplyKindId : int|null
Return values
TAsset>setTranslations()
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>