Skip to content

Commit 2d4dad1

Browse files
BurntimeXdtdesign
andauthored
Apply suggestions from code review
Co-authored-by: Alexander Ebert <[email protected]>
1 parent 38aaffb commit 2d4dad1

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

docs/php/database-objects.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -175,10 +175,10 @@ A Database Object Collection is a container for a group of `DatabaseObject` inst
175175

176176
### Motivation
177177

178-
Some database objects require extra runtime data (e.g., a UserProfile or file attachments).
178+
Some database objects require extra runtime data, for example, a `UserProfile` or file attachments.
179179
Loading this data on demand per object is inefficient, as it requires repeated queries for each object.
180180

181-
Earlier approaches (e.g., the Viewable* classes) tried to address this by preloading extra data:
181+
Earlier approaches like the `Viewable*` classes tried to address this by preloading extra data:
182182

183183
- ✅ Efficient in some cases, especially when JOINs are used.
184184
- ❌ Can be wasteful if not all of the extra data is needed.
@@ -192,7 +192,7 @@ A Database Object Collection solves these issues by grouping objects and handlin
192192
- Objects are fetched together as a collection.
193193
- Extra data is not loaded upfront, but on first access.
194194
- When extra data is requested for one object, it is fetched for all objects in the collection at once.
195-
- This balances efficiency with flexibilitydata is only loaded when needed, but subsequent lookups are inexpensive.
195+
- This balances efficiency with flexibilitydata is only loaded when needed, but subsequent lookups are inexpensive.
196196

197197
This leads to the following benefits:
198198

@@ -216,7 +216,7 @@ class FooObject extends CollectionDatabaseObject {
216216
}
217217
```
218218

219-
When instantiating the collection, `CollectionDatabaseObject` searches by default for a class that matches the class name of the database object and contains the suffix `Collection.`
219+
When instantiating the collection, `CollectionDatabaseObject` attempts to find a class with the same name but with the added suffix `Collection`.
220220
However, by overwriting the `getCollectionClassName()` method, you can also use a custom class name.
221221

222222
```php

0 commit comments

Comments
 (0)