SyncProperty: allow priorities, set source name

This commit is contained in:
Thomas Gelf 2018-06-11 21:29:59 +02:00
parent 85651a241a
commit 0735ed0aa1
1 changed files with 9 additions and 1 deletions

View File

@ -28,11 +28,19 @@ class SyncProperty extends DbObject
protected function beforeStore()
{
if (! $this->hasBeenLoadedFromDb()) {
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();