product attributes

This commit is contained in:
bs
2025-04-05 02:06:23 -07:00
parent 4e6b7ca1ac
commit bb1dab1f43
12 changed files with 319 additions and 12 deletions
+4
View File
@@ -58,6 +58,9 @@ class ProductsTable extends Table
'className' => 'CakeProducts.ProductCategories',
]);
$this->hasMany('ProductAttributes', [
'className' => 'CakeProducts.ProductAttributes',
]);
$this->getSchema()->setColumnType('product_type_id', EnumType::from(ProductProductTypeId::class));
}
@@ -99,6 +102,7 @@ class ProductsTable extends Table
{
$rules->add($rules->isUnique(['product_category_id', 'name']), ['errorField' => 'product_category_id']);
$rules->add($rules->existsIn(['product_category_id'], 'ProductCategories'), ['errorField' => 'product_category_id']);
// $rules->add($rules->validCount('product_attributes', 0, '<=', 'You must not have any tags'));
return $rules;
}