That is the expected result.
You are working against the ORMs auto-magic. Passing a string will result in an equality comparison, ie WHERE x = y
, and since id
is most probably an integer, the casting will turn the string 1,2,3,4
into 1
, so ultimately the condition will be WHERE id = 1
.
You should pass the array instead
'conditions' => array(
'id' => array(1, 2, 3, 4)
)
that way the ORM will generate an IN
condition, ie WHERE id IN (1,2,3,4)
.
This is also documented in the cookbook:
http://book.cakephp.org/2.0/en/models/retrieving-your-data.html#complex-find-conditions