You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/php/database-objects.md
+4-4Lines changed: 4 additions & 4 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -175,10 +175,10 @@ A Database Object Collection is a container for a group of `DatabaseObject` inst
175
175
176
176
### Motivation
177
177
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.
179
179
Loading this data on demand per object is inefficient, as it requires repeated queries for each object.
180
180
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:
182
182
183
183
- ✅ Efficient in some cases, especially when JOINs are used.
184
184
- ❌ 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
192
192
- Objects are fetched together as a collection.
193
193
- Extra data is not loaded upfront, but on first access.
194
194
- When extra data is requested for one object, it is fetched for all objects in the collection at once.
195
-
- This balances efficiency with flexibility—data is only loaded when needed, but subsequent lookups are inexpensive.
195
+
- This balances efficiency with flexibility — data is only loaded when needed, but subsequent lookups are inexpensive.
196
196
197
197
This leads to the following benefits:
198
198
@@ -216,7 +216,7 @@ class FooObject extends CollectionDatabaseObject {
216
216
}
217
217
```
218
218
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`.
220
220
However, by overwriting the `getCollectionClassName()` method, you can also use a custom class name.
0 commit comments