Order by functionality in ActiveQuery

I’m trying to order by a date field called validfrom in descending order, but would like null values to display at the end of the list rather than at the beginning. This:

[indent]->orderBy( ‘projects.validfrom DESC NULLS LAST’ )[/indent]

doesn’t work. As far as I can tell from looking at the yii source code, it doesn’t support NULLS FIRST/LAST at all. To get around it I’ve tried instead:

[indent]->orderBy( “coalesce(projects.validfrom,‘1900-01-01::date’) DESC” )[/indent]

but that also doesn’t work; it appears that only an attribute name can but used, no expressions. Is there a way around this problem?