this is an updated post in reference to a previous post about saving a field to null when no value is entered. thanks to those who left comment, this is the correct (and easier!) way to do it.
add a new rule to the model:
protected funcion rules() {… more »
Tags: null
sql: order by ascending order with null at the end
when using 'order by' clause to sort columns in ascending order, rows with null value comes first.
what if the requirement is to sort in ascending order but rows with null values comes last?
use case.
select *
from table
order by case when column… more »
yii: date field save as null value
by default if date is not entered in a form, the value is saved as '0000-00-00'. yii does not automaticallyl save it as null. to save the field as null, it needs to be done manuall. update (or add) beforeSave() function in model file:protected func… more »