Advert
extends Advert
in package
Advert definition: the language-independent part (internal name, validity, counters, flags, relations).
Tags
Attributes
- #[Entity]
- #[Table]
- $name: 'cms_mod_base_adverts'
- #[TableAlias]
- 'advert'
Table of Contents
Properties
- $activated : bool
- $clicks : int
- $endDatetime : DateTime
- $id : int|null
- $isAvailable : bool
- $maxClicks : int|null
- $maxViews : int|null
- $name : string
- $pages : Collection
- $parameters : Collection
- $placeRels : Collection
- $showEverywhere : bool
- $startDatetime : DateTime
- $translations : Collection
- $views : int
Methods
- __construct() : mixed
- addPage() : $this
- addParameter() : $this
- addPlaceRel() : $this
- addTranslation() : $this
- callInitMethods() : void
- Calls `init{TraitName}()` for every used trait that defines such a method.
- getActivated() : bool
- getAllTraits() : array<string, string>
- Returns all traits the class uses, including those used by parent classes and nested traits.
- getClicks() : int
- getEndDatetime() : DateTime
- getId() : int|null
- getIsAvailable() : bool
- getMaxClicks() : int|null
- getMaxViews() : int|null
- getName() : string
- getPage() : TPage|null
- getPages() : Collection<int, TPage>
- getParameter() : TParameter|null
- getParameters() : Collection<int, TParameter>
- getPlaceRels() : Collection<int, TRel>
- getPlaces() : Collection<int, TPlace>
- Returns the linked ad places, extracted from `placeRels`.
- getShowEverywhere() : bool
- getStartDatetime() : DateTime
- getTranslation() : TTranslation|null
- getTranslations() : Collection<int, TTranslation>
- getViews() : int
- isActivated() : bool
- isIsAvailable() : bool
- isPersisted() : bool
- isShowEverywhere() : bool
- pageCollectionInit() : void
- parameterCollectionInit() : void
- placeCollectionInit() : void
- removePage() : $this
- removeParameter() : $this
- removeTranslation() : $this
- setActivated() : $this
- setClicks() : $this
- setEndDatetime() : $this
- setId() : $this
- setIsAvailable() : $this
- setMaxClicks() : $this
- setMaxViews() : $this
- setName() : $this
- setPages() : $this
- setParameters() : $this
- setPlaceRels() : $this
- setShowEverywhere() : $this
- setStartDatetime() : $this
- setTranslations() : $this
- setViews() : $this
- translationCollectionInit() : void
- getTraitsRecursive() : array<string, string>
- Walks the trait list recursively and collects nested traits too.
Properties
$activated
protected
bool
$activated
= false
Attributes
- #[Column]
- $name: 'activated'
- $type: 'boolean'
$clicks
protected
int
$clicks
= 0
Attributes
- #[Column]
- $name: 'clicks'
- $type: 'integer'
- $options: ['unsigned' => true, 'default' => 0]
$endDatetime
protected
DateTime
$endDatetime
= new DateTime()
Attributes
- #[Column]
- $name: 'end_datetime'
- $type: 'datetime'
$id
protected
int|null
$id
= null
Attributes
- #[Column]
- $name: 'advert_id'
- $type: 'integer'
- $options: ['unsigned' => true]
- #[GeneratedValue]
- #[Id]
$isAvailable
protected
bool
$isAvailable
= false
Attributes
- #[Column]
- $name: 'is_available'
- $type: 'boolean'
- $generated: 'ALWAYS'
- $insertable: false
- $updatable: false
$maxClicks
protected
int|null
$maxClicks
= null
Attributes
- #[Column]
- $name: 'max_clicks'
- $type: 'bigint'
- $nullable: true
- $options: ['unsigned' => true]
$maxViews
protected
int|null
$maxViews
= null
Attributes
- #[Column]
- $name: 'max_views'
- $type: 'bigint'
- $nullable: true
- $options: ['unsigned' => true]
$name
protected
string
$name
= ''
Attributes
- #[Column]
- $name: 'name'
- $type: 'string'
- $length: 255
$pages
protected
Collection
$pages
Attributes
- #[JoinTable]
- $name: 'cms_mod_base_advert_page_relations'
- $joinColumns: [new \Doctrine\ORM\Mapping\JoinColumn(name: 'cms_mod_base_adverts_advert_id', referencedColumnName: 'advert_id')]
- $inverseJoinColumns: [new \Doctrine\ORM\Mapping\JoinColumn(name: 'cms_system_pages_page_id', referencedColumnName: 'page_id')]
- #[ManyToMany]
- $targetEntity: \App\UI\Api\System\Models\Entities\Page::class
- $fetch: "LAZY"
$parameters
protected
Collection
$parameters
Attributes
- #[OneToMany]
- $targetEntity: \App\UI\Api\Base\Models\Entities\AdvertParameterRel::class
- $mappedBy: 'advert'
- $cascade: ["persist", "remove"]
- $orphanRemoval: true
- $fetch: "LAZY"
$placeRels
protected
Collection
$placeRels
placeRels (AdvertPlaceRel)
Attributes
- #[OneToMany]
- $targetEntity: \App\UI\Api\Base\Models\Entities\AdvertPlaceRel::class
- $mappedBy: 'advert'
- $cascade: ["persist", "remove"]
- $orphanRemoval: true
- $fetch: "LAZY"
$showEverywhere
protected
bool
$showEverywhere
= false
Attributes
- #[Column]
- $name: 'show_everywhere'
- $type: 'boolean'
$startDatetime
protected
DateTime
$startDatetime
= new DateTime()
Attributes
- #[Column]
- $name: 'start_datetime'
- $type: 'datetime'
$translations
protected
Collection
$translations
Attributes
- #[OneToMany]
- $targetEntity: \App\UI\Api\Base\Models\Entities\AdvertText::class
- $mappedBy: 'parent'
- $cascade: ["persist", "remove"]
- $orphanRemoval: true
- $fetch: "LAZY"
$views
protected
int
$views
= 0
Attributes
- #[Column]
- $name: 'views'
- $type: 'bigint'
- $options: ['unsigned' => true, 'default' => 0]
Methods
__construct()
public
__construct([int|null $id = null ][, string $name = '' ][, DateTime $startDatetime = new DateTime() ][, DateTime $endDatetime = new DateTime() ][, int $clicks = 0 ][, int|null $maxClicks = null ][, int $views = 0 ][, int|null $maxViews = null ][, bool $activated = false ][, bool $showEverywhere = false ][, bool $isAvailable = false ][, Collection $pages = new ArrayCollection() ][, Collection $parameters = new ArrayCollection() ][, Collection $placeRels = new ArrayCollection() ]) : mixed
Parameters
- $id : int|null = null
- $name : string = ''
- $startDatetime : DateTime = new DateTime()
- $endDatetime : DateTime = new DateTime()
- $clicks : int = 0
- $maxClicks : int|null = null
- $views : int = 0
- $maxViews : int|null = null
- $activated : bool = false
- $showEverywhere : bool = false
- $isAvailable : bool = false
- $pages : Collection = new ArrayCollection()
- $parameters : Collection = new ArrayCollection()
- $placeRels : Collection = new ArrayCollection()
addPage()
public
addPage(TPage $page) : $this
Parameters
- $page : TPage
Return values
$thisaddParameter()
public
addParameter(TParameter $parameter) : $this
Parameters
- $parameter : TParameter
Return values
$thisaddPlaceRel()
public
addPlaceRel(TRel $rel) : $this
Parameters
- $rel : TRel
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
getActivated()
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>getClicks()
public
getClicks() : int
Return values
intgetEndDatetime()
public
getEndDatetime() : DateTime
Return values
DateTimegetId()
public
getId() : int|null
Return values
int|nullgetIsAvailable()
public
getIsAvailable() : bool
Return values
boolgetMaxClicks()
public
getMaxClicks() : int|null
Return values
int|nullgetMaxViews()
public
getMaxViews() : int|null
Return values
int|nullgetName()
public
getName() : string
Return values
stringgetPage()
public
getPage(int $pageId) : TPage|null
Parameters
- $pageId : int
Return values
TPage|nullgetPages()
public
getPages() : Collection<int, TPage>
Return values
Collection<int, TPage>getParameter()
public
getParameter(int $parameterId) : TParameter|null
Parameters
- $parameterId : int
Return values
TParameter|nullgetParameters()
public
getParameters() : Collection<int, TParameter>
Return values
Collection<int, TParameter>getPlaceRels()
public
getPlaceRels() : Collection<int, TRel>
Return values
Collection<int, TRel>getPlaces()
Returns the linked ad places, extracted from `placeRels`.
public
getPlaces() : Collection<int, TPlace>
Return values
Collection<int, TPlace>getShowEverywhere()
public
getShowEverywhere() : bool
Return values
boolgetStartDatetime()
public
getStartDatetime() : DateTime
Return values
DateTimegetTranslation()
public
getTranslation(int $langId) : TTranslation|null
Parameters
- $langId : int
Return values
TTranslation|nullgetTranslations()
public
getTranslations() : Collection<int, TTranslation>
Return values
Collection<int, TTranslation>getViews()
public
getViews() : int
Return values
intisActivated()
public
isActivated() : bool
Return values
boolisIsAvailable()
public
isIsAvailable() : bool
Return values
boolisPersisted()
public
isPersisted() : bool
Return values
boolisShowEverywhere()
public
isShowEverywhere() : bool
Return values
boolpageCollectionInit()
public
pageCollectionInit() : void
parameterCollectionInit()
public
parameterCollectionInit() : void
placeCollectionInit()
public
placeCollectionInit() : void
removePage()
public
removePage(TPage $page) : $this
Parameters
- $page : TPage
Return values
$thisremoveParameter()
public
removeParameter(TParameter $parameter) : $this
Parameters
- $parameter : TParameter
Return values
$thisremoveTranslation()
public
removeTranslation(TTranslation $translation) : $this
Parameters
- $translation : TTranslation
Return values
$thissetActivated()
public
setActivated(bool $activated) : $this
Parameters
- $activated : bool
Return values
$thissetClicks()
public
setClicks(int $clicks) : $this
Parameters
- $clicks : int
Return values
$thissetEndDatetime()
public
setEndDatetime(DateTime $dt) : $this
Parameters
- $dt : DateTime
Return values
$thissetId()
public
setId(int|null $id) : $this
Parameters
- $id : int|null
Return values
$thissetIsAvailable()
public
setIsAvailable(bool $isAvailable) : $this
Parameters
- $isAvailable : bool
Return values
$thissetMaxClicks()
public
setMaxClicks(int|null $maxClicks) : $this
Parameters
- $maxClicks : int|null
Return values
$thissetMaxViews()
public
setMaxViews(int|null $maxViews) : $this
Parameters
- $maxViews : int|null
Return values
$thissetName()
public
setName(string $name) : $this
Parameters
- $name : string
Return values
$thissetPages()
public
setPages(Collection<int, TPage>|array<int, TPage> $pages) : $this
Parameters
- $pages : Collection<int, TPage>|array<int, TPage>
Return values
$thissetParameters()
public
setParameters(Collection<int, TParameter>|array<int, TParameter> $parameters) : $this
Parameters
- $parameters : Collection<int, TParameter>|array<int, TParameter>
Return values
$thissetPlaceRels()
public
setPlaceRels(Collection<int, TRel>|array<int, TRel> $placeRels) : $this
Parameters
- $placeRels : Collection<int, TRel>|array<int, TRel>
Return values
$thissetShowEverywhere()
public
setShowEverywhere(bool $showEverywhere) : $this
Parameters
- $showEverywhere : bool
Return values
$thissetStartDatetime()
public
setStartDatetime(DateTime $dt) : $this
Parameters
- $dt : DateTime
Return values
$thissetTranslations()
public
setTranslations(Collection<int, TTranslation>|array<int, TTranslation> $translations) : $this
Parameters
- $translations : Collection<int, TTranslation>|array<int, TTranslation>
Return values
$thissetViews()
public
setViews(int $views) : $this
Parameters
- $views : int
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>