Poll
extends Poll
in package
uses
PollPlaceCollectionTrait
Tags
Attributes
- #[Entity]
- #[Table]
- $name: 'cms_mod_base_polls'
- #[TableAlias]
- 'poll'
Table of Contents
Properties
- $active : bool
- $answers : Collection
- $id : int|null
- $placeRels : Collection<int, PollPlaceRel>
- $translations : Collection
Methods
- __construct() : mixed
- addAnswer() : $this
- addPlaceRel() : $this
- addTranslation() : $this
- answerCollectionInit() : void
- 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.
- getAnswer() : TAnswer|null
- getAnswers() : Collection<int, TAnswer>
- getId() : int|null
- getPlaceRels() : Collection<int, TRel>
- getPollPlaces() : Collection<int, TPollPlace>
- Returns the linked poll places, extracted from `placeRels`.
- getTranslation() : TTranslation|null
- getTranslations() : Collection<int, TTranslation>
- isActive() : bool
- isPersisted() : bool
- removeAnswer() : $this
- removeTranslation() : $this
- setActive() : $this
- setAnswers() : $this
- setId() : $this
- setPlaceRels() : $this
- setTranslations() : $this
- translationCollectionInit() : void
- getTraitsRecursive() : array<string, string>
- Walks the trait list recursively and collects nested traits too.
Properties
$active
protected
bool
$active
= false
Attributes
- #[Column]
- $name: 'active'
- $type: 'boolean'
$answers
protected
Collection
$answers
Attributes
- #[OneToMany]
- $targetEntity: \App\UI\Api\Base\Models\Entities\PollAnswer::class
- $mappedBy: 'poll'
- $cascade: ["persist", "remove"]
- $orphanRemoval: true
- $fetch: "LAZY"
- #[OrderBy]
- ['order' => 'ASC']
$id
protected
int|null
$id
= null
Attributes
- #[Column]
- $name: 'poll_id'
- $type: 'integer'
- $options: ['unsigned' => true]
- #[GeneratedValue]
- #[Id]
$placeRels
protected
Collection<int, PollPlaceRel>
$placeRels
Attributes
- #[OneToMany]
- $targetEntity: \App\UI\Api\Base\Models\Entities\PollPlaceRel::class
- $mappedBy: 'poll'
- $cascade: ["persist", "remove"]
- $orphanRemoval: true
- $fetch: "LAZY"
$translations
protected
Collection
$translations
Attributes
- #[OneToMany]
- $targetEntity: \App\UI\Api\Base\Models\Entities\PollText::class
- $mappedBy: 'parent'
- $cascade: ["persist", "remove"]
- $orphanRemoval: true
- $fetch: "LAZY"
Methods
__construct()
public
__construct([int|null $id = null ][, bool $active = false ][, Collection $answers = new ArrayCollection() ][, Collection $translations = new ArrayCollection() ]) : mixed
Parameters
- $id : int|null = null
- $active : bool = false
- $answers : Collection = new ArrayCollection()
- $translations : Collection = new ArrayCollection()
addAnswer()
public
addAnswer(TAnswer $answer) : $this
Parameters
- $answer : TAnswer
Return values
$thisaddPlaceRel()
public
addPlaceRel(TRel $rel) : $this
Parameters
- $rel : TRel
Return values
$thisaddTranslation()
public
addTranslation(TTranslation $translation) : $this
Parameters
- $translation : TTranslation
Return values
$thisanswerCollectionInit()
public
answerCollectionInit() : void
callInitMethods()
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>getAnswer()
public
getAnswer(int $answerId) : TAnswer|null
Parameters
- $answerId : int
Return values
TAnswer|nullgetAnswers()
public
getAnswers() : Collection<int, TAnswer>
Return values
Collection<int, TAnswer>getId()
public
getId() : int|null
Return values
int|nullgetPlaceRels()
public
getPlaceRels() : Collection<int, TRel>
Return values
Collection<int, TRel>getPollPlaces()
Returns the linked poll places, extracted from `placeRels`.
public
getPollPlaces() : Collection<int, TPollPlace>
Return values
Collection<int, TPollPlace>getTranslation()
public
getTranslation(int $langId) : TTranslation|null
Parameters
- $langId : int
Return values
TTranslation|nullgetTranslations()
public
getTranslations() : Collection<int, TTranslation>
Return values
Collection<int, TTranslation>isActive()
public
isActive() : bool
Return values
boolisPersisted()
public
isPersisted() : bool
Return values
boolremoveAnswer()
public
removeAnswer(TAnswer $answer) : $this
Parameters
- $answer : TAnswer
Return values
$thisremoveTranslation()
public
removeTranslation(TTranslation $translation) : $this
Parameters
- $translation : TTranslation
Return values
$thissetActive()
public
setActive(bool $active) : $this
Parameters
- $active : bool
Return values
$thissetAnswers()
public
setAnswers(Collection<int, TAnswer>|array<int, TAnswer> $answers) : $this
Parameters
- $answers : Collection<int, TAnswer>|array<int, TAnswer>
Return values
$thissetId()
public
setId(int|null $id) : $this
Parameters
- $id : int|null
Return values
$thissetPlaceRels()
public
setPlaceRels(Collection<int, TRel>|array<int, TRel> $placeRels) : $this
Parameters
- $placeRels : Collection<int, TRel>|array<int, TRel>
Return values
$thissetTranslations()
public
setTranslations(Collection<int, TTranslation>|array<int, TTranslation> $translations) : $this
Parameters
- $translations : Collection<int, TTranslation>|array<int, TTranslation>
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>