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
Through some trial and error I finally found that adding the agreeToTerms: {persist: false, hidden: true, entity: ''}, line to properties got the compiler to stop complaining but I was having trouble finding documentation covering what exactly that line does, especially the entity field. What I was curious about is if I was doing this correctly or if there is a different way to tell the ORM to ignore my function?
Additionally, I had another function on my User class that looks something like:
updateFromUserData(userData: UserData): void {
//Code here to update the user based on UserData class
}
Where UserData is not an Entity but a POJO provided from some external service.
Again I had added updateFromUserData: {persist: false, hidden: true, entity: ''} to the EntitySchema properties and that all worked as expected however when I attempted to generate a migration I get a Cannot find name 'UserData'. (2304) so I suspect I'm missing something to tell the migration:create to ignore that function/parameter.
The text was updated successfully, but these errors were encountered:
Interesting, I figured the methods were included as a way to support virtual properties but it'd make more sense to me for them to not be required by default.
You could use the second type argument to ignore them, that is used for base entities, and properties from there are ignored.
Note I also removed name as you don't need that if you provide class. path is also not needed as it is used only for caching and caching is disabled when you use EntitySchema.
I had a question regarding the use of EntitySchema and how to properly handle functions:
Through some trial and error I finally found that adding the
agreeToTerms: {persist: false, hidden: true, entity: ''},
line to properties got the compiler to stop complaining but I was having trouble finding documentation covering what exactly that line does, especially theentity
field. What I was curious about is if I was doing this correctly or if there is a different way to tell the ORM to ignore my function?Additionally, I had another function on my User class that looks something like:
Where UserData is not an Entity but a POJO provided from some external service.
Again I had added
updateFromUserData: {persist: false, hidden: true, entity: ''}
to the EntitySchema properties and that all worked as expected however when I attempted to generate a migration I get aCannot find name 'UserData'. (2304)
so I suspect I'm missing something to tell the migration:create to ignore that function/parameter.The text was updated successfully, but these errors were encountered: