save option keep relations
This commit is contained in:
@@ -61,6 +61,11 @@ class SaveOption
|
||||
* Keep dirty. Boolean.
|
||||
*/
|
||||
public const KEEP_DIRTY = BaseSaveOption::KEEP_DIRTY;
|
||||
/**
|
||||
* Keep an entity relations map. Boolean.
|
||||
* @since 9.0.0
|
||||
*/
|
||||
public const KEEP_RELATIONS = BaseSaveOption::KEEP_RELATIONS;
|
||||
/**
|
||||
* Skip hooks. Boolean.
|
||||
*/
|
||||
|
||||
@@ -34,4 +34,5 @@ class SaveOption
|
||||
public const SKIP_ALL = 'skipAll';
|
||||
public const KEEP_NEW = 'keepNew';
|
||||
public const KEEP_DIRTY = 'keepDirty';
|
||||
public const KEEP_RELATIONS = 'keepRelations';
|
||||
}
|
||||
|
||||
@@ -182,7 +182,9 @@ class RDBRepository implements Repository
|
||||
$entity->setAsNotBeingSaved();
|
||||
}
|
||||
|
||||
$this->relationsMap?->get($entity)?->resetAll();
|
||||
if (empty($options[SaveOption::KEEP_RELATIONS])) {
|
||||
$this->relationsMap?->get($entity)?->resetAll();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user