Issue #3467383 by TR, urvashi_vora: Dependency injection in Drush commands
Compare changes
Files
2@@ -2,11 +2,16 @@
@@ -2,11 +2,16 @@
@@ -16,6 +21,65 @@ use Drupal\votingapi\Entity\Vote;
@@ -16,6 +21,65 @@ use Drupal\votingapi\Entity\Vote;
@@ -67,7 +131,7 @@ class VotingApiDrushCommands extends DrushCommands {
@@ -67,7 +131,7 @@ class VotingApiDrushCommands extends DrushCommands {
@@ -84,10 +148,10 @@ class VotingApiDrushCommands extends DrushCommands {
@@ -84,10 +148,10 @@ class VotingApiDrushCommands extends DrushCommands {
#[CLI\Argument(name: 'vote_type', description: "The type of votes to recalculate, defaults to 'percent'.")]
#[CLI\Usage(name: 'drush voting:recalculate [entity_type]', description: "Regenerates voting results from raw vote data. Defaults to 'node'.")]
public function recalculate(string $entity_type = 'node', ?string $entity_id, string $vote_type = 'vote'): void {
@@ -102,9 +166,8 @@ class VotingApiDrushCommands extends DrushCommands {
@@ -102,9 +166,8 @@ class VotingApiDrushCommands extends DrushCommands {
@@ -115,7 +178,7 @@ class VotingApiDrushCommands extends DrushCommands {
@@ -115,7 +178,7 @@ class VotingApiDrushCommands extends DrushCommands {
@@ -129,10 +192,10 @@ class VotingApiDrushCommands extends DrushCommands {
@@ -129,10 +192,10 @@ class VotingApiDrushCommands extends DrushCommands {
#[CLI\Argument(name: 'entity_type', description: 'The type of entity whose voting data should be flushed.')]
#[CLI\Usage(name: "drush voting:flush [entity_type | 'all']", description: 'Deletes all existing voting data for the specified entity type.')]
@@ -168,18 +231,21 @@ class VotingApiDrushCommands extends DrushCommands {
@@ -168,18 +231,21 @@ class VotingApiDrushCommands extends DrushCommands {
@@ -195,7 +261,7 @@ class VotingApiDrushCommands extends DrushCommands {
@@ -195,7 +261,7 @@ class VotingApiDrushCommands extends DrushCommands {
protected function castVotes(string $entity_type, string $entity_id, int $timestamp = 0, array $uids = [], string $style = 'percent'): void {