{"action":"created","issue":{"url":"https://api.github.com/repos/typeorm/typeorm/issues/2577","repository_url":"https://api.github.com/repos/typeorm/typeorm","labels_url":"https://api.github.com/repos/typeorm/typeorm/issues/2577/labels{/name}","comments_url":"https://api.github.com/repos/typeorm/typeorm/issues/2577/comments","events_url":"https://api.github.com/repos/typeorm/typeorm/issues/2577/events","html_url":"https://github.com/typeorm/typeorm/issues/2577","id":344110814,"node_id":"MDU6SXNzdWUzNDQxMTA4MTQ=","number":2577,"title":"Is there a reason why listeners and subscribers would not work at all?","user":{"login":"joebieb","id":20494242,"node_id":"MDQ6VXNlcjIwNDk0MjQy","avatar_url":"https://avatars3.githubusercontent.com/u/20494242?v=4","gravatar_id":"","url":"https://api.github.com/users/joebieb","html_url":"https://github.com/joebieb","followers_url":"https://api.github.com/users/joebieb/followers","following_url":"https://api.github.com/users/joebieb/following{/other_user}","gists_url":"https://api.github.com/users/joebieb/gists{/gist_id}","starred_url":"https://api.github.com/users/joebieb/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/joebieb/subscriptions","organizations_url":"https://api.github.com/users/joebieb/orgs","repos_url":"https://api.github.com/users/joebieb/repos","events_url":"https://api.github.com/users/joebieb/events{/privacy}","received_events_url":"https://api.github.com/users/joebieb/received_events","type":"User","site_admin":false},"labels":[{"id":333605716,"node_id":"MDU6TGFiZWwzMzM2MDU3MTY=","url":"https://api.github.com/repos/typeorm/typeorm/labels/question","name":"question","color":"cc317c","default":true}],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":2,"created_at":"2018-07-24T16:22:46Z","updated_at":"2018-07-28T20:18:11Z","closed_at":null,"author_association":"NONE","body":"**Issue type:**\r\n\r\n[x] question\r\n[ ] bug report\r\n[ ] feature request\r\n[ ] documentation issue\r\n\r\n**Database system/driver:**\r\n\r\n[ ] `cordova`\r\n[ ] `mongodb`\r\n[ ] `mssql`\r\n[ ] `mysql` / `mariadb`\r\n[ ] `oracle`\r\n[x] `postgres`\r\n[ ] `sqlite`\r\n[ ] `sqljs`\r\n[ ] `react-native`\r\n[ ] `expo`\r\n\r\n**TypeORM version:**\r\n\r\n[x] `latest`\r\n[ ] `@next`\r\n[ ] `0.x.x` (or put your version here)\r\n\r\n**Steps to reproduce or a small repository showing the problem:**\r\nUsing getRepository(Entity).save(data) or entityManager.save(Entity, data) will not fire the @AfterUpdate or @AfterInsert methods on the entity.\r\n\r\n```\r\n@AfterInsert()\r\n@AfterUpdate()\r\nsomeMethod() { \r\n console.log(\"It worked!\")\r\n}\r\n```\r\n\r\n\r\n<!--\r\n    To answer those questions you need to put \"x\" inside the square brackets, for example:\r\n    [x] `mysql`\r\n    [ ] `postgres`\r\n\r\n    Also, please format your code properly (by taking code blocks into ```ts .... ```)\r\n!>\r\n"},"comment":{"url":"https://api.github.com/repos/typeorm/typeorm/issues/comments/408632474","html_url":"https://github.com/typeorm/typeorm/issues/2577#issuecomment-408632474","issue_url":"https://api.github.com/repos/typeorm/typeorm/issues/2577","id":408632474,"node_id":"MDEyOklzc3VlQ29tbWVudDQwODYzMjQ3NA==","user":{"login":"joebieb","id":20494242,"node_id":"MDQ6VXNlcjIwNDk0MjQy","avatar_url":"https://avatars3.githubusercontent.com/u/20494242?v=4","gravatar_id":"","url":"https://api.github.com/users/joebieb","html_url":"https://github.com/joebieb","followers_url":"https://api.github.com/users/joebieb/followers","following_url":"https://api.github.com/users/joebieb/following{/other_user}","gists_url":"https://api.github.com/users/joebieb/gists{/gist_id}","starred_url":"https://api.github.com/users/joebieb/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/joebieb/subscriptions","organizations_url":"https://api.github.com/users/joebieb/orgs","repos_url":"https://api.github.com/users/joebieb/repos","events_url":"https://api.github.com/users/joebieb/events{/privacy}","received_events_url":"https://api.github.com/users/joebieb/received_events","type":"User","site_admin":false},"created_at":"2018-07-28T20:18:11Z","updated_at":"2018-07-28T20:18:11Z","author_association":"NONE","body":"Thank you for the help. This code works and fires the @AfterUpdate method. There's probably a better way to map the req.body to the new ReportDetail object, but this works.\r\n\r\n```\r\n  public async save(req: Request, res: Response, next: NextFunction) {\r\n    let _detail = new ReportDetail();\r\n    for(var key in req.body) _detail[key]=req.body[key];\r\n    let result = getRepository(ReportDetail)\r\n                .save(_detail)\r\n                .then(result => res.send(result))\r\n                .catch(error => console.log(error));\r\n  };\r\n```"}}
{"actor":{"display_login":"joebieb"}}