primary photo on products table
This commit is contained in:
parent
fd0f9efa28
commit
d49a8784e6
|
@ -83,6 +83,20 @@ class ProductsTable extends Table
|
||||||
'cascadeCallbacks' => true,
|
'cascadeCallbacks' => true,
|
||||||
]);
|
]);
|
||||||
|
|
||||||
|
$this->hasMany('ProductPhotos', [
|
||||||
|
'foreignKey' => 'product_id',
|
||||||
|
'className' => 'CakeProducts.ProductPhotos',
|
||||||
|
'dependent' => true,
|
||||||
|
'cascadeCallbacks' => true,
|
||||||
|
]);
|
||||||
|
|
||||||
|
$this->hasOne('PrimaryProductPhotos', [
|
||||||
|
'foreignKey' => 'product_id',
|
||||||
|
'conditions' => ['PrimaryProductPhotos.primary_photo' => true],
|
||||||
|
'className' => 'CakeProducts.ProductPhotos',
|
||||||
|
'dependent' => true,
|
||||||
|
]);
|
||||||
|
|
||||||
$this->getSchema()->setColumnType('product_type_id', EnumType::from(ProductProductTypeId::class));
|
$this->getSchema()->setColumnType('product_type_id', EnumType::from(ProductProductTypeId::class));
|
||||||
|
|
||||||
$this->addBehavior('Muffin/Trash.Trash');
|
$this->addBehavior('Muffin/Trash.Trash');
|
||||||
|
|
Loading…
Reference in New Issue