fix(product): Category repository missing ontext (#9688)

**What**
- Fix product category repository missing context passed to down level methods
- Ensure the base repository when getting the active manager returns a fresh one if possible instead of the global one in order to prevent shared entity map by mistake
This commit is contained in:
Adrien de Peretti
2024-10-21 11:42:17 +00:00
committed by GitHub
parent 63fff01f2f
commit 45df24f707
3 changed files with 35 additions and 37 deletions
@@ -6,9 +6,9 @@ import {
} from "@medusajs/framework/types"
import { DALUtils, isDefined, MedusaError } from "@medusajs/framework/utils"
import {
LoadStrategy,
FilterQuery as MikroFilterQuery,
FindOptions as MikroOptions,
LoadStrategy,
} from "@mikro-orm/core"
import { SqlEntityManager } from "@mikro-orm/postgresql"
import { ProductCategory } from "@models"
@@ -93,7 +93,8 @@ export class ProductCategoryRepository extends DALUtils.MikroOrmBaseTreeReposito
ancestors: transformOptions.includeAncestorsTree,
},
productCategories,
findOptions_
findOptions_,
context
)
return this.sortCategoriesByRank(categoriesTree)
@@ -250,7 +251,8 @@ export class ProductCategoryRepository extends DALUtils.MikroOrmBaseTreeReposito
ancestors: transformOptions.includeAncestorsTree,
},
productCategories,
findOptions_
findOptions_,
context
)
return [this.sortCategoriesByRank(categoriesTree), count]