Skip to content

Commit 0d165b6

Browse files
author
Shubham
committed
Add new method enable_sync() in _Entity
1 parent 37bee34 commit 0d165b6

1 file changed

Lines changed: 5 additions & 1 deletion

File tree

objectbox/model/entity.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -274,6 +274,10 @@ def _unmarshal(self, data: bytes):
274274
setattr(obj, prop.name, val)
275275
return obj
276276

277+
def enable_sync(self):
278+
# Set SYNC_ENABLED flag for this entity
279+
self._flags |= OBXEntityFlags.SYNC_ENABLED
280+
277281
# Dictionary of entity types (metadata) collected by the Entity decorator.
278282
# Note: using a list not a set to keep the order of entities as they were defined (set would not be deterministic).
279283
obx_models_by_name: Dict[str, List[_Entity]] = {}
@@ -325,5 +329,5 @@ def wrapper(class_) -> Callable[[Type], _Entity]:
325329

326330
def SyncEntity(cls):
327331
entity: _Entity = obx_models_by_name["default"][-1] # get the last added entity
328-
entity._flags |= OBXEntityFlags.SYNC_ENABLED
332+
entity.enable_sync()
329333
return cls

0 commit comments

Comments
 (0)