Votes Tags

You can add the same or different tag for each vote.

Add tags

Election->addVote() Election->addTags()

// Directly with ```addVote``` method (will add it to the Vote object)
$election->addVote($vote, 'Baroque') ; // Please note that a single tag is always created for each vote.
$election->addVote($vote, 'Baroque, Modern') ; // You can also add multiple tags, separated by commas.
$election->addVote($vote, ['Baroque', 'Modern']) ; // You can also add multiple tags, separated by commas.

// Or into the vote object
$vote1 = new Vote ('Bartok > Lully');
$election->addVote($vote1);
$vote1->addTags('Charlie');

// With vote object constructor
new Vote ('Bartok > Lully', 'Baroque');
new Vote ('Bartok > Lully', ['Baroque', 'Modern']);
new Vote ('Bartok > Lully', 'Baroque, Modern'); // With commas

Remove tags

Election->removeTags() Election->removeTags()

$vote = new Vote ('Bartok > Lully > Haendel');
$vote->addTags(['Baroque', 'Modern']);
$vote->setRanking('Lully > Haendel');
$vote->removeTags('Modern');
$vote->getTags(); // ['Baroque']

Go Further