We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent b86320d commit af3f2a8Copy full SHA for af3f2a8
system/API/BaseTransformer.php
@@ -13,7 +13,6 @@
13
14
namespace CodeIgniter\API;
15
16
-use CodeIgniter\Entity\Entity;
17
use CodeIgniter\HTTP\IncomingRequest;
18
use InvalidArgumentException;
19
@@ -103,10 +102,10 @@ public function transform(mixed $resource = null): array
103
102
104
if ($resource === null) {
105
$data = $this->toArray(null);
+ } elseif (is_object($resource) && method_exists($resource, 'toArray')) {
106
+ $data = $this->toArray($resource->toArray());
107
} else {
- $data = $resource instanceof Entity
108
- ? $this->toArray($resource->toArray())
109
- : $this->toArray((array) $resource);
+ $data = $this->toArray((array) $resource);
110
}
111
112
$data = $this->limitFields($data);
0 commit comments