Skip to content

Commit 84db126

Browse files
committed
Fix incorrect method name findUnhydrated in 5.4 docs
The ORM method is Table::unhydratedFind(), not findUnhydrated(). The 5.4 migration guide, release notes and the retrieving-data guide referenced the wrong name, so copy-pasting produced a Call to undefined method error.
1 parent 22f9822 commit 84db126

2 files changed

Lines changed: 12 additions & 12 deletions

File tree

docs/en/appendices/5-4-migration-guide.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,7 @@ events are now registered while each plugin is bootstrapped.
106106
### ORM
107107

108108
- `SelectQuery::disableHydration()` has been deprecated. Use
109-
[`Table::findUnhydrated()`](../orm/retrieving-data-and-resultsets#getting-arrays-instead-of-entities)
109+
[`Table::unhydratedFind()`](../orm/retrieving-data-and-resultsets#getting-arrays-instead-of-entities)
110110
instead, which returns an `UnhydratedSelectQuery` whose static type matches the
111111
array result shape. `disableHydration()` will be removed in 6.0.
112112

@@ -219,7 +219,7 @@ events are now registered while each plugin is bootstrapped.
219219
- The `associated` option in `newEntity()` and `patchEntity()` now supports
220220
nested array format matching `contain()` syntax.
221221
See [Converting Request Data into Entities](../orm/saving-data#converting-request-data-into-entities).
222-
- Added `Table::findUnhydrated()` and the `UnhydratedSelectQuery` class for
222+
- Added `Table::unhydratedFind()` and the `UnhydratedSelectQuery` class for
223223
type-safe non-hydrated reads. Unlike `find()->disableHydration()`, the
224224
returned query's static type matches its array result shape, so static
225225
analyzers no longer see `entity|array` on `first()`, `all()`, `toArray()`

docs/en/orm/retrieving-data-and-resultsets.md

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -184,23 +184,23 @@ methods will let you re-use your queries and make testing easier.
184184
### Getting Arrays Instead of Entities
185185

186186
By default, queries and result sets return [Entities](../orm/entities) objects.
187-
When you only need plain arrays, use `findUnhydrated()` instead of `find()`:
187+
When you only need plain arrays, use `unhydratedFind()` instead of `find()`:
188188

189189
```php
190-
$query = $articles->findUnhydrated();
190+
$query = $articles->unhydratedFind();
191191

192192
// $data is a ResultSet that contains array data.
193193
$data = $query->all();
194194

195195
// Terminal methods are typed as arrays too.
196-
$row = $articles->findUnhydrated()->where(['id' => 1])->first(); // array<string, mixed>|null
196+
$row = $articles->unhydratedFind()->where(['id' => 1])->first(); // array<string, mixed>|null
197197
```
198198

199-
`findUnhydrated()` accepts the same finder type and arguments as `find()`, so
199+
`unhydratedFind()` accepts the same finder type and arguments as `find()`, so
200200
your existing [custom finders](#custom-find-methods) are reused unchanged:
201201

202202
```php
203-
$rows = $articles->findUnhydrated('published')->all();
203+
$rows = $articles->unhydratedFind('published')->all();
204204
```
205205

206206
It returns a `Cake\ORM\Query\UnhydratedSelectQuery`. This behaves exactly like
@@ -210,14 +210,14 @@ result shape, so static analyzers no longer see `entity|array` on `first()`,
210210
flows through a custom finder.
211211

212212
> [!NOTE]
213-
> `findUnhydrated()` only changes the result shape for row-returning finders.
213+
> `unhydratedFind()` only changes the result shape for row-returning finders.
214214
> `findList()` and `findThreaded()` produce a key/value map or nested tree
215215
> regardless of hydration, so there is nothing to type differently for them.
216216
217217
> [!WARNING]
218218
> `SelectQuery::disableHydration()` is deprecated as of 5.4.0 and will be
219219
> removed in 6.0. The fluent toggle returns a query whose static type still
220-
> claims to produce entities; prefer `findUnhydrated()` instead.
220+
> claims to produce entities; prefer `unhydratedFind()` instead.
221221
222222
<a id="table-find-first"></a>
223223

@@ -1104,7 +1104,7 @@ section show how you can add calculated fields, or replace the result set.
11041104
> Depending on your use case, you may also consider skipping hydration:
11051105
>
11061106
> ``` bash
1107-
> $results = $articles->findUnhydrated()
1107+
> $results = $articles->unhydratedFind()
11081108
> ->all();
11091109
> ```
11101110
>
@@ -1274,7 +1274,7 @@ $reducer = function ($occurrences, $word, $mapReduce) {
12741274
Finally, we put everything together:
12751275
12761276
```php
1277-
$wordCount = $articles->findUnhydrated()
1277+
$wordCount = $articles->unhydratedFind()
12781278
->where(['published' => true])
12791279
->andWhere(['published_date >=' => new DateTime('2014-01-01')])
12801280
->mapReduce($mapper, $reducer)
@@ -1346,7 +1346,7 @@ $reducer = function ($friends, $user, $mr) {
13461346
And we supply our functions to a query:
13471347
13481348
```php
1349-
$fakeFriends = $friends->findUnhydrated()
1349+
$fakeFriends = $friends->unhydratedFind()
13501350
->mapReduce($mapper, $reducer)
13511351
->all()
13521352
->toArray();

0 commit comments

Comments
 (0)