Product
extends Product
in package
Abstract product card: the common base of 1..n sellable `ProductSet`s (via `product_sets.cms_mod_eshop_products_product_id`, nullable for bundle sets without a single owner). Categories stay here as many-to-many.
Tags
Attributes
- #[Entity]
- #[Table]
- $name: 'cms_mod_eshop_products'
- #[TableAlias]
- 'product'
Table of Contents
Properties
- $activated : bool
- $asset : TImage|null
- $categories : Collection<int, ProductCategory>
- $deleted : bool
- $id : int|null
- $insertDate : DateTime
- $producer : TProducer|null
- $productType : TProductType|null
- $translations : Collection
- $variants : Collection
Methods
- __construct() : mixed
- addCategory() : $this
- addTranslation() : $this
- addVariant() : $this
- callInitMethods() : void
- Calls `init{TraitName}()` for every used trait that defines such a method.
- categoryCollectionInit() : void
- clearCategories() : $this
- clearVariants() : $this
- getActivated() : bool
- getAllTraits() : array<string, string>
- Returns all traits the class uses, including those used by parent classes and nested traits.
- getAsset() : TImage|null
- getCategories() : Collection<int, TCategory>
- getCategoryIds() : array<string|int, int>
- getDeleted() : bool
- getFirstCategoryId() : int|null
- getId() : int|null
- getInsertDate() : DateTime
- getProducer() : TProducer|null
- getProductType() : TProductType|null
- getTranslation() : TTranslation|null
- getTranslations() : Collection<int, TTranslation>
- getVariants() : Collection<int, TVariant>
- isActivated() : bool
- isDeleted() : bool
- isPersisted() : bool
- removeCategory() : $this
- removeTranslation() : $this
- removeVariant() : $this
- setActivated() : $this
- setAsset() : $this
- setCategories() : $this
- setDeleted() : $this
- setId() : $this
- setInsertDate() : $this
- setProducer() : $this
- setProductType() : $this
- setTranslations() : $this
- setVariants() : $this
- translationCollectionInit() : void
- variantCollectionInit() : void
- 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'
$asset
protected
TImage|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'
$categories
protected
Collection<int, ProductCategory>
$categories
Attributes
- #[CollectionOf]
- \App\UI\Admin\Eshop\Models\Entities\ProductCategory::class
- #[JoinTable]
- $name: 'cms_mod_eshop_product_category_relations'
- $joinColumns: [new \Doctrine\ORM\Mapping\JoinColumn(name: 'cms_mod_eshop_products_product_id', referencedColumnName: 'product_id', onDelete: 'CASCADE')]
- $inverseJoinColumns: [new \Doctrine\ORM\Mapping\JoinColumn(name: 'cms_mod_eshop_product_categories_category_id', referencedColumnName: 'category_id', onDelete: 'CASCADE')]
- #[ManyToMany]
- $targetEntity: \App\UI\Admin\Eshop\Models\Entities\ProductCategory::class
- $fetch: 'LAZY'
$deleted
protected
bool
$deleted
= false
Attributes
- #[Column]
- $name: 'deleted'
- $type: 'boolean'
$id
protected
int|null
$id
= null
Attributes
- #[Column]
- $name: 'product_id'
- $type: 'integer'
- $options: ['unsigned' => true]
- #[GeneratedValue]
- #[Id]
$insertDate
protected
DateTime
$insertDate
= new DateTime()
Attributes
- #[Column]
- $name: 'insert_date'
- $type: 'date'
$producer
protected
TProducer|null
$producer
= null
Attributes
- #[EntityOf]
- \App\UI\Admin\Eshop\Models\Entities\Producer::class
- #[JoinColumn]
- $name: 'cms_mod_eshop_producers_producer_id'
- $referencedColumnName: 'producer_id'
- $nullable: true
- $onDelete: 'SET NULL'
- #[ManyToOne]
- $targetEntity: \App\UI\Admin\Eshop\Models\Entities\Producer::class
- $fetch: 'LAZY'
$productType
protected
TProductType|null
$productType
= null
Attributes
- #[EntityOf]
- \App\UI\Admin\Eshop\Models\Entities\ProductType::class
- #[JoinColumn]
- $name: 'cms_mod_eshop_product_types_product_type_id'
- $referencedColumnName: 'product_type_id'
- $nullable: true
- $onDelete: 'SET NULL'
- #[ManyToOne]
- $targetEntity: \App\UI\Admin\Eshop\Models\Entities\ProductType::class
- $fetch: 'LAZY'
$translations
protected
Collection
$translations
Attributes
- #[CollectionOf]
- \App\UI\Admin\Eshop\Models\Entities\ProductText::class
- $owned: true
- #[OneToMany]
- $targetEntity: \App\UI\Admin\Eshop\Models\Entities\ProductText::class
- $mappedBy: 'parent'
- $cascade: ['persist', 'remove']
- $orphanRemoval: true
- $fetch: 'LAZY'
$variants
protected
Collection
$variants
Attributes
- #[CollectionOf]
- \App\UI\Admin\Eshop\Models\Entities\ProductVariant::class
- $owned: true
- #[OneToMany]
- $targetEntity: \App\UI\Admin\Eshop\Models\Entities\ProductVariant::class
- $mappedBy: 'product'
- $cascade: ['persist', 'remove']
- $orphanRemoval: true
- $fetch: 'LAZY'
Methods
__construct()
public
__construct([int|null $id = null ][, bool $activated = true ][, bool $deleted = false ][, mixed $producer = null ][, DateTime $insertDate = new DateTime() ][, mixed $asset = null ][, mixed $productType = null ][, Collection $translations = new ArrayCollection() ][, Collection $categories = new ArrayCollection() ][, Collection $variants = new ArrayCollection() ]) : mixed
Parameters
- $id : int|null = null
- $activated : bool = true
- $deleted : bool = false
- $producer : mixed = null
- $insertDate : DateTime = new DateTime()
- $asset : mixed = null
- $productType : mixed = null
- $translations : Collection = new ArrayCollection()
- $categories : Collection = new ArrayCollection()
- $variants : Collection = new ArrayCollection()
addCategory()
public
addCategory(TCategory $category) : $this
Parameters
- $category : TCategory
Return values
$thisaddTranslation()
public
addTranslation(TTranslation $translation) : $this
Parameters
- $translation : TTranslation
Return values
$thisaddVariant()
public
addVariant(TVariant $variant) : $this
Parameters
- $variant : TVariant
Return values
$thiscallInitMethods()
Calls `init{TraitName}()` for every used trait that defines such a method.
public
callInitMethods() : void
categoryCollectionInit()
public
categoryCollectionInit() : void
clearCategories()
public
clearCategories() : $this
Return values
$thisclearVariants()
public
clearVariants() : $this
Return values
$thisgetActivated()
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>getAsset()
public
getAsset() : TImage|null
Return values
TImage|nullgetCategories()
public
getCategories() : Collection<int, TCategory>
Return values
Collection<int, TCategory>getCategoryIds()
public
getCategoryIds() : array<string|int, int>
Return values
array<string|int, int>getDeleted()
public
getDeleted() : bool
Return values
boolgetFirstCategoryId()
public
getFirstCategoryId() : int|null
Return values
int|nullgetId()
public
getId() : int|null
Return values
int|nullgetInsertDate()
public
getInsertDate() : DateTime
Return values
DateTimegetProducer()
public
getProducer() : TProducer|null
Return values
TProducer|nullgetProductType()
public
getProductType() : TProductType|null
Return values
TProductType|nullgetTranslation()
public
getTranslation(int $langId) : TTranslation|null
Parameters
- $langId : int
Return values
TTranslation|nullgetTranslations()
public
getTranslations() : Collection<int, TTranslation>
Return values
Collection<int, TTranslation>getVariants()
public
getVariants() : Collection<int, TVariant>
Return values
Collection<int, TVariant>isActivated()
public
isActivated() : bool
Return values
boolisDeleted()
public
isDeleted() : bool
Return values
boolisPersisted()
public
isPersisted() : bool
Return values
boolremoveCategory()
public
removeCategory(TCategory $category) : $this
Parameters
- $category : TCategory
Return values
$thisremoveTranslation()
public
removeTranslation(TTranslation $translation) : $this
Parameters
- $translation : TTranslation
Return values
$thisremoveVariant()
public
removeVariant(TVariant $variant) : $this
Parameters
- $variant : TVariant
Return values
$thissetActivated()
public
setActivated(bool $activated) : $this
Parameters
- $activated : bool
Return values
$thissetAsset()
public
setAsset(TImage|null $asset) : $this
Parameters
- $asset : TImage|null
Return values
$thissetCategories()
public
setCategories(Collection<int, TCategory>|array<int, TCategory> $categories) : $this
Parameters
- $categories : Collection<int, TCategory>|array<int, TCategory>
Return values
$thissetDeleted()
public
setDeleted(bool $deleted) : $this
Parameters
- $deleted : bool
Return values
$thissetId()
public
setId(int|null $id) : $this
Parameters
- $id : int|null
Return values
$thissetInsertDate()
public
setInsertDate(DateTime $insertDate) : $this
Parameters
- $insertDate : DateTime
Return values
$thissetProducer()
public
setProducer(TProducer|null $producer) : $this
Parameters
- $producer : TProducer|null
Return values
$thissetProductType()
public
setProductType(TProductType|null $productType) : $this
Parameters
- $productType : TProductType|null
Return values
$thissetTranslations()
public
setTranslations(Collection<int, TTranslation>|array<int, TTranslation> $translations) : $this
Parameters
- $translations : Collection<int, TTranslation>|array<int, TTranslation>
Return values
$thissetVariants()
public
setVariants(Collection<int, TVariant>|array<int, TVariant> $variants) : $this
Parameters
- $variants : Collection<int, TVariant>|array<int, TVariant>
Return values
$thistranslationCollectionInit()
public
translationCollectionInit() : void
variantCollectionInit()
public
variantCollectionInit() : 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>