diff --git a/composer.json b/composer.json index 10a464fa..88efd7c9 100755 --- a/composer.json +++ b/composer.json @@ -43,7 +43,7 @@ "dereuromark/cakephp-ide-helper": "^2.0.0", "dereuromark/cakephp-templating": "^0.2.7", "dereuromark/cakephp-tools": "^3.12.0", - "dereuromark/cakephp-dto": "^2.1.0", + "dereuromark/cakephp-dto": "^3.0.0", "fig-r/psr2r-sniffer": "dev-master", "friendsofcake/search": "^7.7.0", "phpunit/phpunit": "^11.5 || ^12.1 || ^13.0" @@ -54,7 +54,8 @@ "friendsofcake/search": "For admin backend and filtering of current jobs." }, "conflict": { - "cakephp/migrations": "<4.5" + "cakephp/migrations": "<4.5", + "dereuromark/cakephp-dto": "<3.0.0" }, "minimum-stability": "stable", "prefer-stable": true, diff --git a/src/Model/Table/QueuedJobsTable.php b/src/Model/Table/QueuedJobsTable.php index ab4398d8..d94e07ae 100644 --- a/src/Model/Table/QueuedJobsTable.php +++ b/src/Model/Table/QueuedJobsTable.php @@ -14,8 +14,8 @@ use Cake\ORM\Query\SelectQuery; use Cake\ORM\Table; use Cake\Validation\Validator; -use CakeDto\Dto\FromArrayToArrayInterface; use InvalidArgumentException; +use PhpCollective\Dto\Dto\FromArrayToArrayInterface; use Queue\Config\JobConfig; use Queue\Model\Entity\QueuedJob; use Queue\Model\Filter\QueuedJobsCollection; @@ -205,7 +205,7 @@ public function createJob(string $jobTask, array|object|null $data = null, array $config = $this->createConfig()->fromArray($config); } - if ($data instanceof FromArrayToArrayInterface) { + if (interface_exists(FromArrayToArrayInterface::class) && $data instanceof FromArrayToArrayInterface) { $data = $data->toArray(); } elseif (is_object($data) && method_exists($data, 'toArray')) { $data = $data->toArray(); diff --git a/tests/test_app/src/Dto/MyTaskDto.php b/tests/test_app/src/Dto/MyTaskDto.php index 81741f10..ff3169d7 100644 --- a/tests/test_app/src/Dto/MyTaskDto.php +++ b/tests/test_app/src/Dto/MyTaskDto.php @@ -3,7 +3,7 @@ namespace TestApp\Dto; -use CakeDto\Dto\FromArrayToArrayInterface; +use PhpCollective\Dto\Dto\FromArrayToArrayInterface; class MyTaskDto implements FromArrayToArrayInterface {