unique rules, allow product id to be null in product photos

This commit is contained in:
bs
2025-11-01 23:16:59 -07:00
parent 2041fc78d3
commit d239a98e8e
4 changed files with 31 additions and 2 deletions
@@ -108,6 +108,7 @@ class ProductCategoryAttributeOptionsTable extends Table
public function buildRules(RulesChecker $rules): RulesChecker
{
$rules->add($rules->existsIn(['product_category_attribute_id'], 'ProductCategoryAttributes'), ['errorField' => 'product_category_attribute_id']);
$rules->add($rules->isUnique(['attribute_value', 'product_category_attribute_id']));
return $rules;
}
@@ -105,6 +105,7 @@ class ProductCategoryVariantOptionsTable extends Table
public function buildRules(RulesChecker $rules): RulesChecker
{
$rules->add($rules->existsIn(['product_category_variant_id'], 'ProductCategoryVariants'), ['errorField' => 'product_category_variant_id']);
$rules->add($rules->isUnique(['variant_value', 'product_category_variant_id']));
return $rules;
}