Reputation: 7776
Is there any way to perform a case-insensitive lookup in CakePHP? e.g. is something like the following possible?
$record = $this->find(
'first',
array(
'conditions' => array(
'name' => $name,
'ignore-case' => true
)
)
);
I'm using CakePHP 1.3, if that matters (yes I know it's outdated, but I don't have the time to migrate it just yet.)
Upvotes: 1
Views: 2448
Reputation: 397
Maybe not the best approach, but one possibility is:
$record = $this->find(
'first',
array(
'conditions' => array(
'LOWER(Model.name)' => strtolower($name)
)
)
);
Upvotes: 1