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
$aclService read-only
private
AclService
$aclService
$emailService read-only
private
Email
$emailService
$pollApprovalForm read-only
private
PollApproval
$pollApprovalForm
$pollCommentMapper read-only
private
PollComment
$pollCommentMapper
$pollForm read-only
private
Poll
$pollForm
$pollMapper read-only
private
Poll
$pollMapper
$pollOptionMapper read-only
private
PollOption
$pollOptionMapper
$translator read-only
private
Translator
$translator
Methods
__construct()
public
__construct(AclService $aclService, Translator $translator, Email $emailService, Poll $pollMapper, PollComment $pollCommentMapper, PollOption $pollOptionMapper, Poll $pollForm, PollApproval $pollApprovalForm) : mixed
Parameters
- $aclService : AclService
- $translator : Translator
- $emailService : Email
- $pollMapper : Poll
- $pollCommentMapper : PollComment
- $pollOptionMapper : PollOption
- $pollForm : Poll
- $pollApprovalForm : PollApproval
approvePoll()
Approves the given poll.
public
approvePoll(Poll $poll) : bool
Parameters
- $poll : Poll
-
The poll to approve
Tags
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
boolcreateComment()
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
Return values
boolcreatePollOption()
public
createPollOption(array<string|int, mixed> $data, Poll $poll) : PollOption
Parameters
- $data : array<string|int, mixed>
- $poll : Poll
Tags
Return values
PollOptiondeletePoll()
Deletes the given poll.
public
deletePoll(Poll $poll) : void
Parameters
- $poll : Poll
-
The poll to delete
Tags
getNewestPoll()
Returns the newest approved poll or null if there is none.
public
getNewestPoll() : Poll|null
Return values
Poll|nullgetPaginatorAdapter()
Returns a paginator adapter for paging through polls.
public
getPaginatorAdapter() : DoctrinePaginator
Return values
DoctrinePaginatorgetPoll()
Retrieves a poll by its id.
public
getPoll(int $pollId) : Poll|null
Parameters
- $pollId : int
-
the id of the poll to retrieve
Tags
Return values
Poll|nullgetPollApprovalForm()
Returns the poll approval form.
public
getPollApprovalForm() : PollApproval
Return values
PollApprovalgetPollDetails()
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
PollgetPollOption()
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|nullgetUnapprovedPolls()
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|nullrequestPoll()
Saves a new poll request.
public
requestPoll(Parameters $data) : bool
Parameters
- $data : Parameters
Tags
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
Tags
Return values
PollCommentsavePollData()
public
savePollData(array<string|int, mixed> $data, Member $user) : Poll
Parameters
- $data : array<string|int, mixed>
- $user : Member
Tags
Return values
PollsubmitVote()
Stores a vote for the current user.
public
submitVote(PollOption|null $pollOption) : bool
Parameters
- $pollOption : PollOption|null
-
The option to vote on
Tags
Return values
bool —indicating whether the vote was submitted