Skip to content

Commit

Permalink
Fix Command cakephp5 tablelocator
Browse files Browse the repository at this point in the history
  • Loading branch information
Ioannis committed Sep 12, 2025
1 parent 8bac2ef commit 8cd636d
Show file tree
Hide file tree
Showing 5 changed files with 21 additions and 1 deletion.
3 changes: 3 additions & 0 deletions app/src/Command/JobCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,12 @@
use Cake\Utility\Security;
use App\Lib\Enum\JobStatusEnum;
use App\Lib\Events\CoIdEventListener;
use Cake\ORM\Locator\LocatorAwareTrait;

class JobCommand extends BaseCommand
{
use LocatorAwareTrait;

/**
* Register command specific options.
*
Expand Down
10 changes: 9 additions & 1 deletion app/src/Command/NotificationCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,13 @@
use Cake\Console\BaseCommand;
use Cake\Console\ConsoleIo;
use Cake\Console\ConsoleOptionParser;
use Cake\ORM\Locator\LocatorAwareTrait;
use Cake\ORM\TableRegistry;

class NotificationCommand extends BaseCommand
{
use LocatorAwareTrait;

/**
* Register command specific options.
*
Expand Down Expand Up @@ -202,6 +206,10 @@ public function execute(Arguments $args, ConsoleIo $io)
$io->out("- Recipient Person ID: " . $recipientPersonId);
$io->out("- Recipient Group ID: " . $recipientGroupId);

$MessageTemplates = TableRegistry::getTableLocator()->get('MessageTemplates');
$template = $MessageTemplates->get($args->getOption('messageTemplateId'));


$notificationIds = $Notifications->register(
subjectPersonId: $subjectPersonId,
subjectGroupId: $subjectGroupId,
Expand All @@ -210,7 +218,7 @@ public function execute(Arguments $args, ConsoleIo $io)
recipientGroupId: $recipientGroupId,
action: $args->getOption('action'),
comment: $args->getOption('comment'),
messageTemplateId: (int)$args->getOption('messageTemplateId'),
messageTemplate: $template,
source: $args->getOption('source'),
mustResolve: $args->getOption('mustResolve')
);
Expand Down
3 changes: 3 additions & 0 deletions app/src/Command/SetupCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,12 @@
use Cake\Utility\Security;
use App\Lib\Enum\PermissionEnum;
use App\Lib\Enum\SuspendableStatusEnum;
use Cake\ORM\Locator\LocatorAwareTrait;

class SetupCommand extends BaseCommand
{
use LocatorAwareTrait;

/**
* Register command specific options.
*
Expand Down
3 changes: 3 additions & 0 deletions app/src/Command/TestCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,12 @@
use Cake\Console\ConsoleOptionParser;
use Cake\Datasource\ConnectionManager;
use \App\Lib\Util\DeliveryUtilities;
use Cake\ORM\Locator\LocatorAwareTrait;

class TestCommand extends BaseCommand
{
use LocatorAwareTrait;

protected $io = null;

/**
Expand Down
3 changes: 3 additions & 0 deletions app/src/Command/UpgradeCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,12 @@
use Cake\Console\ConsoleIo;
use Cake\Console\ConsoleOptionParser;
use Cake\Datasource\ConnectionManager;
use Cake\ORM\Locator\LocatorAwareTrait;

class UpgradeCommand extends BaseCommand
{
use LocatorAwareTrait;

protected $io = null;

// A list of known versions, must be semantic versioning compliant. The value
Expand Down

0 comments on commit 8cd636d

Please sign in to comment.