Repository navigation
Entity Factory - #3962
Entity Factory#3962
Conversation
…er to createEntity method. Created documentation.
|
@pleerock When you review and merge this PR, would you mind also exporting I forgot to add this line in export {EntityFactoryInterface} from "./entity-factory/EntityFactoryInterface"; |
|
The only names I came up with are |
| let connections: Connection[]; | ||
| before(async () => connections = await createTestingConnections({ | ||
| entities: [Post, Blog, Category, UserEntity, QuestionEntity], | ||
| entityFactory: new OldEntityFactory() |
There was a problem hiding this comment.
why do we need it now? Are tests failing without old entity factory now?
There was a problem hiding this comment.
Yes, we need it, otherwise this line is failing. With new entity factory fields aren't initialized. We could remove that part of test if we don't want to use OldEntityFactory(if it's just temporary).
| before(async () => connections = await createTestingConnections({ | ||
| entities: [__dirname + "/entity/*{.js,.ts}"], | ||
| subscribers: [__dirname + "/subscriber/*{.js,.ts}"], | ||
| entityFactory: new OldEntityFactory() |
There was a problem hiding this comment.
why do we need it now? Are those tests failing without old entity factory now?
There was a problem hiding this comment.
As above - fields are initialized. To make it work without OldEntityFactory we would have to change them to check for undefined values.
| @@ -0,0 +1,14 @@ | |||
| import { EntityFactoryInterface } from './EntityFactoryInterface'; | |||
|
|
|||
| export class OldEntityFactory implements EntityFactoryInterface { | |||
There was a problem hiding this comment.
Alternatively we could just point code example in the changelog how user can do same without this being in the codebase. Im okay with OldEntityFactory name btw since it would be very temporary.
export it if you need it |
I don't need it, but some people might it if they want to implement a factory class that implements Thanks @Kononnable for exporting that interface. |
|
@Kononnable can we merge it? |
|
Yes, I think we can merge it. |
Following PR #3910
Implemented Old Entity Factory.
Added optional EntityMetadata parameter to createEntity method.
Created documentation.