primary photo on products table
CI / testsuite (mysql, 8.2, ) (push) Failing after 6m31s Details
CI / testsuite (mysql, 8.4, ) (push) Failing after 5m39s Details
CI / testsuite (sqlite, 8.2, prefer-lowest) (push) Failing after 6m13s Details
CI / Coding Standard & Static Analysis (push) Failing after 5m55s Details

This commit is contained in:
Brandon Shipley 2025-09-29 23:40:16 -07:00
parent fd0f9efa28
commit d49a8784e6
Signed by: bmfs
GPG Key ID: 14E38571D8BB0DE4
1 changed files with 14 additions and 0 deletions

View File

@ -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');