-
-
Notifications
You must be signed in to change notification settings - Fork 127
Open
Description
Hey,
first thanks for the great package and your effort!
The primary key of my Model is under data.id
, the problem is, that Javascript can't resolve an Object by string dot notation.
It try's to check if my Model instance has a valid ID with the hasId
Method. Insides the hasId
Method it try's to access the primaryKey through getPrimaryKey()
with this[this.primaryKey()];
.
This would be equivalent to access an object like this and resolves to undefined:
const o = {
data: {
id: 1,
},
};
o['data.id'];
// my model
export default class User extends Model {
primaryKey() {
return 'data.id';
}
resource() {
return 'users';
}
}
Is there any other solution? If not i think it should be possible to access objects through a provided path as a string.
Metadata
Metadata
Assignees
Labels
No labels