New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
BeforeInsert Issue #2924
Comments
@JamesCoonce It should work with the folowing syntax:
|
try it in subscribers |
I'm also using 0.2.7. Here is a basic example. This doesn't even work. It does no modify.
Inside of my todoService I have this
|
what does the value of |
When I send the post request it's
What I get back is
I check the database and it's the same. It's not being modified before insert. |
i could be wrong about this, but my understanding is that because |
That works. I need to create an actual instance first. |
@JamesCoonce consider closing issue then. |
I know why this works that way but it shouldn’t IMO. |
How can one call a validation method using repository.save passing just a plain object instead of an entity instance? |
of course this brings the problem that any other instance methods would be unavailable in the call another obvious solution is to instantiate. Anyway it should be explicitly mentioned in docs that instantiation is required to use hooks |
You can use the create method to create an instance This will solve the issue |
Issue type:
[ ] question
[x ] bug report
[ ] feature request
[ ] documentation issue
Database system/driver:
[ ]
cordova
[ ]
mongodb
[ ]
mssql
[x ]
mysql
/mariadb
[ ]
oracle
[x ]
postgres
[ ]
sqlite
[ ]
sqljs
[ ]
react-native
[ ]
expo
TypeORM version:
[x ]
latest
[ ]
@next
[ ]
0.x.x
(or put your version here)Steps to reproduce or a small repository showing the problem:
Placing @BeforeInsert() and @AfterInsert do not work
I've seen this in other issues and they were closed but the issue was never actually resolved.
The text was updated successfully, but these errors were encountered: