summaryrefslogtreecommitdiffstats
path: root/library/Director/Web/Table/ObjectsTableHostTemplateChoice.php
blob: 929e050cbe295a12b6a799533c11e668933477fe (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
<?php

namespace Icinga\Module\Director\Web\Table;

use Zend_Db_Select as ZfSelect;

class ObjectsTableHostTemplateChoice extends ObjectsTable
{
    protected $columns = [
        'object_name' => 'o.object_name',
        'templates'   => 'GROUP_CONCAT(t.object_name)'
    ];

    protected function applyObjectTypeFilter(ZfSelect $query, ZfSelect $right = null)
    {
        return $query;
    }

    protected function prepareQuery()
    {
        return parent::prepareQuery()->joinLeft(
            ['t' => 'icinga_host'],
            't.template_choice_id = o.id',
            []
        )->group('o.id');
    }
}