Back to top

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
Next revisionBoth sides next revision
documentation:rack:reference:models [2018/05/26 15:34] Martijn Luinstradocumentation:rack:reference:models [2018/05/27 03:01] – [Functions] Martijn Luinstra
Line 31: Line 31:
   * **isnull**: Tests if the field value is ''NULL'' (if <php>'field__isnull'=>true</php>) or not ''NULL'' (if <php>'field__isnull'=>false</php>).    * **isnull**: Tests if the field value is ''NULL'' (if <php>'field__isnull'=>true</php>) or not ''NULL'' (if <php>'field__isnull'=>false</php>). 
  
-If the comparison function is omitted (<php>'field' => $value</php>), the default of **eq** is used. +If the comparison function is omitted (<php>'field' => $value</php>), the default of **eq** is used.
  
 +The <php>get</php> function also supports custom ordering by passing a list of field names. Descending ordering can be achieved by adding a minus in front of the field name. The following example will order first by study and then by birthdate in descending ordering: <php>['study', '-birthdate']</php>.
 ===== Functions ===== ===== Functions =====
  
Line 38: Line 39:
   * <php>protected query($query, array $input_parameters=[])</php> Expects a query and input parameters that that can be used for [[http://php.net/manual/en/pdo.prepare.php|PDO prepared statements]].   * <php>protected query($query, array $input_parameters=[])</php> Expects a query and input parameters that that can be used for [[http://php.net/manual/en/pdo.prepare.php|PDO prepared statements]].
   * <php>protected query_first($query, array $input_parameters=[])</php> Same as <php>query</php>, but returns only the first result.   * <php>protected query_first($query, array $input_parameters=[])</php> Same as <php>query</php>, but returns only the first result.
-  * <php>get(array $conditions=[], $get_first=false)</php>+  * <php>get(array $conditions=[], array $order=[], $get_first=false)</php>
   * <php>get_by_id($id, $field='id')</php>   * <php>get_by_id($id, $field='id')</php>
   * <php>create(array $values)</php>   * <php>create(array $values)</php>

documentation/rack/reference/models.txt · Last modified: 2023/08/31 23:19 by Martijn Luinstra