deepkit-framework
deepkit-framework copied to clipboard
[Feature] Integrated ORM Plugin API
Currently there are actually no "plugin" support in the ORM implementation. The current SoftDelete plugin is just a mix of some other public APIs.
It can be better to have a integrated plugin support, like:
class SoftDeletePlugin implements OrmPlugin {
...
}
@entity.name("user").use(new SoftDeletePlugin)
class User {}
It should be an API that does not pull backend code, so that models can still be used in frontend (and elsewhere). Thus, it should be a declarative way.
Indeed. Then this should be able to work I think:
new Database(new MemoryDatabaseAdapter(), [User], [new SoftDeletePlugin()]);
@entity.data("soft-deletable", true)
class User {}
We should not forget interface entities:
interface User extends Entity<>, SoftDeletePlugin {
}