@mikro-orm/core 6.3.5-dev.0 → 6.3.5-dev.2
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.
|
@@ -132,11 +132,35 @@ export declare class EntityRepository<Entity extends object> {
|
|
|
132
132
|
*/
|
|
133
133
|
populate<Ent extends Entity | Entity[], Hint extends string = never, Naked extends FromEntityType<Entity> = FromEntityType<Entity>, Fields extends string = '*', Excludes extends string = never>(entities: Ent, populate: AutoPath<Naked, Hint, PopulatePath.ALL>[] | false, options?: EntityLoaderOptions<Naked, Fields, Excludes>): Promise<Ent extends object[] ? MergeLoaded<ArrayElement<Ent>, Naked, Hint, Fields, Excludes>[] : MergeLoaded<Ent, Naked, Hint, Fields, Excludes>>;
|
|
134
134
|
/**
|
|
135
|
-
*
|
|
135
|
+
* Creates new instance of given entity and populates it with given data.
|
|
136
|
+
* The entity constructor will be used unless you provide `{ managed: true }` in the `options` parameter.
|
|
137
|
+
* The constructor will be given parameters based on the defined constructor of the entity. If the constructor
|
|
138
|
+
* parameter matches a property name, its value will be extracted from `data`. If no matching property exists,
|
|
139
|
+
* the whole `data` parameter will be passed. This means we can also define `constructor(data: Partial<T>)` and
|
|
140
|
+
* `em.create()` will pass the data into it (unless we have a property named `data` too).
|
|
141
|
+
*
|
|
142
|
+
* The parameters are strictly checked, you need to provide all required properties. You can use `OptionalProps`
|
|
143
|
+
* symbol to omit some properties from this check without making them optional. Alternatively, use `partial: true`
|
|
144
|
+
* in the options to disable the strict checks for required properties. This option has no effect on runtime.
|
|
145
|
+
*
|
|
146
|
+
* The newly created entity will be automatically marked for persistence via `em.persist` unless you disable this
|
|
147
|
+
* behavior, either locally via `persist: false` option, or globally via `persistOnCreate` ORM config option.
|
|
136
148
|
*/
|
|
137
149
|
create<Convert extends boolean = false>(data: RequiredEntityData<Entity, never, Convert>, options?: CreateOptions<Convert>): Entity;
|
|
138
150
|
/**
|
|
139
|
-
*
|
|
151
|
+
* Creates new instance of given entity and populates it with given data.
|
|
152
|
+
* The entity constructor will be used unless you provide `{ managed: true }` in the `options` parameter.
|
|
153
|
+
* The constructor will be given parameters based on the defined constructor of the entity. If the constructor
|
|
154
|
+
* parameter matches a property name, its value will be extracted from `data`. If no matching property exists,
|
|
155
|
+
* the whole `data` parameter will be passed. This means we can also define `constructor(data: Partial<T>)` and
|
|
156
|
+
* `em.create()` will pass the data into it (unless we have a property named `data` too).
|
|
157
|
+
*
|
|
158
|
+
* The parameters are strictly checked, you need to provide all required properties. You can use `OptionalProps`
|
|
159
|
+
* symbol to omit some properties from this check without making them optional. Alternatively, use `partial: true`
|
|
160
|
+
* in the options to disable the strict checks for required properties. This option has no effect on runtime.
|
|
161
|
+
*
|
|
162
|
+
* The newly created entity will be automatically marked for persistence via `em.persist` unless you disable this
|
|
163
|
+
* behavior, either locally via `persist: false` option, or globally via `persistOnCreate` ORM config option.
|
|
140
164
|
*/
|
|
141
165
|
create<Convert extends boolean = false>(data: EntityData<Entity, Convert>, options: CreateOptions<Convert> & {
|
|
142
166
|
partial: true;
|
|
@@ -153,7 +153,19 @@ class EntityRepository {
|
|
|
153
153
|
return this.getEntityManager().populate(entities, populate, options);
|
|
154
154
|
}
|
|
155
155
|
/**
|
|
156
|
-
*
|
|
156
|
+
* Creates new instance of given entity and populates it with given data.
|
|
157
|
+
* The entity constructor will be used unless you provide `{ managed: true }` in the `options` parameter.
|
|
158
|
+
* The constructor will be given parameters based on the defined constructor of the entity. If the constructor
|
|
159
|
+
* parameter matches a property name, its value will be extracted from `data`. If no matching property exists,
|
|
160
|
+
* the whole `data` parameter will be passed. This means we can also define `constructor(data: Partial<T>)` and
|
|
161
|
+
* `em.create()` will pass the data into it (unless we have a property named `data` too).
|
|
162
|
+
*
|
|
163
|
+
* The parameters are strictly checked, you need to provide all required properties. You can use `OptionalProps`
|
|
164
|
+
* symbol to omit some properties from this check without making them optional. Alternatively, use `partial: true`
|
|
165
|
+
* in the options to disable the strict checks for required properties. This option has no effect on runtime.
|
|
166
|
+
*
|
|
167
|
+
* The newly created entity will be automatically marked for persistence via `em.persist` unless you disable this
|
|
168
|
+
* behavior, either locally via `persist: false` option, or globally via `persistOnCreate` ORM config option.
|
|
157
169
|
*/
|
|
158
170
|
create(data, options) {
|
|
159
171
|
return this.getEntityManager().create(this.entityName, data, options);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mikro-orm/core",
|
|
3
|
-
"version": "6.3.5-dev.
|
|
3
|
+
"version": "6.3.5-dev.2",
|
|
4
4
|
"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.",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"module": "index.mjs",
|
|
@@ -64,7 +64,7 @@
|
|
|
64
64
|
"esprima": "4.0.1",
|
|
65
65
|
"fs-extra": "11.2.0",
|
|
66
66
|
"globby": "11.1.0",
|
|
67
|
-
"mikro-orm": "6.3.5-dev.
|
|
67
|
+
"mikro-orm": "6.3.5-dev.2",
|
|
68
68
|
"reflect-metadata": "0.2.2"
|
|
69
69
|
}
|
|
70
70
|
}
|