Event
extends Event
in package
Admin variant of an event (`cms_mod_blog_events`), hydrated from the `api/blog/event` endpoint.
The admin presenter edits translations, scalar fields (dates, address, activation, author), the
main image (asset) and the FKs to the user (user) and region (region). Categories, tags
and galleries are not edited here, so they are not mapped.
The main photo is uploaded through the ImageUpload component (bytes go to the Api in $meta);
saving the variants and the Asset entity is done by EventManager.
Tags
Attributes
- #[Entity]
- #[Table]
- $name: 'cms_mod_blog_events'
- #[TableAlias]
- 'event'
Table of Contents
Properties
- $active : bool
- $address : string|null
- $asset : TImage|null
- $author : string|null
- $categories : Collection<int, TCategory>
- $commentThreadId : int|null
- $fromDatetime : DateTime|null
- $galleries : Collection<int, TGallery>
- $id : int|null
- $insertDatetime : DateTime
- $publicationDatetime : DateTime|null
- $region : TRegion|null
- $regionId : int|null
- $tags : Collection<int, TTag>
- $toDatetime : DateTime|null
- $translations : Collection<int, EventText>
- $user : TUser|null
- $userId : int|null
Methods
- __construct() : mixed
- addCategory() : $this
- addGallery() : $this
- addTag() : $this
- addTranslation() : $this
- callInitMethods() : void
- Calls `init{TraitName}()` for every used trait that defines such a method.
- categoryCollectionInit() : void
- clearCategories() : $this
- clearGalleries() : $this
- clearTags() : $this
- galleryCollectionInit() : void
- getActive() : bool
- getAddress() : string|null
- 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>
- getCommentThreadId() : int|null
- getFirstCategoryId() : int|null
- getFrom() : DateTime|null
- getFromDatetime() : DateTime|null
- getGalleries() : Collection<int, TGallery>
- getId() : int|null
- getInsertDatetime() : DateTime
- getPublicationDatetime() : DateTime|null
- getPublished() : DateTime|null
- getRegion() : object|null
- getRegionId() : int|null
- getTagIds() : array<int, int|null>
- getTags() : Collection<int, TTag>
- getTo() : DateTime|null
- getToDatetime() : DateTime|null
- getTranslation() : TTranslation|null
- getTranslations() : Collection<int, TTranslation>
- getUser() : TUser|null
- getUserId() : int|null
- isActive() : bool
- isPersisted() : bool
- isPubliclyVisible() : bool
- Whether the detail is public: active and published today or earlier (day granularity, same rule as the list).
- removeCategory() : $this
- removeGallery() : $this
- removeTag() : $this
- removeTranslation() : $this
- setActive() : $this
- setAddress() : $this
- setAsset() : $this
- setAuthor() : $this
- setCategories() : $this
- setCommentThreadId() : $this
- setFrom() : $this
- setFromDatetime() : $this
- setGalleries() : $this
- setId() : $this
- setInsertDatetime() : $this
- setPublicationDatetime() : $this
- setPublished() : $this
- setRegion() : $this
- setRegionId() : $this
- setTags() : $this
- setTo() : $this
- setToDatetime() : $this
- setTranslations() : $this
- setUser() : $this
- setUserId() : $this
- tagCollectionInit() : void
- translationCollectionInit() : void
- getTraitsRecursive() : array<string, string>
- Walks the trait list recursively and collects nested traits too.
Properties
$active
protected
bool
$active
= true
Attributes
- #[Column]
- $type: 'boolean'
- $name: 'active'
$address
protected
string|null
$address
= null
Attributes
- #[Column]
- $type: 'string'
- $name: 'address'
- $length: 255
- $nullable: true
$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"
$author
protected
string|null
$author
= null
Attributes
- #[Column]
- $name: 'author'
- $type: 'string'
- $length: 255
- $nullable: true
$categories
protected
Collection<int, TCategory>
$categories
= new ArrayCollection()
Attributes
- #[Transient]
$commentThreadId
protected
int|null
$commentThreadId
= null
Attributes
- #[Column]
- $name: 'cms_mod_base_comment_threads_comment_thread_id'
- $type: 'integer'
- $nullable: true
- $options: ['unsigned' => true]
$fromDatetime
protected
DateTime|null
$fromDatetime
= null
Attributes
- #[Column]
- $type: 'datetime'
- $name: 'from_datetime'
- $nullable: true
$galleries
protected
Collection<int, TGallery>
$galleries
= new ArrayCollection()
Attributes
- #[Transient]
$id
protected
int|null
$id
= null
Attributes
- #[Column]
- $type: 'integer'
- $name: 'event_id'
- $options: ['unsigned' => true]
- #[GeneratedValue]
- #[Id]
$insertDatetime
protected
DateTime
$insertDatetime
= new DateTime()
Attributes
- #[Column]
- $type: 'datetime'
- $name: 'insert_datetime'
$publicationDatetime
protected
DateTime|null
$publicationDatetime
= null
Attributes
- #[Column]
- $type: 'datetime'
- $name: 'published'
- $nullable: true
$region
protected
TRegion|null
$region
= null
Attributes
- #[EntityOf]
- \App\UI\Admin\System\Models\Entities\Region::class
- #[JoinColumn]
- $name: 'cms_system_regions_region_id'
- $referencedColumnName: 'region_id'
- $nullable: true
- $onDelete: 'SET NULL'
- #[ManyToOne]
- $targetEntity: \App\UI\Admin\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, TTag>
$tags
= new ArrayCollection()
Attributes
- #[Transient]
$toDatetime
protected
DateTime|null
$toDatetime
= null
Attributes
- #[Column]
- $type: 'datetime'
- $name: 'to_datetime'
- $nullable: true
$translations
protected
Collection<int, EventText>
$translations
Attributes
- #[CollectionOf]
- \App\UI\Admin\Blog\Models\Entities\EventText::class
- $owned: true
- #[OneToMany]
- $targetEntity: \App\UI\Admin\Blog\Models\Entities\EventText::class
- $mappedBy: 'parent'
- $cascade: ["persist", "remove"]
- $orphanRemoval: true
- $fetch: "LAZY"
$user
protected
TUser|null
$user
= null
Attributes
- #[EntityOf]
- \App\UI\Admin\System\Models\Entities\User::class
- #[JoinColumn]
- $name: 'cms_system_users_user_id'
- $referencedColumnName: 'user_id'
- $nullable: true
- $onDelete: 'SET NULL'
- #[ManyToOne]
- $targetEntity: \App\UI\Admin\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
- $insertable: false
- $updatable: false
- $options: ['unsigned' => true]
Methods
__construct()
public
__construct([int|null $id = null ][, int|null $commentThreadId = null ][, DateTime|null $fromDatetime = null ][, DateTime|null $toDatetime = null ][, DateTime|null $publicationDatetime = null ][, string|null $address = null ][, DateTime $insertDatetime = new DateTime() ][, bool $active = true ][, string|null $author = null ][, int|null $userId = null ][, int|null $regionId = null ][, mixed $user = null ][, mixed $region = null ][, mixed $asset = null ][, Collection $translations = new ArrayCollection() ][, Collection $categories = new ArrayCollection() ][, Collection $tags = new ArrayCollection() ][, Collection $galleries = new ArrayCollection() ]) : mixed
Parameters
- $id : int|null = null
- $commentThreadId : int|null = null
- $fromDatetime : DateTime|null = null
- $toDatetime : DateTime|null = null
- $publicationDatetime : DateTime|null = null
- $address : string|null = null
- $insertDatetime : DateTime = new DateTime()
- $active : bool = true
- $author : string|null = null
- $userId : int|null = null
- $regionId : int|null = null
- $user : mixed = null
- $region : mixed = null
- $asset : mixed = null
- $translations : Collection = new ArrayCollection()
- $categories : Collection = new ArrayCollection()
- $tags : Collection = new ArrayCollection()
- $galleries : Collection = new ArrayCollection()
addCategory()
public
addCategory(TCategory $category) : $this
Parameters
- $category : TCategory
Return values
$thisaddGallery()
public
addGallery(TGallery $gallery) : $this
Parameters
- $gallery : TGallery
Return values
$thisaddTag()
public
addTag(TTag $tag) : $this
Parameters
- $tag : TTag
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
categoryCollectionInit()
public
categoryCollectionInit() : void
clearCategories()
public
clearCategories() : $this
Return values
$thisclearGalleries()
public
clearGalleries() : $this
Return values
$thisclearTags()
public
clearTags() : $this
Return values
$thisgalleryCollectionInit()
public
galleryCollectionInit() : void
getActive()
public
getActive() : bool
Return values
boolgetAddress()
public
getAddress() : string|null
Return values
string|nullgetAllTraits()
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|nullgetAuthor()
public
getAuthor() : string|null
Return values
string|nullgetCategories()
public
getCategories() : Collection<int, TCategory>
Return values
Collection<int, TCategory>getCategoryIds()
public
getCategoryIds() : array<string|int, int>
Return values
array<string|int, int>getCommentThreadId()
public
getCommentThreadId() : int|null
Return values
int|nullgetFirstCategoryId()
public
getFirstCategoryId() : int|null
Return values
int|nullgetFrom()
public
getFrom() : DateTime|null
Return values
DateTime|nullgetFromDatetime()
public
getFromDatetime() : DateTime|null
Return values
DateTime|nullgetGalleries()
public
getGalleries() : Collection<int, TGallery>
Return values
Collection<int, TGallery>getId()
public
getId() : int|null
Return values
int|nullgetInsertDatetime()
public
getInsertDatetime() : DateTime
Return values
DateTimegetPublicationDatetime()
public
getPublicationDatetime() : DateTime|null
Return values
DateTime|nullgetPublished()
public
getPublished() : DateTime|null
Return values
DateTime|nullgetRegion()
public
getRegion() : object|null
Return values
object|null —region (loaded with the region include)
getRegionId()
public
getRegionId() : int|null
Return values
int|nullgetTagIds()
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>getTo()
public
getTo() : DateTime|null
Return values
DateTime|nullgetToDatetime()
public
getToDatetime() : DateTime|null
Return values
DateTime|nullgetTranslation()
public
getTranslation(int $langId) : TTranslation|null
Parameters
- $langId : int
Return values
TTranslation|nullgetTranslations()
public
getTranslations() : Collection<int, TTranslation>
Return values
Collection<int, TTranslation>getUser()
public
getUser() : TUser|null
Return values
TUser|nullgetUserId()
public
getUserId() : int|null
Return values
int|nullisActive()
public
isActive() : bool
Return values
boolisPersisted()
public
isPersisted() : bool
Return values
boolisPubliclyVisible()
Whether the detail is public: active and published today or earlier (day granularity, same rule as the list).
public
isPubliclyVisible([DateTimeInterface|null $now = null ]) : bool
A finished event (toDatetime in the past) stays visible; no publication date means no
scheduling.
Parameters
- $now : DateTimeInterface|null = null
Return values
boolremoveCategory()
public
removeCategory(TCategory $category) : $this
Parameters
- $category : TCategory
Return values
$thisremoveGallery()
public
removeGallery(TGallery $gallery) : $this
Parameters
- $gallery : TGallery
Return values
$thisremoveTag()
public
removeTag(TTag $tag) : $this
Parameters
- $tag : TTag
Return values
$thisremoveTranslation()
public
removeTranslation(TTranslation $translation) : $this
Parameters
- $translation : TTranslation
Return values
$thissetActive()
public
setActive(bool $v) : $this
Parameters
- $v : bool
Return values
$thissetAddress()
public
setAddress(string|null $a) : $this
Parameters
- $a : string|null
Return values
$thissetAsset()
public
setAsset(TImage|null $asset) : $this
Parameters
- $asset : TImage|null
Return values
$thissetAuthor()
public
setAuthor(string|null $author) : $this
Parameters
- $author : string|null
Return values
$thissetCategories()
public
setCategories(Collection<int, TCategory>|array<int, TCategory> $categories) : $this
Parameters
- $categories : Collection<int, TCategory>|array<int, TCategory>
Return values
$thissetCommentThreadId()
public
setCommentThreadId(int|null $commentThreadId) : $this
Parameters
- $commentThreadId : int|null
Return values
$thissetFrom()
public
setFrom(DateTime|null $dt) : $this
Parameters
- $dt : DateTime|null
Return values
$thissetFromDatetime()
public
setFromDatetime(DateTime|null $dt) : $this
Parameters
- $dt : DateTime|null
Return values
$thissetGalleries()
public
setGalleries(Collection<int, TGallery>|array<int, TGallery> $galleries) : $this
Parameters
- $galleries : Collection<int, TGallery>|array<int, TGallery>
Return values
$thissetId()
public
setId(int|null $id) : $this
Parameters
- $id : int|null
Return values
$thissetInsertDatetime()
public
setInsertDatetime(DateTime $dt) : $this
Parameters
- $dt : DateTime
Return values
$thissetPublicationDatetime()
public
setPublicationDatetime(DateTime|null $dt) : $this
Parameters
- $dt : DateTime|null
Return values
$thissetPublished()
public
setPublished(DateTime|null $published) : $this
Parameters
- $published : DateTime|null
Return values
$thissetRegion()
public
setRegion(TRegion|null $region) : $this
Parameters
- $region : TRegion|null
Return values
$thissetRegionId()
public
setRegionId(int|null $regionId) : $this
Parameters
- $regionId : int|null
Return values
$thissetTags()
public
setTags(Collection<int, TTag>|array<int, TTag> $tags) : $this
Parameters
- $tags : Collection<int, TTag>|array<int, TTag>
Return values
$thissetTo()
public
setTo(DateTime|null $dt) : $this
Parameters
- $dt : DateTime|null
Return values
$thissetToDatetime()
public
setToDatetime(DateTime|null $dt) : $this
Parameters
- $dt : DateTime|null
Return values
$thissetTranslations()
public
setTranslations(Collection<int, TTranslation>|array<int, TTranslation> $translations) : $this
Parameters
- $translations : Collection<int, TTranslation>|array<int, TTranslation>
Return values
$thissetUser()
public
setUser(TUser|null $user) : $this
Parameters
- $user : TUser|null
Return values
$thissetUserId()
public
setUserId(int|null $userId) : $this
Parameters
- $userId : int|null
Return values
$thistagCollectionInit()
public
tagCollectionInit() : void
translationCollectionInit()
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>