Replies: 2 comments 3 replies
-
I don't know yet if i am getting it right. But do you use |
Beta Was this translation helpful? Give feedback.
0 replies
-
Codesandbox reproduction (see console output after model is saved). Child model is: export default class Person extends ManagedModel
{
static entity = 'persons';
static managedEntity = 'person';
static fields()
{
return {
...super.fields()
};
}
@HasOne(() => HumanName, 'id')
declare name: HumanName;
@Str('')
declare birthDate: string;
} And saving as: useRepo(Person).save({
id: 't4a03k6b',
name: { }
}) Pinia state:
|
Beta Was this translation helpful? Give feedback.
3 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hello! Pinia ORM describes Single Table Inheritance. But what if we just need to provide some well-known fields to all derived models?
For example, I have another base class ManagedModel, which is extended from Model and provides two fields:
id: string
and$hasChanges: boolean
. It is not part of STI, just known fields (which is not working for now - always has it's value as undefined):Sub-entities of ManagedModel is used as root models for ModelManager, which is proxy-based wrapper for all nested field changes to update store and backup (Dexie) with debounced user input (450 ms).
Usage in components:
Beta Was this translation helpful? Give feedback.
All reactions