Ugly temporary fix for Monitoring\Object problems

This commit is contained in:
Thomas Gelf 2014-03-04 12:59:26 +00:00
parent 8ccd748310
commit 23daa39205
3 changed files with 25 additions and 1 deletions

View File

@ -42,6 +42,18 @@ abstract class AbstractObject
public function fetchComments()
{
// WTF???
$query = Comment::fromParams(array('backend' => null), array(
'comment_timestamp',
'comment_author',
'comment_data',
'comment_type',
))->getQuery();
$query->where('comment_objecttype_id', $this->type);
$this->applyObjectFilter($query);
$this->comments = $query->fetchAll();
return $this;
$this->comments = Comment::fromRequest(
$this->request,
array(
@ -52,7 +64,7 @@ abstract class AbstractObject
'comment_type',
)
)->getQuery()
->where('comment_objecttype_id', 1)
//->where('comment_objecttype_id', 1)
->fetchAll();

View File

@ -3,6 +3,7 @@
namespace Icinga\Module\Monitoring\Object;
use Icinga\Module\Monitoring\DataView\HostStatus;
use Icinga\Data\Db\Query;
class Host extends AbstractObject
{
@ -11,6 +12,10 @@ class Host extends AbstractObject
public $prefix = 'host_';
private $view = null;
protected function applyObjectFilter(Query $query)
{
return $query->where('host_name', $this->host_name);
}
public function populate()
{

View File

@ -3,6 +3,7 @@
namespace Icinga\Module\Monitoring\Object;
use Icinga\Module\Monitoring\DataView\ServiceStatus;
use Icinga\Data\Db\Query;
class Service extends AbstractObject
{
@ -11,6 +12,12 @@ class Service extends AbstractObject
public $prefix = 'service_';
private $view = null;
protected function applyObjectFilter(Query $query)
{
return $query->where('service_host_name', $this->host_name)
->where('service_description', $this->service_description);
}
public function populate()
{
$this->fetchComments()