Use ipl\Stdlib\Filter to filter the $queryHost and $queryService

This commit is contained in:
raviks789 2022-02-15 12:38:48 +01:00
parent 5cb389b052
commit ab4728ad54

View file

@ -11,6 +11,7 @@ use Icinga\Module\Icingadb\Common\Auth;
use Icinga\Module\Icingadb\Model\Host;
use Icinga\Module\Icingadb\Model\Service;
use ipl\Sql\Connection as IcingaDbConnection;
use ipl\Stdlib\Filter;
class IcingaDbState
{
@ -67,8 +68,7 @@ class IcingaDbState
$queryHost = Host::on($this->backend)->with('state');
IcingaDbObject::applyIcingaDbRestrictions($queryHost);
$queryHost->getSelectBase()
->where(['host.name IN (?)' => $hosts]);
$queryHost->filter(Filter::equal('host.name', $hosts));
$hostObject = $queryHost->getModel()->getTableName();
@ -82,8 +82,7 @@ class IcingaDbState
'host.state'
]);
$queryService->getSelectBase()
->where(['service_host.name IN (?)' => $hosts]);
$queryService->filter(Filter::equal('host.name', $hosts));
IcingaDbObject::applyIcingaDbRestrictions($queryService);