typeorm-polymorphic icon indicating copy to clipboard operation
typeorm-polymorphic copied to clipboard

The implementation in the readme is wrong.

Open codeninja opened this issue 2 years ago • 3 comments

Or at least, I was having problems with it.

I could not use the extended repository without invoking getCustomRepository instead of the standard getRepository as stated in the readme.

@Entity()
export class Address implements PolymorphicChildInterface {
....
}

@EntityRepository(Address)
export class AddressRepository extends AbstractPolymorphicRepository<Address> {}
import { Address, AddressRepository } from '../';
let addressRepository: AbstractPolymorphicRepository<Address>;

addressRepository = await TestConnection.connection.getCustomRepository(AddressRepository);

codeninja avatar Mar 09 '22 01:03 codeninja

Ahh sorry, I use this heavily with nestjs so my implementation might be a lot different to yours!

bashleigh avatar Apr 19 '22 09:04 bashleigh

Can you give a complete example?

nizarfadlan avatar May 07 '23 03:05 nizarfadlan

@codeninja @bashleigh

Can you give a complete example?

nizarfadlan avatar May 07 '23 03:05 nizarfadlan