@mikro-orm/core 7.0.0-dev.193 → 7.0.0-dev.194

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.
@@ -26,6 +26,10 @@ export declare abstract class AbstractNamingStrategy implements NamingStrategy {
26
26
  * @inheritDoc
27
27
  */
28
28
  inverseSideName(entityName: string, propertyName: string, kind: ReferenceKind): string;
29
+ /**
30
+ * @inheritDoc
31
+ */
32
+ manyToManyPropertyName(ownerEntityName: string, targetEntityName: string, pivotTableName: string, ownerTableName: string, schemaName?: string): string;
29
33
  abstract classToTableName(entityName: string, tableName?: string): string;
30
34
  abstract joinColumnName(propertyName: string): string;
31
35
  abstract joinKeyColumnName(entityName: string, referencedColumnName?: string, composite?: boolean, tableName?: string): string;
@@ -79,4 +79,10 @@ export class AbstractNamingStrategy {
79
79
  }
80
80
  return entityName[0].toLowerCase() + entityName.substring(1) + suffix;
81
81
  }
82
+ /**
83
+ * @inheritDoc
84
+ */
85
+ manyToManyPropertyName(ownerEntityName, targetEntityName, pivotTableName, ownerTableName, schemaName) {
86
+ return this.columnNameToProperty(pivotTableName.replace(new RegExp('^' + ownerTableName + '_'), ''));
87
+ }
82
88
  }
@@ -85,4 +85,14 @@ export interface NamingStrategy {
85
85
  * Returns the name of the inverse side property. Used in the `EntityGenerator` with `bidirectionalRelations` option.
86
86
  */
87
87
  inverseSideName(entityName: string, propertyName: string, kind: ReferenceKind): string;
88
+ /**
89
+ * Return a property name for a many-to-many relation (used in `EntityGenerator`).
90
+ *
91
+ * @param ownerEntityName - The owner entity class name
92
+ * @param targetEntityName - The target entity class name
93
+ * @param pivotTableName - The pivot table name
94
+ * @param ownerTableName - The owner table name
95
+ * @param schemaName - The schema name (if any)
96
+ */
97
+ manyToManyPropertyName(ownerEntityName: string, targetEntityName: string, pivotTableName: string, ownerTableName: string, schemaName?: string): string;
88
98
  }
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.193",
4
+ "version": "7.0.0-dev.194",
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/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.193';
126
+ static #ORM_VERSION = '7.0.0-dev.194';
127
127
  /**
128
128
  * Checks if the argument is instance of `Object`. Returns false for arrays.
129
129
  */