Skip to content

Commit

Permalink
Fix remaining deprecations
Browse files Browse the repository at this point in the history
  • Loading branch information
markstory committed Jul 26, 2023
1 parent 6a8570e commit 3d684a8
Show file tree
Hide file tree
Showing 7 changed files with 15 additions and 13 deletions.
3 changes: 1 addition & 2 deletions src/Command/CleanupCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,7 @@ public function execute(Arguments $args, ConsoleIo $io)
$io->verbose("Going to remove tasks older than {$expires->toDateTimeString()}");

$tasks = $this->fetchTable('Tasks');
$query = $tasks->query()
->delete()
$query = $tasks->deleteQuery()
->where([
'Tasks.deleted_at IS NOT' => null,
'Tasks.deleted_at <' => $expires,
Expand Down
3 changes: 3 additions & 0 deletions src/Controller/AppController.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@

namespace App\Controller;

use App\Model\Table\ProjectsTable;
use Authentication\Authenticator\SessionAuthenticator;
use Cake\Controller\Controller;
use Cake\Event\EventInterface;
Expand All @@ -26,6 +27,8 @@ class AppController extends Controller
beforeRender as protected inertiaBeforeRender;
}

public ProjectsTable $Projects;

/**
* Initialization hook method.
*
Expand Down
9 changes: 6 additions & 3 deletions src/Controller/ProjectsController.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,21 +4,24 @@
namespace App\Controller;

use App\Model\Entity\Project;
use App\Model\Table\ProjectsTable;
use App\Model\Table\TasksTable;
use Cake\View\JsonView;
use InvalidArgumentException;

/**
* Projects Controller
*
* @property \App\Model\Table\TasksTable $Tasks
* @property \App\Model\Table\ProjectsTable $Projects
*/
class ProjectsController extends AppController
{
public TasksTable $Tasks;
public ProjectsTable $Projects;

public function initialize(): void
{
parent::initialize();
$this->loadModel('Tasks');
$this->loadModel('Projects');
}

public function viewClasses(): array
Expand Down
4 changes: 1 addition & 3 deletions src/Model/Table/SimpleSortable.php
Original file line number Diff line number Diff line change
Expand Up @@ -53,9 +53,7 @@ public function move(EntityInterface $record, $newIndex, array $scopeConditions)
$targetOffset = $currentTask->get($field);
}

$query = $this->table->query()
->update()
->where($scopeConditions);
$query = $this->table->updateQuery()->where($scopeConditions);

$current = $record->get($field);
$record->set($field, $targetOffset);
Expand Down
5 changes: 2 additions & 3 deletions src/Model/Table/TasksTable.php
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,7 @@ public function find(string $type = 'all', array $options = []): Query
{
// Add the default deleted condition unless the `deleted` option is set.
$operator = empty($options['deleted']) ? 'IS' : 'IS NOT';
$query = $this->query()->select();
$query = $this->selectQuery();
$query->where(["Tasks.deleted_at {$operator}" => null]);

return $this->callFinder($type, $query, $options);
Expand Down Expand Up @@ -353,8 +353,7 @@ public function move(Task $item, array $operation)
$targetOffset = $result->max + 1;
}

$query = $this->query()
->update()
$query = $this->updateQuery()
->innerJoinWith('Projects')
->where($conditions);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
namespace App\Test\TestCase\Command;

use App\Test\TestCase\FactoryTrait;
use Cake\Console\TestSuite\ConsoleIntegrationTestTrait;
use Cake\ORM\TableRegistry;
use Cake\TestSuite\ConsoleIntegrationTestTrait;
use Cake\TestSuite\TestCase;

/**
Expand Down
2 changes: 1 addition & 1 deletion tests/TestCase/Command/CleanupCommandTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
namespace App\Test\TestCase\Command;

use App\Test\TestCase\FactoryTrait;
use Cake\Console\TestSuite\ConsoleIntegrationTestTrait;
use Cake\I18n\FrozenTime;
use Cake\TestSuite\ConsoleIntegrationTestTrait;
use Cake\TestSuite\TestCase;

/**
Expand Down

0 comments on commit 3d684a8

Please sign in to comment.