CoolCMS API

Advert extends Advert
in package

Advert definition: the language-independent part (internal name, validity, counters, flags, relations).

Tags
extends
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'
#[ExternalReadonly]

$clicks

protected int $clicks = 0
Attributes
#[Column]
$name: 'clicks'
$type: 'integer'
$options: ['unsigned' => true, 'default' => 0]
#[ExternalReadonly]

$endDatetime

protected DateTime $endDatetime = new DateTime()
Attributes
#[Column]
$name: 'end_datetime'
$type: 'datetime'
#[ExternalReadonly]

$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]
#[ExternalReadonly]

$maxViews

protected int|null $maxViews = null
Attributes
#[Column]
$name: 'max_views'
$type: 'bigint'
$nullable: true
$options: ['unsigned' => true]
#[ExternalReadonly]

$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'
#[ExternalReadonly]

$startDatetime

protected DateTime $startDatetime = new DateTime()
Attributes
#[Column]
$name: 'start_datetime'
$type: 'datetime'
#[ExternalReadonly]

$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]
#[ExternalReadonly]

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
$this

addParameter()

public addParameter(TParameter $parameter) : $this
Parameters
$parameter : TParameter
Return values
$this

addPlaceRel()

public addPlaceRel(TRel $rel) : $this
Parameters
$rel : TRel
Return values
$this

addTranslation()

public addTranslation(TTranslation $translation) : $this
Parameters
$translation : TTranslation
Return values
$this

callInitMethods()

Calls `init{TraitName}()` for every used trait that defines such a method.

public callInitMethods() : void

getActivated()

public getActivated() : bool
Return values
bool

getAllTraits()

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
int

getEndDatetime()

public getEndDatetime() : DateTime
Return values
DateTime

getIsAvailable()

public getIsAvailable() : bool
Return values
bool

getMaxClicks()

public getMaxClicks() : int|null
Return values
int|null

getMaxViews()

public getMaxViews() : int|null
Return values
int|null

getName()

public getName() : string
Return values
string

getPage()

public getPage(int $pageId) : TPage|null
Parameters
$pageId : int
Return values
TPage|null

getPages()

public getPages() : Collection<int, TPage>
Return values
Collection<int, TPage>

getParameter()

public getParameter(int $parameterId) : TParameter|null
Parameters
$parameterId : int
Return values
TParameter|null

getParameters()

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
bool

getStartDatetime()

public getStartDatetime() : DateTime
Return values
DateTime

getTranslation()

public getTranslation(int $langId) : TTranslation|null
Parameters
$langId : int
Return values
TTranslation|null

getTranslations()

public getTranslations() : Collection<int, TTranslation>
Return values
Collection<int, TTranslation>

getViews()

public getViews() : int
Return values
int

isActivated()

public isActivated() : bool
Return values
bool

isIsAvailable()

public isIsAvailable() : bool
Return values
bool

isShowEverywhere()

public isShowEverywhere() : bool
Return values
bool

removePage()

public removePage(TPage $page) : $this
Parameters
$page : TPage
Return values
$this

removeParameter()

public removeParameter(TParameter $parameter) : $this
Parameters
$parameter : TParameter
Return values
$this

removeTranslation()

public removeTranslation(TTranslation $translation) : $this
Parameters
$translation : TTranslation
Return values
$this

setActivated()

public setActivated(bool $activated) : $this
Parameters
$activated : bool
Return values
$this

setClicks()

public setClicks(int $clicks) : $this
Parameters
$clicks : int
Return values
$this

setEndDatetime()

public setEndDatetime(DateTime $dt) : $this
Parameters
$dt : DateTime
Return values
$this

setId()

public setId(int|null $id) : $this
Parameters
$id : int|null
Return values
$this

setIsAvailable()

public setIsAvailable(bool $isAvailable) : $this
Parameters
$isAvailable : bool
Return values
$this

setMaxClicks()

public setMaxClicks(int|null $maxClicks) : $this
Parameters
$maxClicks : int|null
Return values
$this

setMaxViews()

public setMaxViews(int|null $maxViews) : $this
Parameters
$maxViews : int|null
Return values
$this

setName()

public setName(string $name) : $this
Parameters
$name : string
Return values
$this

setPages()

public setPages(Collection<int, TPage>|array<int, TPage> $pages) : $this
Parameters
$pages : Collection<int, TPage>|array<int, TPage>
Return values
$this

setParameters()

public setParameters(Collection<int, TParameter>|array<int, TParameter> $parameters) : $this
Parameters
$parameters : Collection<int, TParameter>|array<int, TParameter>
Return values
$this

setPlaceRels()

public setPlaceRels(Collection<int, TRel>|array<int, TRel> $placeRels) : $this
Parameters
$placeRels : Collection<int, TRel>|array<int, TRel>
Return values
$this

setShowEverywhere()

public setShowEverywhere(bool $showEverywhere) : $this
Parameters
$showEverywhere : bool
Return values
$this

setStartDatetime()

public setStartDatetime(DateTime $dt) : $this
Parameters
$dt : DateTime
Return values
$this

setTranslations()

public setTranslations(Collection<int, TTranslation>|array<int, TTranslation> $translations) : $this
Parameters
$translations : Collection<int, TTranslation>|array<int, TTranslation>
Return values
$this

setViews()

public setViews(int $views) : $this
Parameters
$views : int
Return values
$this

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>
Return values
array<string, string>
On this page

Search results