Writting $criteria for EAV Model

Hi,

I am using an EAV Model and try to create a dynamic creation of multiple conditions. I now face the issue that I try to create a $criteria with a column which does not exists. Sounds a bit strange I know, but that’s the way the system is set up. I am still very new to yii, therefore I can not explain it that well…

Anyway, I am looking for a column to be empty , but actually, when the column is empty it actually does not even exists so of course yii throws an error: SQLSTATE[42S22]: Column not found:

Sorry correction, when I try below, I still get all shown so its seems to ignore the $criteria->compare($field, “”, false, ‘AND’);

$criteria->compare($field, “”, false, ‘AND’);

$criteria->addInCondition(‘parent_id’, $parentIds);

So I thought I need a condition

$criteria2->addCondition("{$field} = ‘’");

That is when I get the error thrown, Column not found

I need it to build 1 $criteria in the end which I return. The system is set up this way that if a field does not exists, then it inherits from it’s parent record. So I am now building a search function where in my first run it checks where the search condition fits, I then save the parent Ids and the children Ids when they meet the condition. After that I build my next query to find products which have not got its own entry and which will therefore inherit from the parents, since they should be included as well. How can I best achieve that?

Hope somebody got some feedback. Thanks in advance.