PollOption
in package
implements
ResourceInterface
uses
IdentifiableTrait
Poll Option.
Attributes
- #[Entity]
Table of Contents
Interfaces
- ResourceInterface
Properties
- $anonymousVotes : int
- $id : int|null
- The default value must be `null` to prevent issues with auto generating the value. The column is strictly not nullable.
- $poll : Poll
- Referenced poll.
- $text : FrontpageLocalisedText
- The localised text for this option.
- $votes : Collection<string|int, PollVote>
- Votes for this option.
Methods
- addVote() : void
- Adds a new vote for this poll option.
- getAnonymousVotes() : int
- getId() : int|null
- Get the identifier of the object.
- getPoll() : Poll
- getResourceId() : string
- Get the resource ID.
- getText() : FrontpageLocalisedText
- getVotesCount() : int
- Get the number of votes for this poll option.
- setAnonymousVotes() : void
- setId() : void
- Setting the identifier manually will, in most instances, result in undefined behaviour. Use with caution!
- setPoll() : void
- setText() : void
Properties
$anonymousVotes
protected
int
$anonymousVotes
= 0
Attributes
- #[Column]
- $type: 'integer'
- $options: ['default' => 0]
$id
The default value must be `null` to prevent issues with auto generating the value. The column is strictly not nullable.
protected
int|null
$id
= null
Attributes
- #[Column]
- $type: 'integer'
- #[GeneratedValue]
- $strategy: 'IDENTITY'
- #[Id]
$poll
Referenced poll.
protected
Poll
$poll
Attributes
- #[JoinColumn]
- $name: 'poll_id'
- $referencedColumnName: 'id'
- $nullable: false
- #[ManyToOne]
- $targetEntity: \Frontpage\Model\Poll::class
- $inversedBy: 'options'
- $cascade: ['persist']
$text
The localised text for this option.
protected
FrontpageLocalisedText
$text
Attributes
- #[JoinColumn]
- $name: 'text_id'
- $referencedColumnName: 'id'
- $nullable: false
- #[OneToOne]
- $targetEntity: \Frontpage\Model\FrontpageLocalisedText::class
- $cascade: ['persist', 'remove']
- $orphanRemoval: true
$votes
Votes for this option.
protected
Collection<string|int, PollVote>
$votes
Attributes
- #[OneToMany]
- $targetEntity: \Frontpage\Model\PollVote::class
- $mappedBy: 'pollOption'
- $cascade: ['persist', 'remove']
- $fetch: 'EXTRA_LAZY'
Methods
addVote()
Adds a new vote for this poll option.
public
addVote(PollVote $pollVote) : void
Parameters
- $pollVote : PollVote
getAnonymousVotes()
public
getAnonymousVotes() : int
Return values
intgetId()
Get the identifier of the object.
public
getId() : int|null
Tags
Return values
int|nullgetPoll()
public
getPoll() : Poll
Return values
PollgetResourceId()
Get the resource ID.
public
getResourceId() : string
Return values
stringgetText()
public
getText() : FrontpageLocalisedText
Return values
FrontpageLocalisedTextgetVotesCount()
Get the number of votes for this poll option.
public
getVotesCount() : int
Return values
intsetAnonymousVotes()
public
setAnonymousVotes(int $anonymousVotes) : void
Parameters
- $anonymousVotes : int
setId()
Setting the identifier manually will, in most instances, result in undefined behaviour. Use with caution!
public
setId(int|null $id) : void
Parameters
- $id : int|null
setPoll()
public
setPoll(Poll $poll) : void
Parameters
- $poll : Poll
setText()
public
setText(FrontpageLocalisedText $text) : void
Parameters
- $text : FrontpageLocalisedText