blob: 20c47005617d1d90a57b1899f2f477ee2ff23af4 (
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
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
|
<?php
namespace Icinga\Module\Director\Objects;
use Icinga\Module\Director\Data\Db\DbObject;
use Icinga\Module\Director\Objects\Extension\PriorityColumn;
class SyncProperty extends DbObject
{
use PriorityColumn;
protected $table = 'sync_property';
protected $keyName = 'id';
protected $autoincKeyName = 'id';
protected $defaultProperties = [
'id' => null,
'rule_id' => null,
'source_id' => null,
'source_expression' => null,
'destination_field' => null,
'priority' => null,
'filter_expression' => null,
'merge_policy' => null
];
protected function beforeStore()
{
if (! $this->hasBeenLoadedFromDb() && $this->get('priority') === null) {
$this->setNextPriority('rule_id');
}
}
public function setSource($name)
{
$source = ImportSource::loadByName($name, $this->getConnection());
$this->set('source_id', $source->get('id'));
return $this;
}
protected function onInsert()
{
$this->refreshPriortyProperty();
}
}
|