EntityManager fails to return DefaultRepository if repository class is undefined
Closed this issue · 3 comments
mreiche commented
When the entity defines a @repository()
class, which is undefined.
@repository(ClientRepository)
@resource("/clients")
export class Client extends Entity {
@type('string')
name = null;
}
export class ClientRepository extends Repository {
}
The EntityManager fails to instantiate the default repository.
this.clientRepository = em.getRepository(Client);
ERROR [app-router] Error: Error invoking ClientsManager. Check the inner error for details.
------------------------------------------------
Inner Error:
Message: key/value cannot be null or undefined. Are you trying to inject/register something that doesn't exist with DI?
Inner Error Stack:
Error: key/value cannot be null or undefined. Are you trying to inject/register something that doesn't exist with DI?
at validateKey (http://localhost:9000/tycon/modules/backend/js/myty-aurelia.dev.js:13440:13)
at Container.get (http://localhost:9000/tycon/modules/backend/js/myty-aurelia.dev.js:13589:7)
at EntityManager.getRepository (http://localhost:9000/3rdParty/jspm_packages/npm/aurelia-orm@6.1.2/aurelia-orm.js:943:37)
RWOverdijk commented
If I understand correctly, this breaks when you try to register an invalid repository, correct? Because then we can add a check in the decorator to throw an error when this happens.
mreiche commented
Exactly.
RWOverdijk commented
@mreiche I'll keep this open for when I get back to building on our dashboard, unless someone else picks it up in the meantime.