ContactgroupQuery: Rename baseQuery to select
This commit is contained in:
parent
5caffa78e2
commit
c2d633ac49
|
@ -41,17 +41,17 @@ class ContactgroupQuery extends IdoQuery
|
||||||
'service_description' => 'so.name2 COLLATE latin1_general_ci',
|
'service_description' => 'so.name2 COLLATE latin1_general_ci',
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
|
||||||
protected $useSubqueryCount = true;
|
protected $useSubqueryCount = true;
|
||||||
|
|
||||||
protected function joinBaseTables()
|
protected function joinBaseTables()
|
||||||
{
|
{
|
||||||
$this->baseQuery = $this->db->select()->from(
|
$this->select->from(
|
||||||
array('cg' => $this->prefix . 'contactgroups'),
|
array('cg' => $this->prefix . 'contactgroups'),
|
||||||
array()
|
array()
|
||||||
)->join(
|
)->join(
|
||||||
array('cgo' => $this->prefix . 'objects'),
|
array('cgo' => $this->prefix . 'objects'),
|
||||||
'cg.contactgroup_object_id = cgo.' . $this->object_id
|
'cg.contactgroup_object_id = cgo.' . $this->object_id . ' AND cgo.is_active = 1',
|
||||||
. ' AND cgo.is_active = 1',
|
|
||||||
array()
|
array()
|
||||||
);
|
);
|
||||||
|
|
||||||
|
@ -60,7 +60,7 @@ class ContactgroupQuery extends IdoQuery
|
||||||
|
|
||||||
protected function joinContacts()
|
protected function joinContacts()
|
||||||
{
|
{
|
||||||
$this->baseQuery->distinct()->join(
|
$this->select->distinct()->join(
|
||||||
array('cgm' => $this->prefix . 'contactgroup_members'),
|
array('cgm' => $this->prefix . 'contactgroup_members'),
|
||||||
'cgm.contactgroup_id = cg.contactgroup_id',
|
'cgm.contactgroup_id = cg.contactgroup_id',
|
||||||
array()
|
array()
|
||||||
|
@ -77,7 +77,7 @@ class ContactgroupQuery extends IdoQuery
|
||||||
|
|
||||||
protected function joinHosts()
|
protected function joinHosts()
|
||||||
{
|
{
|
||||||
$this->baseQuery->distinct()->join(
|
$this->select->distinct()->join(
|
||||||
array('hcg' => $this->prefix . 'host_contactgroups'),
|
array('hcg' => $this->prefix . 'host_contactgroups'),
|
||||||
'hcg.contactgroup_object_id = cg.contactgroup_object_id',
|
'hcg.contactgroup_object_id = cg.contactgroup_object_id',
|
||||||
array()
|
array()
|
||||||
|
@ -94,10 +94,10 @@ class ContactgroupQuery extends IdoQuery
|
||||||
|
|
||||||
protected function joinServices()
|
protected function joinServices()
|
||||||
{
|
{
|
||||||
$scgSub = $this->db->select()->distinct()
|
$scgSub = $this->db->select()->distinct()->from(
|
||||||
->from($this->prefix . 'service_contactgroups', array(
|
$this->prefix . 'service_contactgroups',
|
||||||
'contactgroup_object_id', 'service_id'
|
array('contactgroup_object_id', 'service_id')
|
||||||
));
|
);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
This subselect is a workaround for a fucking stupid bug. Other tables
|
This subselect is a workaround for a fucking stupid bug. Other tables
|
||||||
|
@ -113,7 +113,7 @@ class ContactgroupQuery extends IdoQuery
|
||||||
+-------------------------+-------------+------------+------------------------+
|
+-------------------------+-------------+------------+------------------------+
|
||||||
*/
|
*/
|
||||||
|
|
||||||
$this->baseQuery->join(
|
$this->select->join(
|
||||||
// array('scg' => $this->prefix . 'service_contactgroups'),
|
// array('scg' => $this->prefix . 'service_contactgroups'),
|
||||||
array('scg' => $scgSub),
|
array('scg' => $scgSub),
|
||||||
'scg.contactgroup_object_id = cg.contactgroup_object_id',
|
'scg.contactgroup_object_id = cg.contactgroup_object_id',
|
||||||
|
@ -128,5 +128,4 @@ class ContactgroupQuery extends IdoQuery
|
||||||
array()
|
array()
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue