|
5 | 5 |
|
6 | 6 | use Cake\Collection\CollectionInterface; |
7 | 7 | use Cake\Datasource\EntityInterface; |
| 8 | +use Cake\Datasource\ResultSetInterface; |
8 | 9 | use Cake\Http\ServerRequest; |
9 | 10 | use Cake\ORM\Entity; |
10 | | -use Cake\ORM\ResultSet; |
11 | 11 | use Cake\Utility\Inflector; |
12 | 12 | use Cake\View\Helper\PaginatorHelper; |
13 | 13 | use MixerApi\Core\View\SerializableAssociation; |
@@ -45,7 +45,7 @@ public function __construct(mixed $serialize, ?ServerRequest $request = null, ?P |
45 | 45 |
|
46 | 46 | $hal = $this->recursion($serialize); |
47 | 47 |
|
48 | | - if ($hal instanceof ResultSet) { |
| 48 | + if ($hal instanceof ResultSetInterface) { |
49 | 49 | $this->data = $this->collection($hal); |
50 | 50 | } elseif (is_subclass_of($hal, Entity::class)) { |
51 | 51 | $this->data = $this->item($hal); |
@@ -87,20 +87,20 @@ public function getData(): ?array |
87 | 87 | * HAL resources, but does not serialize the data. |
88 | 88 | * |
89 | 89 | * @param mixed $mixed data to be serialized |
90 | | - * @return array|\Cake\Datasource\EntityInterface|\Cake\ORM\ResultSet |
| 90 | + * @return array|\Cake\Datasource\EntityInterface|\Cake\Datasource\ResultSetInterface |
91 | 91 | */ |
92 | 92 | private function recursion(mixed &$mixed): mixed |
93 | 93 | { |
94 | | - if ($mixed instanceof ResultSet || is_array($mixed)) { |
95 | | - foreach ($mixed as $x => $item) { |
| 94 | + if ($mixed instanceof ResultSetInterface || is_array($mixed)) { |
| 95 | + foreach ($mixed as $item) { |
96 | 96 | $this->recursion($item); |
97 | 97 | } |
98 | 98 | } elseif ($mixed instanceof EntityInterface) { |
99 | 99 | $serializableAssociation = new SerializableAssociation($mixed); |
100 | 100 |
|
101 | 101 | $mixed = $this->resource($mixed, $serializableAssociation); |
102 | 102 |
|
103 | | - foreach ($serializableAssociation->getAssociations() as $property => $value) { |
| 103 | + foreach ($serializableAssociation->getAssociations() as $value) { |
104 | 104 | $this->recursion($value); |
105 | 105 | } |
106 | 106 | } |
|
0 commit comments