While changing some code to make use of the new Containable behavior I noticed code snippets that looked like:

// in a model method
if ($this->findCount($conditions) > 0) {
    // do something
}

If you look at this example you will realize that what the code tells us is slightly different from what the intention of the code is. The code tells us something like: “if the number of records that meet the conditions is greater than 0 then do something”. But what we really want to express is: “if there are any records that meet the conditions then do something”.

Fortunately, there exists the method Model::hasAny() for this purpose (it is not a new method, but for some reason we almost never used it), and by using this method we can simplify the example from above and make it more expressive:

// in a model method
if ($this->hasAny($conditions)) {
    // do something
}

Sure, it is only a detail, but it helps to make the code a little bit more expressive.