AdvertText
extends BaseEntity
in package
implements
TranslationInterface
uses
TranslationLanguageTrait, ActiveTranslationTrait
Language version of an advert's content (`cms_mod_base_advert_texts`).
Derived identity: PK is the advert (parent, #[ORM\Id] on the ManyToOne in the UI variant) +
language. Only the content (htmlCode) is language-dependent; links, alt texts and images are
part of the HTML, so there are no separate URL/alt columns. Placement, validity, counters,
activity and order stay on Advert.
The front end picks the translation via TranslationFallback::resolve(): the active translation of the page language, then of the locale's default language; if neither exists, the advert is not rendered (same rule as page sections).
Attributes
- #[MappedSuperclass]
- #[TableAlias]
- $alias: 'advertText'
Table of Contents
Interfaces
- TranslationInterface
- Translation entity (`*Text`): one row of parent texts for one language.
Properties
- $activeTranslation : bool
- $htmlCode : string
- $languageId : int|null
- $parent : object|null
- Parent entity of the translation (the second part of the derived identity next to `languageId`).
Methods
- __construct() : mixed
- callInitMethods() : void
- Calls `init{TraitName}()` for every used trait that defines such a method.
- getActiveTranslation() : bool
- getAllTraits() : array<string, string>
- Returns all traits the class uses, including those used by parent classes and nested traits.
- getHtmlCode() : string
- getLanguageId() : int|null
- Translation language; null only for a new entity before `setLanguageId()`.
- getParent() : object|null
- isActiveTranslation() : bool
- setActiveTranslation() : $this
- setHtmlCode() : $this
- setLanguageId() : $this
- setParent() : static
- getTraitsRecursive() : array<string, string>
- Walks the trait list recursively and collects nested traits too.
Properties
$activeTranslation
protected
bool
$activeTranslation
= true
Attributes
- #[Column]
- $name: 'active_translation'
- $type: 'boolean'
$htmlCode
protected
string
$htmlCode
= ''
Attributes
- #[Column]
- $name: 'html_code'
- $type: 'text'
$languageId
protected
int|null
$languageId
= null
Attributes
- #[Column]
- $name: 'cms_system_languages_language_id'
- $type: 'integer'
- $options: ['unsigned' => true]
- #[Id]
- #[Identity]
$parent
Parent entity of the translation (the second part of the derived identity next to `languageId`).
protected
object|null
$parent
= null
The property is untyped on purpose: the UI variant supplies the concrete type and ORM mapping
by redeclaring protected $parent = null;, as *Rel join entities do. The null default
prevents a "typed property must not be accessed before initialization" error when the identity
is read.
Methods
__construct()
public
__construct([int|null $languageId = null ][, string $htmlCode = '' ][, bool $activeTranslation = true ]) : mixed
Parameters
- $languageId : int|null = null
- $htmlCode : string = ''
- $activeTranslation : bool = true
callInitMethods()
Calls `init{TraitName}()` for every used trait that defines such a method.
public
callInitMethods() : void
getActiveTranslation()
public
getActiveTranslation() : 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>getHtmlCode()
public
getHtmlCode() : string
Return values
stringgetLanguageId()
Translation language; null only for a new entity before `setLanguageId()`.
public
getLanguageId() : int|null
Return values
int|nullgetParent()
public
getParent() : object|null
Return values
object|nullisActiveTranslation()
public
isActiveTranslation() : bool
Return values
boolsetActiveTranslation()
public
setActiveTranslation(bool $activeTranslation) : $this
Parameters
- $activeTranslation : bool
Return values
$thissetHtmlCode()
public
setHtmlCode(string $htmlCode) : $this
Parameters
- $htmlCode : string
Return values
$thissetLanguageId()
public
setLanguageId(int $languageId) : $this
Parameters
- $languageId : int
Return values
$thissetParent()
public
setParent(object|null $parent) : static
Parameters
- $parent : object|null
Return values
staticgetTraitsRecursive()
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>