variant options coming along - add test passing

This commit is contained in:
2025-07-05 20:48:40 -07:00
parent 5adc791c20
commit 59a38758e9
11 changed files with 110 additions and 24 deletions

View File

@@ -57,6 +57,8 @@ class ProductCategoryVariantsTable extends Table
$this->hasMany('ProductCategoryVariantOptions', [
'foreignKey' => 'product_category_variant_id',
'className' => 'CakeProducts.ProductCategoryVariantOptions',
'dependent' => true,
'cascadeCallbacks' => true,
]);
}
@@ -99,7 +101,7 @@ class ProductCategoryVariantsTable extends Table
*/
public function buildRules(RulesChecker $rules): RulesChecker
{
$rules->add($rules->isUnique(['name', 'product_category_id', 'product_id'], ['allowMultipleNulls' => true]), ['errorField' => 'product_category_id']);
// $rules->add($rules->isUnique(['name', 'product_category_id', 'product_id'], ['allowMultipleNulls' => true]), ['errorField' => 'product_category_id']);
$rules->add($rules->existsIn(['product_category_id'], 'ProductCategories'), ['errorField' => 'product_category_id']);
$rules->add($rules->existsIn(['product_id'], 'Products'), ['errorField' => 'product_id']);