File tree Expand file tree Collapse file tree
user_guide_src/source/database Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -924,6 +924,8 @@ The first parameter is an associative array of values.
924924
925925Here is an example using an object:
926926
927+ .. literalinclude :: query_builder/122.php
928+
927929.. literalinclude :: query_builder/113.php
928930
929931The first parameter is an object.
@@ -1058,6 +1060,8 @@ You can also pass an associative array to this method:
10581060
10591061Or an object:
10601062
1063+ .. literalinclude :: query_builder/077.php
1064+
10611065.. literalinclude :: query_builder/087.php
10621066
10631067$builder->update()
@@ -1071,6 +1075,8 @@ is an example using an array:
10711075
10721076Or you can supply an object:
10731077
1078+ .. literalinclude :: query_builder/077.php
1079+
10741080.. literalinclude :: query_builder/089.php
10751081
10761082.. note :: All values except ``RawSql`` are escaped automatically producing safer queries.
Original file line number Diff line number Diff line change 11<?php
22
3- class Myclass
4- {
5- public $ title = 'My Title ' ;
6- public $ content = 'My Content ' ;
7- public $ date = 'My Date ' ;
8- }
3+ use App \Libraries \MyClass ;
94
10- $ object = new \ Myclass ();
5+ $ object = new MyClass ();
116$ builder ->set ($ object );
127$ builder ->insert ();
Original file line number Diff line number Diff line change 11<?php
22
3- class Myclass
4- {
5- public $ title = 'My Title ' ;
6- public $ content = 'My Content ' ;
7- public $ date = 'My Date ' ;
8- }
3+ use App \Libraries \MyClass ;
94
10- $ object = new \ Myclass ();
5+ $ object = new MyClass ();
116$ builder ->where ('id ' , $ id );
127$ builder ->update ($ object );
138/*
149 * Produces:
1510 * UPDATE `mytable`
16- * SET `title` = '{$title}', `name ` = '{$name }', `date` = '{$date}'
11+ * SET `title` = '{$title}', `content ` = '{$content }', `date` = '{$date}'
1712 * WHERE id = `$id`
1813 */
Original file line number Diff line number Diff line change 11<?php
22
3- class Myclass
4- {
5- public $ email = 'ahmadinejad@example.com ' ;
6- public $ name = 'Ahmadinejad ' ;
7- public $ country = 'Iran ' ;
8- }
3+ use App \Libraries \MyClass ;
94
10- $ object = new \ Myclass ();
5+ $ object = new MyClass ();
116$ builder ->upsert ($ object );
Original file line number Diff line number Diff line change 1+ <?php
2+
3+ namespace App \Libraries ;
4+
5+ class MyClass
6+ {
7+ public $ email = 'ahmadinejad@example.com ' ;
8+ public $ name = 'Ahmadinejad ' ;
9+ public $ country = 'Iran ' ;
10+ }
You can’t perform that action at this time.
0 commit comments