Ido: Allow custom variables to be mapped
If you filter by host custom variables and the query does not have the services table joined, our query implementation calls the joinHosts method. Then, the column for the JOIN ON condition is automatically set to h.host_object_id. But it may be required by the query to call joinServices and use s.host_object_id instead of h.host_object_id because the query does not use any host related table at all. This is now possible when h.host_object_id is mapped to s.host_object_id: class ServicesRelatedQuery { protected $columnMap = array( 'hosts' => array( 'h.host_object_id' => 's.host_object_id' ) ); protected function joinHosts() { $this->requireVirtualTable('services'); } }
This commit is contained in:
parent
4b458fd719
commit
b1f7923711
|
@ -964,6 +964,12 @@ abstract class IdoQuery extends DbQuery
|
|||
$leftcol = 'h.host_object_id';
|
||||
}
|
||||
|
||||
$mapped = $this->getMappedField($leftcol);
|
||||
if ($mapped !== null) {
|
||||
$this->requireColumn($leftcol);
|
||||
$leftcol = $mapped;
|
||||
}
|
||||
|
||||
$joinOn = sprintf(
|
||||
$this->customVarsJoinTemplate,
|
||||
$leftcol,
|
||||
|
|
Loading…
Reference in New Issue