@mikro-orm/core 7.0.0-dev.121 → 7.0.0-dev.122
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/entity/BaseEntity.d.ts +2 -1
- package/entity/EntityHelper.js +5 -0
- package/package.json +1 -1
- package/typings.d.ts +1 -1
- package/utils/Utils.js +1 -1
package/entity/BaseEntity.d.ts
CHANGED
|
@@ -4,10 +4,11 @@ import { type AssignOptions } from './EntityAssigner.js';
|
|
|
4
4
|
import type { EntityLoaderOptions } from './EntityLoader.js';
|
|
5
5
|
import { type SerializeOptions } from '../serialization/EntitySerializer.js';
|
|
6
6
|
import type { FindOneOptions } from '../drivers/IDatabaseDriver.js';
|
|
7
|
+
import type { PopulatePath } from '../enums.js';
|
|
7
8
|
export declare abstract class BaseEntity {
|
|
8
9
|
isInitialized(): boolean;
|
|
9
10
|
populated(populated?: boolean): void;
|
|
10
|
-
populate<Entity extends this = this, Hint extends string = never>(populate: AutoPath<Entity, Hint>[] | false, options?: EntityLoaderOptions<Entity>): Promise<Loaded<Entity, Hint>>;
|
|
11
|
+
populate<Entity extends this = this, Hint extends string = never>(populate: AutoPath<Entity, Hint, PopulatePath.ALL>[] | false, options?: EntityLoaderOptions<Entity>): Promise<Loaded<Entity, Hint>>;
|
|
11
12
|
toReference<Entity extends this = this>(): Ref<Entity> & LoadedReference<Loaded<Entity, AddEager<Entity>>>;
|
|
12
13
|
toObject<Entity extends this = this>(): EntityDTO<Entity>;
|
|
13
14
|
toObject<Entity extends this = this>(ignoreFields: never[]): EntityDTO<Entity>;
|
package/entity/EntityHelper.js
CHANGED
|
@@ -213,6 +213,11 @@ export class EntityHelper {
|
|
|
213
213
|
helper(other).__em?.getUnitOfWork().scheduleOrphanRemoval(other);
|
|
214
214
|
}
|
|
215
215
|
}
|
|
216
|
+
// Skip setting the inverse side to null if it's a primary key - the entity will be removed via orphan removal
|
|
217
|
+
// Setting a primary key to null would corrupt the entity and cause validation errors
|
|
218
|
+
if (value == null && prop.orphanRemoval && prop2.primary) {
|
|
219
|
+
return;
|
|
220
|
+
}
|
|
216
221
|
if (value == null) {
|
|
217
222
|
entity[prop2.name] = value;
|
|
218
223
|
}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mikro-orm/core",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "7.0.0-dev.
|
|
4
|
+
"version": "7.0.0-dev.122",
|
|
5
5
|
"description": "TypeScript ORM for Node.js based on Data Mapper, Unit of Work and Identity Map patterns. Supports MongoDB, MySQL, PostgreSQL and SQLite databases as well as usage with vanilla JavaScript.",
|
|
6
6
|
"exports": {
|
|
7
7
|
"./package.json": "./package.json",
|
package/typings.d.ts
CHANGED
|
@@ -159,7 +159,7 @@ export interface IWrappedEntity<Entity extends object> {
|
|
|
159
159
|
isInitialized(): boolean;
|
|
160
160
|
isManaged(): boolean;
|
|
161
161
|
populated(populated?: boolean): void;
|
|
162
|
-
populate<Hint extends string = never>(populate: AutoPath<Entity, Hint>[] | false, options?: EntityLoaderOptions<Entity>): Promise<Loaded<Entity, Hint>>;
|
|
162
|
+
populate<Hint extends string = never>(populate: readonly AutoPath<Entity, Hint, PopulatePath.ALL>[] | false, options?: EntityLoaderOptions<Entity>): Promise<Loaded<Entity, Hint>>;
|
|
163
163
|
init<Hint extends string = never, Fields extends string = '*', Exclude extends string = never>(options?: FindOneOptions<Entity, Hint, Fields, Exclude>): Promise<Loaded<Entity, Hint, Fields, Exclude> | null>;
|
|
164
164
|
toReference(): Ref<Entity> & LoadedReference<Loaded<Entity, AddEager<Entity>>>;
|
|
165
165
|
toObject(): EntityDTO<Entity>;
|
package/utils/Utils.js
CHANGED
|
@@ -123,7 +123,7 @@ export function parseJsonSafe(value) {
|
|
|
123
123
|
}
|
|
124
124
|
export class Utils {
|
|
125
125
|
static PK_SEPARATOR = '~~~';
|
|
126
|
-
static #ORM_VERSION = '7.0.0-dev.
|
|
126
|
+
static #ORM_VERSION = '7.0.0-dev.122';
|
|
127
127
|
/**
|
|
128
128
|
* Checks if the argument is instance of `Object`. Returns false for arrays.
|
|
129
129
|
*/
|