CoolCMS API

Article extends Article
in package

Tags
extends
Attributes
#[Entity]
#[Table]
$name: 'cms_mod_blog_articles'
#[TableAlias]
'article'

Table of Contents

Properties

$activated  : bool
$advertRels  : Collection<int, ArticleAdvertRel>
$asset  : TImage|null
$author  : string|null
$categories  : Collection<int, Category>
$commentThread  : CommentThread|null
$galleries  : Collection<int, Gallery>
$iconClass  : string|null
$id  : int|null
$insertTime  : DateTime
$main  : bool
Main article of the editorial front page ({@see \App\UI\Front\Blog\Components\MainArticleListComponent\MainArticleList}).
$pollRels  : Collection<int, ArticlePollRel>
$published  : DateTime|null
$purchaseUrl  : string|null
$ratingThread  : RatingThread|null
$region  : object|null
$regionId  : int|null
$tags  : Collection<int, Tag>
$translations  : Collection<int, ArticleText>
$updateDatetime  : DateTime|null
$user  : TUser|null
$userId  : int|null
$views  : int

Methods

__construct()  : mixed
addAdvertRel()  : $this
addCategory()  : $this
addGallery()  : $this
addPollRel()  : $this
addTag()  : $this
addTranslation()  : $this
advertRelCollectionInit()  : void
callInitMethods()  : void
Calls `init{TraitName}()` for every used trait that defines such a method.
categoryCollectionInit()  : void
clearAdvertRels()  : $this
clearCategories()  : $this
clearGalleries()  : $this
clearPollRels()  : $this
clearTags()  : $this
galleryCollectionInit()  : void
getActivated()  : bool
getAdvertRels()  : Collection<int, TRel>
getAllTraits()  : array<string, string>
Returns all traits the class uses, including those used by parent classes and nested traits.
getAsset()  : TImage|null
getAuthor()  : string|null
getCategories()  : Collection<int, TCategory>
getCategoryIds()  : array<string|int, int>
getCommentThread()  : object|null
getCommentThreadId()  : int|null
getFirstCategoryId()  : int|null
getGalleries()  : Collection<int, TGallery>
getIconClass()  : string|null
getId()  : int|null
getInsertTime()  : DateTime
getMain()  : bool
getPollRels()  : Collection<int, TRel>
getPublished()  : DateTime|null
getPurchaseUrl()  : string|null
getRatingThread()  : object|null
getRatingThreadId()  : int|null
getRegion()  : object|null
getRegionId()  : int|null
getTagIds()  : array<int, int|null>
getTags()  : Collection<int, TTag>
getTranslation()  : TTranslation|null
getTranslations()  : Collection<int, TTranslation>
getUpdateDatetime()  : DateTime|null
getUser()  : TUser|null
getUserId()  : int|null
getViews()  : int
isActivated()  : bool
isMain()  : bool
isOpenAccess()  : bool
Whether anyone may read the whole article: it lies in at least one active free category.
isPersisted()  : bool
isPubliclyVisible()  : bool
pollRelCollectionInit()  : void
removeCategory()  : $this
removeGallery()  : $this
removeTag()  : $this
removeTranslation()  : $this
setActivated()  : $this
setAdvertRels()  : $this
setAsset()  : $this
setAuthor()  : $this
setCategories()  : $this
setCommentThread()  : $this
setGalleries()  : $this
setIconClass()  : $this
setId()  : $this
setInsertTime()  : $this
setMain()  : static
setPollRels()  : $this
setPublished()  : $this
setPurchaseUrl()  : $this
setRatingThread()  : $this
setRegion()  : $this
setRegionId()  : $this
setTags()  : $this
setTranslations()  : $this
setUpdateDatetime()  : $this
setUser()  : $this
setUserId()  : $this
setViews()  : $this
tagCollectionInit()  : void
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]

$advertRels

protected Collection<int, ArticleAdvertRel> $advertRels
Attributes
#[OneToMany]
$targetEntity: \App\UI\Api\Blog\Models\Entities\ArticleAdvertRel::class
$mappedBy: 'article'
$cascade: ["persist", "remove"]
$orphanRemoval: true
$fetch: "LAZY"

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

$author

protected string|null $author = null
Attributes
#[Column]
$name: 'author'
$type: 'string'
$length: 255
$nullable: true

$categories

protected Collection<int, Category> $categories
Attributes
#[JoinTable]
$name: 'cms_mod_blog_article_category_relations'
$joinColumns: [new \Doctrine\ORM\Mapping\JoinColumn(name: 'cms_mod_blog_articles_article_id', referencedColumnName: 'article_id', onDelete: 'CASCADE')]
$inverseJoinColumns: [new \Doctrine\ORM\Mapping\JoinColumn(name: 'cms_mod_blog_categories_category_id', referencedColumnName: 'category_id', onDelete: 'CASCADE')]
#[ManyToMany]
$targetEntity: \App\UI\Api\Blog\Models\Entities\Category::class
$fetch: "LAZY"

$commentThread

protected CommentThread|null $commentThread = null
Attributes
#[JoinColumn]
$name: 'cms_mod_base_comment_threads_comment_thread_id'
$referencedColumnName: 'comment_thread_id'
$nullable: true
$onDelete: 'SET NULL'
#[ManyToOne]
$targetEntity: \App\UI\Api\Base\Models\Entities\CommentThread::class
$fetch: "LAZY"

$galleries

protected Collection<int, Gallery> $galleries
Attributes
#[JoinTable]
$name: 'cms_mod_blog_article_gallery_relations'
$joinColumns: [new \Doctrine\ORM\Mapping\JoinColumn(name: 'cms_mod_blog_articles_article_id', referencedColumnName: 'article_id', onDelete: 'CASCADE')]
$inverseJoinColumns: [new \Doctrine\ORM\Mapping\JoinColumn(name: 'cms_mod_blog_galleries_gallery_id', referencedColumnName: 'gallery_id', onDelete: 'CASCADE')]
#[ManyToMany]
$targetEntity: \App\UI\Api\Blog\Models\Entities\Gallery::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: 'article_id'
$type: 'integer'
#[GeneratedValue]
#[Id]

$insertTime

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

$main

Main article of the editorial front page ({@see \App\UI\Front\Blog\Components\MainArticleListComponent\MainArticleList}).

protected bool $main = false

Not unique: several articles may be marked and the newest published one is shown, so saving an article never touches other articles. Editorial curation: admin and cron write it freely, an external client cannot promote itself to the front page.

Attributes
#[Column]
$name: 'main'
$type: 'boolean'
$options: ['default' => 0]
#[ExternalReadonly]

$pollRels

protected Collection<int, ArticlePollRel> $pollRels
Attributes
#[OneToMany]
$targetEntity: \App\UI\Api\Blog\Models\Entities\ArticlePollRel::class
$mappedBy: 'article'
$cascade: ["persist", "remove"]
$orphanRemoval: true
$fetch: "LAZY"

$published

protected DateTime|null $published = null
Attributes
#[Column]
$name: 'published'
$type: 'datetime'
$nullable: true

$purchaseUrl

protected string|null $purchaseUrl = null
Attributes
#[Column]
$name: 'purchase_url'
$type: 'string'
$length: 255
$nullable: true

$ratingThread

protected RatingThread|null $ratingThread = null
Attributes
#[JoinColumn]
$name: 'cms_mod_base_rating_threads_rating_thread_id'
$referencedColumnName: 'rating_thread_id'
$nullable: true
$onDelete: 'SET NULL'
#[ManyToOne]
$targetEntity: \App\UI\Api\Base\Models\Entities\RatingThread::class
$fetch: "LAZY"

$region

protected object|null $region = null
Attributes
#[JoinColumn]
$name: 'cms_system_regions_region_id'
$referencedColumnName: 'region_id'
$nullable: true
$onDelete: 'SET NULL'
#[ManyToOne]
$targetEntity: \App\UI\Api\System\Models\Entities\Region::class
$fetch: "LAZY"

$regionId

protected int|null $regionId = null
Attributes
#[Column]
$name: 'cms_system_regions_region_id'
$type: 'integer'
$nullable: true
$insertable: false
$updatable: false
$options: ['unsigned' => true]

$tags

protected Collection<int, Tag> $tags
Attributes
#[JoinTable]
$name: 'cms_mod_blog_article_tag_relations'
$joinColumns: [new \Doctrine\ORM\Mapping\JoinColumn(name: 'cms_mod_blog_articles_article_id', referencedColumnName: 'article_id', onDelete: 'CASCADE')]
$inverseJoinColumns: [new \Doctrine\ORM\Mapping\JoinColumn(name: 'cms_mod_blog_tags_tag_id', referencedColumnName: 'tag_id', onDelete: 'CASCADE')]
#[ManyToMany]
$targetEntity: \App\UI\Api\Blog\Models\Entities\Tag::class
$fetch: "LAZY"

$translations

protected Collection<int, ArticleText> $translations
Attributes
#[OneToMany]
$targetEntity: \App\UI\Api\Blog\Models\Entities\ArticleText::class
$mappedBy: "parent"
$cascade: ["persist", "remove"]
$orphanRemoval: true
$fetch: "LAZY"

$updateDatetime

protected DateTime|null $updateDatetime = null
Attributes
#[Column]
$name: 'update_datetime'
$type: 'datetime'
$nullable: true
#[ExternalReadonly]

$user

protected TUser|null $user = null
Attributes
#[JoinColumn]
$name: 'cms_system_users_user_id'
$referencedColumnName: 'user_id'
$nullable: true
$onDelete: 'SET NULL'
#[ManyToOne]
$targetEntity: \App\UI\Api\System\Models\Entities\User::class
$fetch: "LAZY"

$userId

protected int|null $userId = null
Attributes
#[Column]
$name: 'cms_system_users_user_id'
$type: 'integer'
$nullable: true
$options: ['unsigned' => true]
#[ExternalReadonly]

$views

protected int $views = 0
Attributes
#[Column]
$name: 'views'
$type: 'integer'
$options: ['default' => 0]
#[ExternalReadonly]

Methods

__construct()

public __construct([int|null $id = null ][, DateTime $insertTime = new DateTime() ][, DateTime|null $updateDatetime = null ][, DateTime|null $published = null ][, bool $activated = false ][, bool $main = false ][, int|null $userId = null ][, int|null $regionId = null ][, mixed $user = null ][, mixed $region = null ][, mixed $asset = null ][, int $views = 0 ][, string|null $author = null ][, string|null $purchaseUrl = null ][, string|null $iconClass = null ][, Collection $translations = new ArrayCollection() ][, Collection $categories = new ArrayCollection() ][, Collection $tags = new ArrayCollection() ][, Collection $galleries = new ArrayCollection() ][, Collection $advertRels = new ArrayCollection() ][, Collection $pollRels = new ArrayCollection() ]) : mixed
Parameters
$id : int|null = null
$insertTime : DateTime = new DateTime()
$updateDatetime : DateTime|null = null
$published : DateTime|null = null
$activated : bool = false
$main : bool = false
$userId : int|null = null
$regionId : int|null = null
$user : mixed = null
$region : mixed = null
$asset : mixed = null
$views : int = 0
$author : string|null = null
$purchaseUrl : string|null = null
$iconClass : string|null = null
$translations : Collection = new ArrayCollection()
$categories : Collection = new ArrayCollection()
$tags : Collection = new ArrayCollection()
$galleries : Collection = new ArrayCollection()
$advertRels : Collection = new ArrayCollection()
$pollRels : Collection = new ArrayCollection()

addCategory()

public addCategory(TCategory $category) : $this
Parameters
$category : TCategory
Return values
$this

addGallery()

public addGallery(TGallery $gallery) : $this
Parameters
$gallery : TGallery
Return values
$this

addTag()

public addTag(TTag $tag) : $this
Parameters
$tag : TTag
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>

getAsset()

public getAsset() : TImage|null
Return values
TImage|null

getAuthor()

public getAuthor() : string|null
Return values
string|null

getCategories()

public getCategories() : Collection<int, TCategory>
Return values
Collection<int, TCategory>

getCategoryIds()

public getCategoryIds() : array<string|int, int>
Return values
array<string|int, int>

getCommentThread()

public getCommentThread() : object|null
Return values
object|null

getCommentThreadId()

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

getGalleries()

public getGalleries() : Collection<int, TGallery>
Return values
Collection<int, TGallery>

getIconClass()

public getIconClass() : string|null
Return values
string|null

getInsertTime()

public getInsertTime() : DateTime
Return values
DateTime

getMain()

public getMain() : bool
Return values
bool

getPublished()

public getPublished() : DateTime|null
Return values
DateTime|null

getPurchaseUrl()

public getPurchaseUrl() : string|null
Return values
string|null

getRatingThread()

public getRatingThread() : object|null
Return values
object|null

getRatingThreadId()

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

getRegion()

public getRegion() : object|null
Return values
object|null

getRegionId()

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

getTagIds()

public getTagIds() : array<int, int|null>
Return values
array<int, int|null> —

ids of the attached tags (getId() is ?int)

getTags()

public getTags() : Collection<int, TTag>
Return values
Collection<int, TTag>

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>

getUpdateDatetime()

public getUpdateDatetime() : DateTime|null
Return values
DateTime|null

getUser()

public getUser() : TUser|null
Return values
TUser|null

getUserId()

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

getViews()

public getViews() : int
Return values
int

isActivated()

public isActivated() : bool
Return values
bool

isMain()

public isMain() : bool
Return values
bool

isOpenAccess()

Whether anyone may read the whole article: it lies in at least one active free category.

public isOpenAccess() : bool

Otherwise it is for members only (list card with a badge, detail = preview with a banner). The categories must be loaded (include('categories…')), otherwise the article counts as paid.

Return values
bool

isPubliclyVisible()

public isPubliclyVisible([DateTimeInterface|null $now = null ]) : bool
Parameters
$now : DateTimeInterface|null = null
Return values
bool

removeCategory()

public removeCategory(TCategory $category) : $this
Parameters
$category : TCategory
Return values
$this

removeGallery()

public removeGallery(TGallery $gallery) : $this
Parameters
$gallery : TGallery
Return values
$this

removeTag()

public removeTag(TTag $tag) : $this
Parameters
$tag : TTag
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

setAdvertRels()

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

setAsset()

public setAsset(TImage|null $asset) : $this
Parameters
$asset : TImage|null
Return values
$this

setAuthor()

public setAuthor(string|null $author) : $this
Parameters
$author : string|null
Return values
$this

setCategories()

public setCategories(Collection<int, TCategory>|array<int, TCategory> $categories) : $this
Parameters
$categories : Collection<int, TCategory>|array<int, TCategory>
Return values
$this

setCommentThread()

public setCommentThread(object|null $commentThread) : $this
Parameters
$commentThread : object|null
Return values
$this

setGalleries()

public setGalleries(Collection<int, TGallery>|array<int, TGallery> $galleries) : $this
Parameters
$galleries : Collection<int, TGallery>|array<int, TGallery>
Return values
$this

setIconClass()

public setIconClass(string|null $iconClass) : $this
Parameters
$iconClass : string|null
Return values
$this

setId()

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

setInsertTime()

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

setMain()

public setMain(bool $main) : static
Parameters
$main : bool
Return values
static

setPollRels()

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

setPublished()

public setPublished(DateTime|null $published) : $this
Parameters
$published : DateTime|null
Return values
$this

setPurchaseUrl()

public setPurchaseUrl(string|null $purchaseUrl) : $this
Parameters
$purchaseUrl : string|null
Return values
$this

setRatingThread()

public setRatingThread(object|null $ratingThread) : $this
Parameters
$ratingThread : object|null
Return values
$this

setRegion()

public setRegion(object|null $region) : $this
Parameters
$region : object|null
Return values
$this

setRegionId()

public setRegionId(int|null $regionId) : $this
Parameters
$regionId : int|null
Return values
$this

setTags()

public setTags(Collection<int, TTag>|array<int, TTag> $tags) : $this
Parameters
$tags : Collection<int, TTag>|array<int, TTag>
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

setUpdateDatetime()

public setUpdateDatetime(DateTime|null $dt) : $this
Parameters
$dt : DateTime|null
Return values
$this

setUser()

public setUser(TUser|null $user) : $this
Parameters
$user : TUser|null
Return values
$this

setUserId()

public setUserId(int|null $userId) : $this
Parameters
$userId : int|null
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