CakePHP 3: How to create Case statements WHEN DATE field IS NULL THEN set NOW()

I have several tables in which I need to save time ranges of certain events (education, work, …). But users in html form can indicate that the event is still going on, so DATE field “event_end” is by default NULL.

When selecting events they have to be sorted by “event_start” and “event_end”.

But if the “event_end” value IS NULL should it prove to be the current date.

How to do it?