get product skus table via product photos in product photos controller
This commit is contained in:
@@ -104,7 +104,7 @@ class ProductPhotosController extends AppController
|
||||
$this->Flash->error(__('The product photo could not be saved. Please, try again.'));
|
||||
}
|
||||
$products = $productPhotosTable->Products->find('list', limit: 200)->all();
|
||||
$productSkus = $productPhotosTable->Products->ProductSkus->find('list', limit: 200)->all();
|
||||
$productSkus = $productPhotosTable->ProductSkus->find('list', limit: 200)->all();
|
||||
|
||||
$this->set(compact('productPhoto', 'products', 'productSkus'));
|
||||
}
|
||||
@@ -132,7 +132,7 @@ class ProductPhotosController extends AppController
|
||||
$this->Flash->error(__('The product photo could not be saved. Please, try again.'));
|
||||
}
|
||||
$products = $productPhotosTable->Products->find('list', limit: 200)->all();
|
||||
$productSkus = $productPhotosTable->Products->ProductSkus->find('list', limit: 200)->all();
|
||||
$productSkus = $productPhotosTable->ProductSkus->find('list', limit: 200)->all();
|
||||
$this->set(compact('productPhoto', 'products', 'productSkus'));
|
||||
}
|
||||
|
||||
|
||||
@@ -18,6 +18,7 @@ use Psr\SimpleCache\CacheInterface;
|
||||
* ProductPhotos Model
|
||||
*
|
||||
* @property ProductsTable&BelongsTo $Products
|
||||
* @property ProductSkusTable&BelongsTo $ProductSkus
|
||||
*
|
||||
* @method ProductPhoto newEmptyEntity()
|
||||
* @method ProductPhoto newEntity(array $data, array $options = [])
|
||||
|
||||
@@ -71,6 +71,13 @@ class ProductsTable extends Table
|
||||
'cascadeCallbacks' => true,
|
||||
]);
|
||||
|
||||
// $this->hasMany('ProductSkus', [
|
||||
// 'foreignKey' => 'product_id',
|
||||
// 'className' => 'CakeProducts.ProductSkus',
|
||||
// 'dependent' => true,
|
||||
// 'cascadeCallbacks' => true,
|
||||
// ]);
|
||||
|
||||
$this->getSchema()->setColumnType('product_type_id', EnumType::from(ProductProductTypeId::class));
|
||||
|
||||
$this->addBehavior('Muffin/Trash.Trash');
|
||||
|
||||
Reference in New Issue
Block a user