Returns properties that are safe to clone (persistable, non-PK, non-generated).
(meta: EntityMetadata)
| 3517 | |
| 3518 | /** Returns properties that are safe to clone (persistable, non-PK, non-generated). */ |
| 3519 | private getCloneableProps(meta: EntityMetadata): EntityProperty[] { |
| 3520 | return meta.props.filter(prop => { |
| 3521 | if (prop.persist === false) { |
| 3522 | return false; |
| 3523 | } |
| 3524 | if (prop.primary) { |
| 3525 | return false; |
| 3526 | } |
| 3527 | if (!prop.fieldNames?.length) { |
| 3528 | return false; |
| 3529 | } |
| 3530 | if ([ReferenceKind.ONE_TO_MANY, ReferenceKind.MANY_TO_MANY].includes(prop.kind)) { |
| 3531 | return false; |
| 3532 | } |
| 3533 | if (prop.kind === ReferenceKind.EMBEDDED && !prop.object) { |
| 3534 | return false; |
| 3535 | } |
| 3536 | return true; |
| 3537 | }); |
| 3538 | } |
| 3539 | |
| 3540 | private applyDiscriminatorCondition(): void { |
| 3541 | const meta = this.mainAlias.meta; |
no test coverage detected