SQL functions or keywords in CakePHP conditions

For those who missed the information, starting from CakePHP 1.2 it is no longer possible to use the magic tag -! in your condition to prevent your SQL function or keyword to be enclosed in quotes.

The recommended way now is to place it into the key or not make the array associative at all. It is no longer possible to put it into the value part of the definition.

So instead of:

  1.   ‘DATE_ADD(Payment.modified, INTERVAL 2 DAY) >’ =>  
  2.   ‘CURRENT_DATE’)

you have to use:

  1.   ‘DATE_ADD(Payment.modified, INTERVAL 2 DAY) > CURRENT_DATE’)

One Response to “SQL functions or keywords in CakePHP conditions”

  1. Thanks a lot it save me some extra hours. Thanks.

Leave a Reply