Skip to content

Commit d2eca51

Browse files
Update readme
1 parent 589bdec commit d2eca51

File tree

1 file changed

+11
-10
lines changed

1 file changed

+11
-10
lines changed

README.md

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,6 @@ final class UserMapper extends EntityRecordMapper
117117
);
118118
}
119119
}
120-
121120
```
122121

123122
### Nullable Support
@@ -127,8 +126,8 @@ values in your database rows.
127126

128127
### Foreign keys and objects
129128

130-
The orm does not resolve foreign keys and objects automatically,
131-
instead you have to inject the object repository and load as needed:
129+
The ORM does not resolve foreign keys and objects automatically.
130+
Instead, you must inject the object repository and load the object as needed:
132131

133132
```php
134133
return new User(
@@ -142,7 +141,8 @@ return new User(
142141

143142
### Lazy loading
144143

145-
Records can be lazy loaded with `lazyOf` function, which receives an initializer and loads the entry only when any of its properties are called:
144+
Records can be lazy-loaded with the `lazyOf` function, which receives an initializer and loads the entry only when any of its properties are accessed:
145+
146146
```php
147147
/** lazy object */
148148
$address = lazyOf(
@@ -158,24 +158,24 @@ $street = $address->street;
158158

159159
### Solving N+1 problems
160160

161-
N+1 can be solved with `lazyBufferOf` function, it manages buffered and loaded records,
162-
all buffered records are loaded at once when any of the entries are loaded,
163-
and all loaded records are returned right away without additional loader calls
161+
N+1 can be solved with the `lazyBufferOf` function, which manages buffered and loaded records.
162+
All buffered records are loaded at once when any of the entries are accessed,
163+
and all previously loaded records are returned immediately without additional loader calls.
164164

165165
```php
166166
$addressLoader = lazyBufferOf(
167167
/** The class to be loaded */
168168
Address::class,
169169
/** The object list loader */
170170
function (array $bufferedIds) {
171-
listOf($this->addressRepository->loadAllByIds($ids))
171+
listOf($this->addressRepository->loadAllByIds($bufferedIds))
172172
->indexedBy(fn(Address $address) => $address->id)
173-
->entries()
173+
->entries();
174174
},
175175
);
176176

177177
/** lazy object */
178-
$address = $addressLoader->lazyOf($addressId),
178+
$address = $addressLoader->lazyOf($addressId);
179179

180180
/** loaded object */
181181
$street = $address->street;
@@ -261,6 +261,7 @@ Contributions are welcome! If you have ideas, find a bug, or want to improve the
261261
Please follow PSR-12 coding standards and ensure tests pass before submitting changes.
262262

263263
## 🚀 Next steps
264+
264265
- Query builder
265266
- Extend where comparisons
266267

0 commit comments

Comments
 (0)