Hi I've been trying to check if a field is existing using isset inside addCondition like this
$criteria->addCondition('isset(status_id)');
but no luck. Can anyone suggest the right syntax for this? thanks
Hi I've been trying to check if a field is existing using isset inside addCondition like this
$criteria->addCondition('isset(status_id)');
but no luck. Can anyone suggest the right syntax for this? thanks
For checking a variable, you can use isset(). But what you are trying to do is not the correct way. The addCondition method is not supposed to execute PHP functions. Check the documentation
But If you want to check the value in
status_id
, tou can do like this -check that your variable is set and it is in the correct form that you want, then add it in your condition.like:
if you use "compare" , it doesn't matter that it is set or not.
try this: if(isset(status_id)) {$criteria->addCondition('status_id');}