@@ -149,6 +149,7 @@ It allows different syntax possibilities such as simple array/string/int values
149
149
building all parameters as objects based on the [ Query/...] ( src/Query ) classes. All queries return a [ QueryResult] ( src/Query/QueryResult.php )
150
150
object, which is iterable and countable.
151
151
152
+ #### Select
152
153
``` php
153
154
<?php
154
155
@@ -213,6 +214,44 @@ User::query(new \Aternos\Model\Query\SelectQuery(
213
214
));
214
215
```
215
216
217
+ #### Update
218
+ ``` php
219
+ <?php
220
+
221
+ // update mail to "mail@example.org" where username is "username"
222
+ User::query(new \Aternos\Model\Query\UpdateQuery(["email" => "mail@example.org"], ["username" => "username"]));
223
+ User::query((new \Aternos\Model\Query\UpdateQuery())
224
+ ->fields(["email" => "mail@example.org"])
225
+ ->where(["username" => "username"]));
226
+ User::query(new \Aternos\Model\Query\UpdateQuery(
227
+ new \Aternos\Model\Query\Field("email", "mail@example.org"),
228
+ new \Aternos\Model\Query\WhereCondition("username", "username")
229
+ ));
230
+ User::query(new \Aternos\Model\Query\UpdateQuery(
231
+ [new \Aternos\Model\Query\Field("email", "mail@example.org")],
232
+ new \Aternos\Model\Query\WhereGroup([
233
+ new \Aternos\Model\Query\WhereCondition("username", "username")
234
+ ])
235
+ ));
236
+ ```
237
+
238
+ #### Delete
239
+ ``` php
240
+ <?php
241
+
242
+ // delete where email is mail@example.org
243
+ User::query(new \Aternos\Model\Query\DeleteQuery(["email" => "mail@example.org"]));
244
+ User::query((new \Aternos\Model\Query\DeleteQuery())->where(["email" => "mail@example.org"]));
245
+ User::query(new \Aternos\Model\Query\DeleteQuery(
246
+ new \Aternos\Model\Query\WhereCondition("email", "mail@example.org")
247
+ ));
248
+ User::query(new \Aternos\Model\Query\DeleteQuery(
249
+ new \Aternos\Model\Query\WhereGroup([
250
+ new \Aternos\Model\Query\WhereCondition("email", "mail@example.org")
251
+ ])
252
+ ));
253
+ ```
254
+
216
255
## Advanced usage
217
256
* More information about more advanced usage, such as writing your own drivers, driver factory or models
218
257
will be added in the future, in the meantime just take a look at the source code.*
0 commit comments