PageSection
extends BaseEntity
in package
implements
IdentifiableInterface
uses
IdentifiableTrait, TranslationCollectionTrait
Page section (`page_sections`): a named HTML block inserted into templates by key (`homepage-how`, `cta-providers` ...), replacing blocks hard-written in templates. No own URL, no tree, no order; it is addressed only by the key.
IMPORTANT: content is printed unescaped on the front end (|noescape); rich-text editor
content ("raw" mode) goes through 1:1. Only the admin under RBAC may fill the field, never
visitor input; otherwise it is an XSS hole.
IMPORTANT: key is the address the template/component calls by hard-coded name, so it is
not editable after the section is created (renaming would break the templates).
The structure copies Block: a small
standalone entity with translations in _texts. Differences: no company link, key
instead of identifier (not null, unique), no order, active instead of public.
Tags
Attributes
- #[MappedSuperclass]
- #[TableAlias]
- $alias: 'pageSection'
Table of Contents
Interfaces
- IdentifiableInterface
- Entity with a simple integer primary key. Most entities have one (often via {@see \App\Core\Traits\Shared\Models\Entities\IdentifiableTrait}); texts and links with a composite key do not, which is why `getId()` is not on {@see \App\Core\Base\BaseEntity}. Code that needs the id of a generic entity asks for this interface (parameter type, template bound, `instanceof`).
Properties
- $active : bool
- $deleted : bool
- $id : int|null
- $insertDatetime : DateTime
- $key : string
- $note : string|null
- $translations : Collection<int, TTranslation>
- $updateDatetime : DateTime|null
Methods
- __construct() : mixed
- addTranslation() : $this
- callInitMethods() : void
- Calls `init{TraitName}()` for every used trait that defines such a method.
- getActive() : bool
- getAllTraits() : array<string, string>
- Returns all traits the class uses, including those used by parent classes and nested traits.
- getDeleted() : bool
- getId() : int|null
- getInsertDatetime() : DateTime
- getKey() : string
- getNote() : string|null
- getTranslation() : TTranslation|null
- getTranslations() : Collection<int, TTranslation>
- getUpdateDatetime() : DateTime|null
- isActive() : bool
- isDeleted() : bool
- isPersisted() : bool
- removeTranslation() : $this
- setActive() : $this
- setDeleted() : $this
- setId() : $this
- setInsertDatetime() : $this
- setKey() : $this
- setNote() : $this
- setTranslations() : $this
- setUpdateDatetime() : $this
- translationCollectionInit() : void
- getTraitsRecursive() : array<string, string>
- Walks the trait list recursively and collects nested traits too.
Properties
$active
protected
bool
$active
= true
Attributes
- #[Column]
- $name: 'active'
- $type: 'boolean'
$deleted
protected
bool
$deleted
= false
Attributes
- #[Column]
- $name: 'deleted'
- $type: 'boolean'
$id
protected
int|null
$id
= null
Attributes
- #[Column]
- $name: 'page_section_id'
- $type: 'integer'
- $options: ['unsigned' => true]
- #[GeneratedValue]
- #[Id]
$insertDatetime
protected
DateTime
$insertDatetime
= new DateTime()
Attributes
- #[Column]
- $name: 'insert_datetime'
- $type: 'datetime'
$key
protected
string
$key
= ''
Attributes
- #[Column]
- $name: '`key`'
- $type: 'string'
- $length: 80
$note
protected
string|null
$note
= null
Attributes
- #[Column]
- $name: 'note'
- $type: 'string'
- $length: 255
- $nullable: true
$translations
protected
Collection<int, TTranslation>
$translations
$updateDatetime
protected
DateTime|null
$updateDatetime
= null
Attributes
- #[Column]
- $name: 'update_datetime'
- $type: 'datetime'
- $nullable: true
Methods
__construct()
public
__construct([int|null $id = null ][, string $key = '' ][, string|null $note = null ][, bool $active = true ][, bool $deleted = false ][, DateTime $insertDatetime = new DateTime() ][, DateTime|null $updateDatetime = null ]) : mixed
Parameters
- $id : int|null = null
- $key : string = ''
- $note : string|null = null
- $active : bool = true
- $deleted : bool = false
- $insertDatetime : DateTime = new DateTime()
- $updateDatetime : DateTime|null = null
addTranslation()
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
getActive()
public
getActive() : 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>getDeleted()
public
getDeleted() : bool
Return values
boolgetId()
public
getId() : int|null
Return values
int|nullgetInsertDatetime()
public
getInsertDatetime() : DateTime
Return values
DateTimegetKey()
public
getKey() : string
Return values
stringgetNote()
public
getNote() : string|null
Return values
string|nullgetTranslation()
public
getTranslation(int $langId) : TTranslation|null
Parameters
- $langId : int
Return values
TTranslation|nullgetTranslations()
public
getTranslations() : Collection<int, TTranslation>
Return values
Collection<int, TTranslation>getUpdateDatetime()
public
getUpdateDatetime() : DateTime|null
Return values
DateTime|nullisActive()
public
isActive() : bool
Return values
boolisDeleted()
public
isDeleted() : bool
Return values
boolisPersisted()
public
isPersisted() : bool
Return values
boolremoveTranslation()
public
removeTranslation(TTranslation $translation) : $this
Parameters
- $translation : TTranslation
Return values
$thissetActive()
public
setActive(bool $active) : $this
Parameters
- $active : bool
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
$thissetInsertDatetime()
public
setInsertDatetime(DateTime $insertDatetime) : $this
Parameters
- $insertDatetime : DateTime
Return values
$thissetKey()
public
setKey(string $key) : $this
Parameters
- $key : string
Return values
$thissetNote()
public
setNote(string|null $note) : $this
Parameters
- $note : string|null
Return values
$thissetTranslations()
public
setTranslations(Collection<int, TTranslation>|array<int, TTranslation> $translations) : $this
Parameters
- $translations : Collection<int, TTranslation>|array<int, TTranslation>
Return values
$thissetUpdateDatetime()
public
setUpdateDatetime(DateTime|null $updateDatetime) : $this
Parameters
- $updateDatetime : DateTime|null
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>