subscribtion category variants / system category variants

This commit is contained in:
2025-11-04 01:50:05 -08:00
parent 868f9dbcce
commit a471be8ff9
13 changed files with 254 additions and 12 deletions

View File

@@ -14,6 +14,7 @@ use Cake\ORM\Entity;
* @property string|null $product_category_id
* @property string|null $product_id
* @property bool $enabled
* @property bool $is_system_variant
*
* @property ProductCategory|EntityInterface $product_category
* @property ProductCategoryVariantOption[]|EntityInterface[] $product_category_variant_options
@@ -34,6 +35,7 @@ class ProductCategoryVariant extends Entity
'product_category_id' => true,
'product_id' => true,
'enabled' => true,
'is_system_variant' => true,
// entities
'product_category' => false,

View File

@@ -70,6 +70,7 @@ class ProductCategoryVariantsTable extends Table
'className' => 'CakeProducts.ProductCategoryVariantOptions',
'dependent' => true,
'cascadeCallbacks' => true,
'saveStrategy' => 'replace',
]);
$this->hasMany('ProductVariants', [
@@ -102,6 +103,10 @@ class ProductCategoryVariantsTable extends Table
->uuid('product_id')
->allowEmptyString('product_id');
$validator
->boolean('is_system_variant')
->allowEmptyString('is_system_variant');
$validator
->boolean('enabled')
->requirePresence('enabled', 'create')