(
entity: T,
meta: EntityMetadata<T>,
data: EntityData<T>,
options: FactoryOptions,
)
| 516 | } |
| 517 | |
| 518 | private hydrate<T extends object>( |
| 519 | entity: T, |
| 520 | meta: EntityMetadata<T>, |
| 521 | data: EntityData<T>, |
| 522 | options: FactoryOptions, |
| 523 | ): void { |
| 524 | if (options.initialized) { |
| 525 | this.#hydrator.hydrate( |
| 526 | entity, |
| 527 | meta, |
| 528 | data, |
| 529 | this, |
| 530 | 'full', |
| 531 | options.newEntity, |
| 532 | options.convertCustomTypes, |
| 533 | options.schema, |
| 534 | this.#driver.getSchemaName(meta, options), |
| 535 | options.normalizeAccessors, |
| 536 | ); |
| 537 | } else { |
| 538 | this.#hydrator.hydrateReference( |
| 539 | entity, |
| 540 | meta, |
| 541 | data, |
| 542 | this, |
| 543 | options.convertCustomTypes, |
| 544 | options.schema, |
| 545 | this.#driver.getSchemaName(meta, options), |
| 546 | options.normalizeAccessors, |
| 547 | ); |
| 548 | } |
| 549 | |
| 550 | Utils.keys(data).forEach(key => { |
| 551 | helper(entity)?.__loadedProperties.add(key); |
| 552 | helper(entity)?.__serializationContext.fields?.add(key); |
| 553 | }); |
| 554 | |
| 555 | const processOnCreateHooksEarly = |
| 556 | options.processOnCreateHooksEarly ?? this.#config.get('processOnCreateHooksEarly'); |
| 557 | |
| 558 | if (options.newEntity && processOnCreateHooksEarly) { |
| 559 | this.assignDefaultValues(entity, meta); |
| 560 | } |
| 561 | } |
| 562 | |
| 563 | private findEntity<T extends object>( |
| 564 | data: EntityData<T>, |
no test coverage detected