TemplateChoice: small fixes, forms

This commit is contained in:
Thomas Gelf 2017-06-27 00:20:40 +02:00
parent 1739b950a8
commit 2f79920a18
3 changed files with 4 additions and 7 deletions

View File

@ -3,12 +3,10 @@
namespace Icinga\Module\Director\Objects;
use Icinga\Module\Director\Web\Form\QuickForm;
use ipl\Translation\TranslationHelper;
use Zend_Form_Element as ZfElement;
class IcingaTemplateChoice extends IcingaObject
{
private $objectTable;
protected $objectTable;
protected $defaultProperties = [
'id' => null,
@ -90,11 +88,10 @@ class IcingaTemplateChoice extends IcingaObject
if ($this->hasBeenLoadedFromDb()) {
$db = $this->getDb();
$query = $db->select()->from(
['o' => $this->objectTable],
['o' => $this->getObjectTableName()],
['o.id', 'o.object_name']
)->where("o.object_type = 'template'")
->where('o.template_choice_id = ?', $this->get('id'));
->where('o.template_choice_id IS NULL OR o.template_choice_id = ?', $this->get('id'));
return $db->fetchPairs($query);
} else {
return [];

View File

@ -2,7 +2,7 @@
namespace Icinga\Module\Director\Objects;
class IcingaTemplateChoiceHost extends IcingaTemplateChoice
class IcingaTemplateChoiceService extends IcingaTemplateChoice
{
protected $table = 'icinga_service_template_choice';