Skip to content

Commit 88b9756

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

File tree

1 file changed

+12
-0
lines changed
  • user_guide_src/source/models/model

1 file changed

+12
-0
lines changed

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' => 'john@example.com'],
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` = 'john@example.com' LIMIT 1;
13+
//
14+
// 2) If no result is found, it inserts a new record:
15+
// INSERT INTO `users` (`email`, `name`, `country`)
16+
// VALUES ('john@example.com', '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)