ActiveDataProvider with CASE

Hi,

I have a somewhat unusual problem with an query.

In the “Search-Class” from my model i have the following query:

       $query = ScanPorts::find()
       ->select(['ports.*','hosts.hostname', 'hosts.ip AS hostip', '(CASE WHEN (SELECT count(ports_verified.id) FROM ports_verified INNER JOIN ports ON ports_verified.port=ports.port AND hosts.ip=ports_verified.ip ) > 0 THEN \'1\' ELSE \'0\' END) AS verified'])
       ->innerJoin('hosts', 'ports.h_id = hosts.id')
       ->where(['ports.s_id'=>$_GET['id']])
       ->with(['hosts']);

If i get the sql statement with

$query->createCommand()->sql; 

and runs this on the database, the result is fine. I get all fields an verified is 1 or 0. But in the dataProvider the “verified-Field” is missing. I can’t access the data.

There is no relation between the tables in the database, because the dataset in ports_verified can be more than onetime in ports table.

Does anyone have an idea of ​​what that could be?

Did you declare verified in the search class?

Thank you. It works now.