Tuesday, June 2, 2009

Using MySQL's DAYNAME in find

Hi there,

Is it possible to use MySQL's DAYNAME function in the where clause
of a call to 'find'? i.e. something a bit like:

$this->paginate['conditions'] = array('DAYNAME(Model.field)' =>
'Monday');

The above doesn't work (which is what I was expecting) but I haven't
managed to find an equivalent syntax that does.

I'm wondering if I should pursue another route? I could put
something in afterFind, and test that I'm in the appropriate action as
detailed in this useful post, would that be the best approach?

http://teknoid.wordpress.com/2009/05/04/execute-code-in-model-callbacks-based-on-controller-actions/

As ever, any help is greatly appreciated.

Toby
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to cake-php+unsubscribe@googlegroups.com
For more options, visit this group at http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---

No comments: