toggle behavior on skus for default product sku, photos for default category photo and default product photo
This commit is contained in:
@@ -58,7 +58,22 @@ class ProductPhotosTable extends Table
|
||||
);
|
||||
|
||||
$this->addBehavior('Timestamp');
|
||||
|
||||
$this->addBehavior('Tools.Toggle', [
|
||||
'field' => 'primary_photo',
|
||||
'scopeFields' => ['product_id'],
|
||||
'scope' => [
|
||||
'deleted IS' => null,
|
||||
'product_id IS NOT' => null,
|
||||
],
|
||||
]);
|
||||
$this->addBehavior('CakeProducts.SecondToggle', [
|
||||
'field' => 'primary_category_photo',
|
||||
'scopeFields' => ['product_category_id'],
|
||||
'scope' => [
|
||||
'deleted IS' => null,
|
||||
'product_category_id IS NOT' => null,
|
||||
],
|
||||
]);
|
||||
$this->belongsTo('Products', [
|
||||
'foreignKey' => 'product_id',
|
||||
'joinType' => 'LEFT',
|
||||
|
||||
@@ -59,6 +59,13 @@ class ProductSkusTable extends Table
|
||||
);
|
||||
|
||||
$this->addBehavior('Timestamp');
|
||||
$this->addBehavior('Tools.Toggle', [
|
||||
'field' => 'default_sku',
|
||||
'scopeFields' => ['product_id'],
|
||||
'scope' => [
|
||||
'deleted IS' => null,
|
||||
],
|
||||
]);
|
||||
|
||||
$this->belongsTo('Products', [
|
||||
'className' => 'CakeProducts.Products',
|
||||
|
||||
Reference in New Issue
Block a user