Comments (6)
Just FYI getters are also supported.
from mikro-orm.
This should be already supported in v3, will add a test case to be sure...
About update hooks, feel free to create new issue if you see something not working properly.
from mikro-orm.
would getters be supported?
@Property()
get fullname() {
return this.firstName + this.lastName;
}
from mikro-orm.
I would love to support that, hopefully there wont be any problem with it but never tried decorators on top of getter.
from mikro-orm.
@B4nan I just had another thought, what about setters? It can be helpful for doing validation/updating values. for example keeping an email address lowercase. Also, side-note onUpdate doesn't seem to have access to the current value. Both would be interesting to have support for, although I think a setter is more versatile because it's reflected in memory too.
private _address!: string;
@Property({
type: String
})
get address(): string {
return this._address;
}
set address(val: string) {
this._address = val && val.length ? val.toLocaleLowerCase() : val;
}
from mikro-orm.
Closing as resolved. Available for testing via next
tag.
from mikro-orm.
Related Issues (20)
- Allow setting `name` explicitly when `class` is set when using EntitySchema to define entities
- QueryBuilder in 6.2.x HOT 12
- Typescript error after upgrade from 6.1.12 to 6.2.2
- The migration:check command exits with ERR_IMPORT_ASSERTION_TYPE_MISSING HOT 3
- On MariaDB, It updates JSON column which not changed. HOT 11
- Upsert with Embeddings gives InvalidFieldNameException Postgresql
- Cursor pagination `first: 0` returns all items HOT 1
- Infinite cycle when querying an entity HOT 2
- Cannot find matching entity for condition" when using upsertMany HOT 1
- there is not enough being logged when having an index conflict in mongodb
- OnCreate property hook not executed when using Scalar Reference HOT 1
- "Source file '...' not found." error occurs since version 6.2.2-dev.7 with Bun. HOT 2
- PostgreSQL malformed query when using query builder, joining a sub-query + ManyToMany where-condition + setting a limit
- MikroORM should merge all changes of one record into one sql update statement HOT 1
- Serialised entity is populated instead of FK HOT 2
- pnpm + vitest + esm+ MikroORM.init = Unknown file extension ".ts"
- Extra query fired when fetching a join table entity and populating a join column HOT 1
- docs: Unwrapping Nested Objects using Embeddables or Custom Types
- Can't debug findOne results in VSCode when instance is populated with related OneToMany / ManyToMany relation.
- Optimistic locking not working with upsert HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from mikro-orm.