Skip to content

Commit 79e177f

Browse files
Tim Bobkertbobker123
authored andcommitted
squash previous commmits - Modify the description of the insert() method.
1 parent c7a47fa commit 79e177f

File tree

2 files changed

+7
-5
lines changed

2 files changed

+7
-5
lines changed

user_guide_src/source/models/model.rst

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -311,13 +311,15 @@ Saving Data
311311
insert()
312312
--------
313313

314-
An associative array of data is passed into this method as the only parameter to create a new
315-
row of data in the database. The array's keys must match the name of the columns in a ``$table``, while
316-
the array's values are the values to save for that key:
314+
The first parametre is an associative array of data to create a new row of data in the database.
315+
If an object is passed instead of an array, it will attempt to convert it to an array.
316+
317+
The array's keys must match the name of the columns in the ```$table```, while the array's values are the values to save for that key:
317318

318319
.. literalinclude:: model/015.php
319320

320-
You can retrieve the last inserted row's primary key using the ``getInsertID()`` method.
321+
The second parametre is of type boolean which determines whether an insert ID should be returned.
322+
If it is omitted, then the default return value is the insert id.
321323

322324
update()
323325
--------

user_guide_src/source/models/model/015.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,4 +5,4 @@
55
'email' => 'd.vader@theempire.com',
66
];
77

8-
$userModel->insert($data);
8+
$userModel->insert($data, bool $returnID = true);

0 commit comments

Comments
 (0)