Skip to content

Commit faffb66

Browse files
committed
JT tech review 2
1 parent e1927ee commit faffb66

File tree

2 files changed

+14
-9
lines changed

2 files changed

+14
-9
lines changed

docs/query-builder.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ Chain methods to specify commands and any constraints. Then, chain
4141
the ``get()`` method at the end to run the methods and retrieve the
4242
results. To retrieve only the first matching result, chain the
4343
``first()`` method instead of the ``get()`` method. Starting in
44-
{+odm-long+} v5.0, the query builder returns results as objects.
44+
{+odm-long+} v5.0, the query builder returns results as ``stdClass`` objects.
4545

4646
The following example shows the syntax of a query builder call:
4747

docs/upgrade.txt

Lines changed: 13 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -71,20 +71,25 @@ Version 5.x Breaking Changes
7171

7272
This library version introduces the following breaking changes:
7373

74-
- The query builder returns results as objects, instead of as arrays.
75-
This change requires that you change array access to property access
76-
when interacting with query results.
74+
- The query builder returns results as as ``stdClass`` objects, instead
75+
of as arrays. This change requires that you change array access to
76+
property access when interacting with query results.
7777

7878
The following code shows how to retrieve a query result and access a
79-
property from the result object:
79+
property from the result object in older versions compared to v5.0:
8080

8181
.. code-block:: php
82-
:emphasize-lines: 4
82+
:emphasize-lines: 8
8383

84-
DB::table('accounts')
84+
$document = DB::table('accounts')
8585
->where('name', 'Anita Charles')
86-
->first()
87-
->balance
86+
->first();
87+
88+
// older versions
89+
$document['balance'];
90+
91+
// v5.0
92+
$document->balance;
8893

8994
- In query results, the library converts BSON ``UTCDateTime`` objects to ``Carbon``
9095
date classes, applying the default timezone.

0 commit comments

Comments
 (0)