mirror of
https://github.com/Icinga/icingaweb2-module-director.git
synced 2025-09-25 18:59:05 +02:00
SyncRule: add getPriorityForNextProperty() method
This commit is contained in:
parent
f0475c2407
commit
b9390747b3
@ -21,6 +21,22 @@ class SyncRule extends DbObject
|
|||||||
'filter_expression' => null,
|
'filter_expression' => null,
|
||||||
);
|
);
|
||||||
|
|
||||||
|
public function getPriorityForNextProperty()
|
||||||
|
{
|
||||||
|
if (! $this->hasBeenLoadedFromDb()) {
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
$db = $this->getDb();
|
||||||
|
return $db->fetchOne(
|
||||||
|
$db->select()
|
||||||
|
->from(
|
||||||
|
'sync_property',
|
||||||
|
'(CASE WHEN MAX(priority) IS NULL THEN 1 ELSE MAX(priority) + 1 END)'
|
||||||
|
)->where('rule_id = ?', $this->id)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
public function fetchSyncProperties()
|
public function fetchSyncProperties()
|
||||||
{
|
{
|
||||||
$db = $this->getDb();
|
$db = $this->getDb();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user