Skip to content

Commit 88b9756

Browse files
committed
add a comment to the code example
1 parent 15c2b5a commit 88b9756

1 file changed

Lines changed: 12 additions & 0 deletions

File tree

  • user_guide_src/source/models/model

user_guide_src/source/models/model/065.php

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,3 +5,15 @@
55
['email' => '[email protected]'],
66
['name' => 'John Doe', 'country' => 'US'],
77
);
8+
9+
// The above will trigger:
10+
//
11+
// 1) First it tries to find the record:
12+
// SELECT * FROM `users` WHERE `email` = '[email protected]' LIMIT 1;
13+
//
14+
// 2) If no result is found, it inserts a new record:
15+
// INSERT INTO `users` (`email`, `name`, `country`)
16+
// VALUES ('[email protected]', 'John Doe', 'US');
17+
//
18+
// 3) Then it returns the found or newly created entity/row,
19+
// or false if something went wrong

0 commit comments

Comments
 (0)