You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/maintenance/internals/systemfield.md
+40-56Lines changed: 40 additions & 56 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -170,10 +170,10 @@ Relations are specialized system fields that manage connections between records
170
170
171
171
Relations consist of several components:
172
172
173
-
-**RelationsField**: the main system field that manages multiple relations.
174
-
-**Relation Classes**: define how to resolve and validate specific relation types.
173
+
-**Relation Fields**: like `RelationsField`, `MultiRelationsField` manage multiple relation definitions on a record, acting as a container for individual relation configurations and providing the interface for accessing relations.
174
+
-**Mapping Classes**: provides the interface for attribute access for managing relations on a record.
175
+
-**Relation Classes**: like `PKRelation`, `ListRelation` define how to resolve and validate specific relation types.
175
176
-**Result Classes**: handle the returned values when accessing relations.
176
-
-**Mapping Class**: provides the interface for managing relations on a record.
177
177
178
178
### Primary key relations (PKRelation)
179
179
@@ -196,6 +196,7 @@ class ArticleRecord(Record, SystemFieldsMixin):
# Example: compute a search-friendly version of the title
494
-
title = record.get('metadata', {}).get('title', '')
495
-
return title.lower().replace('', '_')
496
-
```
497
-
498
447
## Record lifecycle hooks deep dive
499
448
500
449
Understanding when each lifecycle hook is called is crucial for proper system field implementation:
@@ -703,3 +652,38 @@ When designing system fields, consider:
703
652
- Testing strategies
704
653
705
654
By following these patterns and best practices, you can create robust, maintainable system fields that enhance InvenioRDM's capabilities while maintaining clean, readable code.
655
+
656
+
## Best practices
657
+
658
+
!!! note "Idempotence and data consistency"
659
+
While system fields are intended to be idempotent, there is no strict enforcement of this principle. Developers are advised to design their implementations to respect idempotence and ensure data consistency.
0 commit comments