====== Unterschiede ====== Hier werden die Unterschiede zwischen zwei Versionen gezeigt.
|
select [2017/08/26 15:56] 213.200.218.142 |
select [2020/02/22 11:19] (aktuell) jonas |
||
|---|---|---|---|
| Zeile 14: | Zeile 14: | ||
| ->orderBy('id') | ->orderBy('id') | ||
| ->all(); | ->all(); | ||
| + | |||
| + | // mit 2 Order-By: | ||
| + | $model::find()->orderBy([ | ||
| + | 'id_date' => SORT_DESC, | ||
| + | 'item_no'=>SORT_ASC | ||
| + | ]); | ||
| // return the number of active customers | // return the number of active customers | ||
| Zeile 26: | Zeile 32: | ||
| ->indexBy('id') | ->indexBy('id') | ||
| ->all(); | ->all(); | ||
| + | |||
| + | // Grösser/kleiner als | ||
| + | return Country::find() | ||
| + | ->where(['>=', 'population', $lower]) | ||
| + | ->andWhere(['<=', 'population', $upper]) | ||
| + | ->all(); | ||
| </code> | </code> | ||
| Zeile 35: | Zeile 47: | ||
| ['prompt'=>'...'] | ['prompt'=>'...'] | ||
| ); | ); | ||
| + | </code> | ||
| + | |||
| + | ===== Eager Loading ===== | ||
| + | <code php> | ||
| + | $player = PlayersModel::find()->where(['id' => $id])->with('club')->one(); | ||
| + | |||
| + | $class = Classes::find()->where(['id' => $class_id])->with('dancesClasses', 'dancesClasses.dances')->one(); | ||
| </code> | </code> | ||