Skip to content

Commit 5dafb7c

Browse files
committed
Update XPath Builder::first() method to use limit and offset (find, sort and limit objects service)
1 parent d38d064 commit 5dafb7c

2 files changed

Lines changed: 2 additions & 2 deletions

File tree

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -225,7 +225,7 @@ foreach ($estimates as $estimate) {
225225
}
226226
```
227227

228-
KeyCollection also has a number of useful methods such as `all()`, `paginate()` and `first()`. In fact, the single object find example from earlier is just a shortcut to the `KeyCollection::first()` method.
228+
KeyCollection also has a number of useful methods such as `all()`, `paginate()` and `first()`.
229229

230230
## Relationships
231231

src/XPath/Builder.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -139,7 +139,7 @@ public function find(): KeyCollection
139139
*/
140140
public function first(): ?Model
141141
{
142-
return $this->find()->first();
142+
return $this->model->find($this->toXPath(), $this->toXPathSort(), 0, 1, $this->toFieldDescriptor())->first();
143143
}
144144

145145
/**

0 commit comments

Comments
 (0)