File tree Expand file tree Collapse file tree 1 file changed +15
-4
lines changed Expand file tree Collapse file tree 1 file changed +15
-4
lines changed Original file line number Diff line number Diff line change @@ -95,11 +95,22 @@ following table describes these methods:
95
95
Transaction Example
96
96
-------------------
97
97
98
- The following code defines the ``transferTxn()`` callback function that
99
- modifies data in the ``saving_accounts``, ``checking_accounts``, and ``receipts``
100
- collections of the ``bank`` database:
98
+ This example defines a callback function that
99
+ modifies data in the collections of the ``bank`` database for a
100
+ banking transaction. The code performs the following actions:
101
+
102
+ - Creates ``Collection`` instances to access the target
103
+ collections.
104
+ - Specifies the account number and amount to be transferred between
105
+ accounts.
106
+ - Defines the callback function, passing the ``Session`` instance as a
107
+ parameter.
108
+ - Updates the customer's balances to reflect the money transfer.
109
+ - Records a receipt of the transaction with a timestamp.
110
+ - Prints a message if the transaction committed successfully.
101
111
102
112
.. literalinclude:: /includes/write/transaction.php
113
+ :copyable:
103
114
:language: php
104
115
:dedent:
105
116
:start-after: begin-callback
@@ -113,10 +124,10 @@ completes the following actions:
113
124
passing the session and the callback as parameters.
114
125
115
126
.. io-code-block::
127
+ :copyable:
116
128
117
129
.. input:: /includes/write/transaction.php
118
130
:language: php
119
- :copyable:
120
131
:dedent:
121
132
:start-after: begin-txn
122
133
:end-before: end-txn
You can’t perform that action at this time.
0 commit comments