Skip to content

Commit 907be37

Browse files
authored
Bump dto to v3 (#502)
* Bump dto to v3 * Keep dto interface optional at runtime * Conflict with old dto major
1 parent c941aea commit 907be37

3 files changed

Lines changed: 6 additions & 5 deletions

File tree

composer.json

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@
4343
"dereuromark/cakephp-ide-helper": "^2.0.0",
4444
"dereuromark/cakephp-templating": "^0.2.7",
4545
"dereuromark/cakephp-tools": "^3.12.0",
46-
"dereuromark/cakephp-dto": "^2.1.0",
46+
"dereuromark/cakephp-dto": "^3.0.0",
4747
"fig-r/psr2r-sniffer": "dev-master",
4848
"friendsofcake/search": "^7.7.0",
4949
"phpunit/phpunit": "^11.5 || ^12.1 || ^13.0"
@@ -54,7 +54,8 @@
5454
"friendsofcake/search": "For admin backend and filtering of current jobs."
5555
},
5656
"conflict": {
57-
"cakephp/migrations": "<4.5"
57+
"cakephp/migrations": "<4.5",
58+
"dereuromark/cakephp-dto": "<3.0.0"
5859
},
5960
"minimum-stability": "stable",
6061
"prefer-stable": true,

src/Model/Table/QueuedJobsTable.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,8 @@
1414
use Cake\ORM\Query\SelectQuery;
1515
use Cake\ORM\Table;
1616
use Cake\Validation\Validator;
17-
use CakeDto\Dto\FromArrayToArrayInterface;
1817
use InvalidArgumentException;
18+
use PhpCollective\Dto\Dto\FromArrayToArrayInterface;
1919
use Queue\Config\JobConfig;
2020
use Queue\Model\Entity\QueuedJob;
2121
use Queue\Model\Filter\QueuedJobsCollection;
@@ -205,7 +205,7 @@ public function createJob(string $jobTask, array|object|null $data = null, array
205205
$config = $this->createConfig()->fromArray($config);
206206
}
207207

208-
if ($data instanceof FromArrayToArrayInterface) {
208+
if (interface_exists(FromArrayToArrayInterface::class) && $data instanceof FromArrayToArrayInterface) {
209209
$data = $data->toArray();
210210
} elseif (is_object($data) && method_exists($data, 'toArray')) {
211211
$data = $data->toArray();

tests/test_app/src/Dto/MyTaskDto.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33

44
namespace TestApp\Dto;
55

6-
use CakeDto\Dto\FromArrayToArrayInterface;
6+
use PhpCollective\Dto\Dto\FromArrayToArrayInterface;
77

88
class MyTaskDto implements FromArrayToArrayInterface {
99

0 commit comments

Comments
 (0)