subscribtion category variants / system category variants
This commit is contained in:
@@ -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,
|
||||
|
||||
@@ -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')
|
||||
|
||||
Reference in New Issue
Block a user