Documentation

Poll
in package

Poll service.

Table of Contents

Properties

$aclService  : AclService
$emailService  : Email
$pollApprovalForm  : PollApproval
$pollCommentMapper  : PollComment
$pollForm  : Poll
$pollMapper  : Poll
$pollOptionMapper  : PollOption
$translator  : Translator

Methods

__construct()  : mixed
approvePoll()  : bool
Approves the given poll.
canVote()  : bool
Determines whether the current user can vote on the given poll.
createComment()  : bool
Creates a comment on the given poll.
createPollOption()  : PollOption
deletePoll()  : void
Deletes the given poll.
getNewestPoll()  : Poll|null
Returns the newest approved poll or null if there is none.
getPaginatorAdapter()  : DoctrinePaginator
Returns a paginator adapter for paging through polls.
getPoll()  : Poll|null
Retrieves a poll by its id.
getPollApprovalForm()  : PollApproval
Returns the poll approval form.
getPollDetails()  : PollVote}
Returns details about a poll.
getPollForm()  : Poll
Returns the poll request/creation form.
getPollOption()  : PollOption|null
Retrieves a poll option by its id.
getUnapprovedPolls()  : array<string|int, Poll>
Returns all polls which are awaiting approval.
getVote()  : PollVote|null
Retrieves the current user's vote for a given poll.
requestPoll()  : bool
Saves a new poll request.
saveCommentData()  : PollComment
Save data for a poll comment.
savePollData()  : Poll
submitVote()  : bool
Stores a vote for the current user.

Properties

$emailService read-only

private Email $emailService

$pollMapper read-only

private Poll $pollMapper

$translator read-only

private Translator $translator

Methods

approvePoll()

Approves the given poll.

public approvePoll(Poll $poll) : bool
Parameters
$poll : Poll

The poll to approve

Tags
throws
ORMException
Return values
bool

indicating whether the approval succeeded

canVote()

Determines whether the current user can vote on the given poll.

public canVote(Poll $poll) : bool
Parameters
$poll : Poll
Return values
bool

createComment()

Creates a comment on the given poll.

public createComment(Poll $poll, array<string|int, mixed> $data) : bool
Parameters
$poll : Poll
$data : array<string|int, mixed>
Tags
throws
ORMException
phpcsSuppress

SlevomatCodingStandard.TypeHints.ParameterTypeHint.MissingTraversableTypeHintSpecification

Return values
bool

createPollOption()

public createPollOption(array<string|int, mixed> $data, Poll $poll) : PollOption
Parameters
$data : array<string|int, mixed>
$poll : Poll
Tags
phpcsSuppress

SlevomatCodingStandard.TypeHints.ParameterTypeHint.MissingTraversableTypeHintSpecification

Return values
PollOption

deletePoll()

Deletes the given poll.

public deletePoll(Poll $poll) : void
Parameters
$poll : Poll

The poll to delete

Tags
throws
ORMException

getNewestPoll()

Returns the newest approved poll or null if there is none.

public getNewestPoll() : Poll|null
Return values
Poll|null

getPaginatorAdapter()

Returns a paginator adapter for paging through polls.

public getPaginatorAdapter() : DoctrinePaginator
Return values
DoctrinePaginator

getPoll()

Retrieves a poll by its id.

public getPoll(int $pollId) : Poll|null
Parameters
$pollId : int

the id of the poll to retrieve

Tags
throws
NotAllowedException

if the user isn't allowed to see unapproved polls.

Return values
Poll|null

getPollDetails()

Returns details about a poll.

public getPollDetails(Poll|null $poll) : PollVote}
Parameters
$poll : Poll|null
Return values
PollVote}

getPollForm()

Returns the poll request/creation form.

public getPollForm() : Poll
Return values
Poll

getPollOption()

Retrieves a poll option by its id.

public getPollOption(int $optionId) : PollOption|null
Parameters
$optionId : int

The id of the poll option to retrieve

Return values
PollOption|null

getUnapprovedPolls()

Returns all polls which are awaiting approval.

public getUnapprovedPolls() : array<string|int, Poll>
Return values
array<string|int, Poll>

getVote()

Retrieves the current user's vote for a given poll.

public getVote(Poll $poll) : PollVote|null

Returns null if the user hasn't voted on the poll.

Parameters
$poll : Poll
Return values
PollVote|null

requestPoll()

Saves a new poll request.

public requestPoll(Parameters $data) : bool
Parameters
$data : Parameters
Tags
throws
ORMException
Return values
bool

indicating whether the request succeeded

saveCommentData()

Save data for a poll comment.

public saveCommentData(array<string|int, mixed> $data, Poll $poll, Member $user) : PollComment
Parameters
$data : array<string|int, mixed>
$poll : Poll
$user : Member
Tags
throws
ORMException
phpcsSuppress

SlevomatCodingStandard.TypeHints.ParameterTypeHint.MissingTraversableTypeHintSpecification

Return values
PollComment

savePollData()

public savePollData(array<string|int, mixed> $data, Member $user) : Poll
Parameters
$data : array<string|int, mixed>
$user : Member
Tags
throws
ORMException
phpcsSuppress

SlevomatCodingStandard.TypeHints.ParameterTypeHint.MissingTraversableTypeHintSpecification

Return values
Poll

submitVote()

Stores a vote for the current user.

public submitVote(PollOption|null $pollOption) : bool
Parameters
$pollOption : PollOption|null

The option to vote on

Tags
throws
ORMException
Return values
bool

indicating whether the vote was submitted


        
On this page

Search results