Commit Graph

4 Commits

Author SHA1 Message Date
Amir Jafarian e038b28e8c Fix manually 2016-10-19 17:35:26 -04:00
Amir Jafarian a1683fca59 Auto-update by eslint --fix 2016-10-19 17:04:05 -04:00
Miroslav Bajtoš bec9142100 Implement operation hooks for EmbedsMany methods
create() triggers
 - before save
 - after save

updateById() triggers
 - before save
 - after save

destroy() triggers
 - before delete
 - after delete

The implementation here is intentionally left with less features
than the regular DAO methods provide, the goal is to get a partial
(but still useful!) version released soon.

Limitations:

 - `before save` & `after save` hooks don't provide `ctx.isNewInstance`
 - async validations are not supported yet
 - `persist` and `loaded` hooks are not triggered at all

 - `before delete` hook does not provide `ctx.where` property and
    it's not possible to change the outcome of `destroy()` using this
    hook. Note that regular DAO does support this.

 - updating embedded instances triggers update of the parent (owning)
   model, which is correct and expected. However, the context provided
   by `before save` and `after save` hooks on the parent model is sort of
   arbitrary and may include wrong/extra data. The same probably applies
   to the scenario when deleting embedded instances triggers update of
   the parent model.

[back-port of #911]
2016-04-28 10:15:14 +02:00
Miroslav Bajtoš f65b542dab Implement operation hooks for EmbedsOne methods
create() triggers
 - before save
 - after save

udpate() triggers
 - before save
 - after save

destroy() triggers
 - before delete
 - after delete

The implementation here is intentionally left with less features
than the regular DAO methods provide, the goal is to get a partial
(but still useful!) version released soon.

[back-port of #904]
2016-04-20 10:30:56 +02:00