IcingaHost: Add first basic getFields() method

resolves #9760
This commit is contained in:
Alexander Fuhr 2015-07-28 17:35:54 +02:00
parent f7a2425b97
commit e4bf3ee370
1 changed files with 20 additions and 0 deletions

View File

@ -2,6 +2,8 @@
namespace Icinga\Module\Director\Objects; namespace Icinga\Module\Director\Objects;
use Icinga\Module\Director\Web\Form\DirectorObjectForm;
class IcingaHost extends IcingaObject class IcingaHost extends IcingaObject
{ {
protected $table = 'icinga_host'; protected $table = 'icinga_host';
@ -80,4 +82,22 @@ class IcingaHost extends IcingaObject
{ {
return $this->renderBooleanProperty('volatile'); return $this->renderBooleanProperty('volatile');
} }
public function getFields(DirectorObjectForm $form)
{
$db = $this->getDb();
$query = $db->select()
->from(
array('df' => 'director_datafield')
)
->join(
array('hf' => 'icinga_host_field'),
'df.id = hf.datafield_id'
)
->where('hf.host_id = ?', (int) $this->id)
->order('df.caption ASC');
return $db->fetchAll($query);
}
} }