From 9d9c32f0b9cdb7219f85f56de77e90c9588edd52 Mon Sep 17 00:00:00 2001 From: Brandon Shipley Date: Thu, 4 Sep 2025 22:49:23 -0700 Subject: [PATCH] add the contain for product skus on products --- src/Model/Table/ProductsTable.php | 12 ++++++------ tests/TestCase/Model/Table/ProductsTableTest.php | 1 + 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/src/Model/Table/ProductsTable.php b/src/Model/Table/ProductsTable.php index e5539c0..38d53f9 100644 --- a/src/Model/Table/ProductsTable.php +++ b/src/Model/Table/ProductsTable.php @@ -76,12 +76,12 @@ class ProductsTable extends Table 'cascadeCallbacks' => true, ]); -// $this->hasMany('ProductSkus', [ -// 'foreignKey' => 'product_id', -// 'className' => 'CakeProducts.ProductSkus', -// 'dependent' => true, -// 'cascadeCallbacks' => true, -// ]); + $this->hasMany('ProductSkus', [ + 'foreignKey' => 'product_id', + 'className' => 'CakeProducts.ProductSkus', + 'dependent' => true, + 'cascadeCallbacks' => true, + ]); $this->getSchema()->setColumnType('product_type_id', EnumType::from(ProductProductTypeId::class)); diff --git a/tests/TestCase/Model/Table/ProductsTableTest.php b/tests/TestCase/Model/Table/ProductsTableTest.php index 94b75a5..c183989 100644 --- a/tests/TestCase/Model/Table/ProductsTableTest.php +++ b/tests/TestCase/Model/Table/ProductsTableTest.php @@ -65,6 +65,7 @@ class ProductsTableTest extends TestCase 'ProductCategories', 'ProductAttributes', 'ProductCategoryVariants', + 'ProductSkus', ]; $associations = $this->Products->associations();