IcingaCommandArgumentTable: improve readability

This commit is contained in:
Thomas Gelf 2017-07-21 12:07:28 +02:00
parent d92492d5a1
commit 985d03d5f2

View File

@ -31,14 +31,10 @@ class IcingaCommandArgumentTable extends ZfQueryBasedTable
public function renderRow($row)
{
return $this::row([
Link::create(
$row->argument_name,
'director/command/arguments',
[
'argument_id' => $row->id,
'name' => $this->command->getObjectName()
]
),
Link::create($row->argument_name, 'director/command/arguments', [
'argument_id' => $row->id,
'name' => $this->command->getObjectName()
]),
$row->argument_value
]);
}
@ -51,20 +47,15 @@ class IcingaCommandArgumentTable extends ZfQueryBasedTable
];
}
public function getColumns()
{
return array(
'id' => 'ca.id',
'argument_name' => "COALESCE(ca.argument_name, '(none)')",
'argument_value' => 'ca.argument_value',
);
}
public function prepareQuery()
{
return $this->db()->select()->from(
['ca' => 'icinga_command_argument'],
$this->getColumns()
[
'id' => 'ca.id',
'argument_name' => "COALESCE(ca.argument_name, '(none)')",
'argument_value' => 'ca.argument_value',
]
)->where(
'ca.command_id = ?',
$this->command->get('id')