Welcome Guest, Not a member yet? Register   Sign In
Model Class - protected field for Order By

Please could you add a protected field for "Order By" in the Model Class.

Currently the data is ordered by the $primaryKey.

E.g. where this would be most helpful:  Tables that are used as option data for select fields, where users can add items.
Let say I have a classification and the columns in the table is ID (PK) and Description,  where using findAll(), the function fetches the data and it is sorted by ID and displayed in the Select Lookup in that order.  If Order by was set as a protected var, we can immediately set the default sort order to description.

Currently you now have to create a custom function the add the order by clause prior to using findAll() e.g. $this->orderBy('description')->findAll().
Dirk B.
Abatrans Software
No SEO spam - see forum guidelines

Theme © iAndrew 2016 - Forum software by © MyBB