@mikro-orm/core 7.0.3-dev.14 → 7.0.3-dev.16

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/EntityManager.js CHANGED
@@ -405,8 +405,22 @@ export class EntityManager {
405
405
  continue;
406
406
  }
407
407
  options = { ...options, filters: QueryHelper.mergePropertyFilters(prop.filters, options.filters) };
408
- const cond = await this.applyFilters(prop.targetMeta.class, {}, options.filters, 'read', options);
409
- if (!Utils.isEmpty(cond)) {
408
+ // For polymorphic relations, check all targets for filters (not just the first targetMeta)
409
+ let hasActiveFilter = false;
410
+ if (prop.polymorphic && prop.polymorphTargets?.length) {
411
+ for (const targetMeta of prop.polymorphTargets) {
412
+ const cond = await this.applyFilters(targetMeta.class, {}, options.filters, 'read', options);
413
+ if (!Utils.isEmpty(cond)) {
414
+ hasActiveFilter = true;
415
+ break;
416
+ }
417
+ }
418
+ }
419
+ else {
420
+ const cond = await this.applyFilters(prop.targetMeta.class, {}, options.filters, 'read', options);
421
+ hasActiveFilter = !Utils.isEmpty(cond);
422
+ }
423
+ if (hasActiveFilter) {
410
424
  const populated = options.populate.filter(({ field }) => field.split(':')[0] === prop.name);
411
425
  let found = false;
412
426
  for (const hint of populated) {
package/README.md CHANGED
@@ -64,7 +64,7 @@ export class Book extends BookSchema.class {}
64
64
  BookSchema.setClass(Book);
65
65
  ```
66
66
 
67
- You can also define entities using [decorators](https://mikro-orm.io/docs/defining-entities) or [`EntitySchema`](https://mikro-orm.io/docs/entity-schema). See the [defining entities guide](https://mikro-orm.io/docs/defining-entities) for all options.
67
+ You can also define entities using [decorators](https://mikro-orm.io/docs/using-decorators) or [`EntitySchema`](https://mikro-orm.io/docs/define-entity#entityschema-low-level-api). See the [defining entities guide](https://mikro-orm.io/docs/defining-entities) for all options.
68
68
 
69
69
  ### Initialize and Use
70
70
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mikro-orm/core",
3
- "version": "7.0.3-dev.14",
3
+ "version": "7.0.3-dev.16",
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
  "keywords": [
6
6
  "data-mapper",
package/utils/Utils.js CHANGED
@@ -129,7 +129,7 @@ export function parseJsonSafe(value) {
129
129
  /** Collection of general-purpose utility methods used throughout the ORM. */
130
130
  export class Utils {
131
131
  static PK_SEPARATOR = '~~~';
132
- static #ORM_VERSION = '7.0.3-dev.14';
132
+ static #ORM_VERSION = '7.0.3-dev.16';
133
133
  /**
134
134
  * Checks if the argument is instance of `Object`. Returns false for arrays.
135
135
  */