CoolCMS API

TranslationLanguageTrait

Accessors of a translation entity (`*Text`) with a derived identity.

The PK is the language (languageId) plus the association to the parent (#[ORM\Id] on the many-to-one in the UI variant). The scalar id (the foreign key to the parent) is not mapped; Doctrine derives the identity from the association, so getId() and setId() are intentionally absent. Doctrine orders the inserts (parent, then child) even for a new entity from a cascade-persisted association.

Table of Contents

Properties

$parent  : object|null
Parent entity of the translation (the second part of the derived identity next to `languageId`).

Methods

getLanguageId()  : int|null
Translation language; null only for a new entity before `setLanguageId()`.
getParent()  : object|null
setLanguageId()  : $this
setParent()  : static

Properties

$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

getLanguageId()

Translation language; null only for a new entity before `setLanguageId()`.

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

setLanguageId()

public setLanguageId(int $languageId) : $this
Parameters
$languageId : int
Return values
$this

setParent()

public setParent(object|null $parent) : static
Parameters
$parent : object|null
Return values
static
On this page

Search results