This commit is contained in:
bs
2026-08-26 00:46:31 -07:00
parent 51313b001e
commit 7e646f80dc
22 changed files with 246 additions and 201 deletions
@@ -13,11 +13,11 @@ class ExternalProductCatalogsProductCatalogsController extends AppController {
/** /**
* Add method * Add method
* *
* @return \Cake\Http\Response|voidRedirects|null on successful add, renders view otherwise. * @return \Cake\Http\Response|null|void Redirects on successful add, renders view otherwise.
*/ */
public function add() { public function add() {
Log::debug('inside external product catalogs product catalogs controller add'); Log::debug('inside external product catalogs product catalogs controller add');
$productCatalogs = $this->ExternalProductCatalogsProductCatalogs->ProductCatalogs->find('list')->toArray(); $productCatalogs = $this->fetchTable('ProductCatalogs')->find('list')->toArray();
$this->set(compact('productCatalogs')); $this->set(compact('productCatalogs'));
} }
@@ -30,8 +30,8 @@ class ExternalProductCatalogsProductCatalogsController extends AppController {
*/ */
public function delete($id = null) { public function delete($id = null) {
$this->request->allowMethod(['post', 'delete']); $this->request->allowMethod(['post', 'delete']);
$externalProductCatalogProductCatalog = $this->ExternalProductCatalogsProductCatalogs->get($id); $externalProductCatalogProductCatalog = $this->fetchTable()->get($id);
if ($this->ExternalProductCatalogsProductCatalogs->delete($externalProductCatalogProductCatalog)) { if ($this->fetchTable()->delete($externalProductCatalogProductCatalog)) {
$this->Flash->success(__('The customers contact has been deleted.')); $this->Flash->success(__('The customers contact has been deleted.'));
} else { } else {
$this->Flash->error(__('The customers contact could not be deleted. Please, try again.')); $this->Flash->error(__('The customers contact could not be deleted. Please, try again.'));
+15 -18
View File
@@ -18,8 +18,6 @@ class ProductCategoriesController extends AppController {
*/ */
public function initialize(): void { public function initialize(): void {
parent::initialize(); // TODO: Change the autogenerated stub parent::initialize(); // TODO: Change the autogenerated stub
// $this->_defaultTable = 'CakeProducts.ProductCategories';
// $this->_tableConfigKey = 'CakeProducts.ProductCategories.table';
} }
/** /**
@@ -52,7 +50,7 @@ class ProductCategoriesController extends AppController {
'PrimaryProductPhotos', 'PrimaryProductPhotos',
]); ]);
$productCategoryAttributes = $this->ProductCategories->ProductCategoryAttributes->getAllCategoryAttributesForCategoryId($productCategory->internal_id); $productCategoryAttributes = $this->fetchTable('CakeProducts.ProductCategoryAttributes')->getAllCategoryAttributesForCategoryId($productCategory->internal_id) ?? [];
$this->set(compact('productCategory', 'productCategoryAttributes')); $this->set(compact('productCategory', 'productCategoryAttributes'));
} }
@@ -87,8 +85,8 @@ class ProductCategoriesController extends AppController {
} }
$this->Flash->error(__('The product category could not be saved. Please, try again.')); $this->Flash->error(__('The product category could not be saved. Please, try again.'));
} }
$productCatalogs = $productCategoriesTable->ProductCatalogs->find('list', limit: 200)->all(); $productCatalogs = $this->fetchTable('ProductCatalogs')->find('list', limit: 200)->all();
$parentProductCategories = $productCategoriesTable->ParentProductCategories->find('treeList', limit: 200)->toArray(); $parentProductCategories = $this->fetchTable('ProductCategories')->find('list', limit: 200)->all();
$this->set(compact('productCategory', 'productCatalogs', 'parentProductCategories')); $this->set(compact('productCategory', 'productCatalogs', 'parentProductCategories'));
} }
@@ -100,20 +98,21 @@ class ProductCategoriesController extends AppController {
* @return \Cake\Http\Response|null|void Redirects on successful edit, renders view otherwise. * @return \Cake\Http\Response|null|void Redirects on successful edit, renders view otherwise.
*/ */
public function edit($id = null) { public function edit($id = null) {
$productCategoriesTable = $this->ProductCategories; $productCategoriesTable = $this->fetchTable();
$productCategory = $productCategoriesTable->get($id, contain: []); $productCategory = $this->ProductCategories->get($id, contain: []);
if ($this->request->is(['patch', 'post', 'put'])) { if ($this->request->is(['patch', 'post', 'put'])) {
$postData = $this->request->getData(); $postData = $this->request->getData();
$productCategory = $productCategoriesTable->patchEntity($productCategory, $postData); $productCategory = $this->ProductCategories->patchEntity($productCategory, $postData);
if ($productCategoriesTable->save($productCategory)) { if ($this->ProductCategories->save($productCategory)) {
$this->Flash->success(__('The product category has been saved.')); $this->Flash->success(__('The product category has been saved.'));
return $this->redirect(['action' => 'index']); return $this->redirect(['action' => 'index']);
} }
$this->Flash->error(__('The product category could not be saved. Please, try again.')); $this->Flash->error(__('The product category could not be saved. Please, try again.'));
} }
$productCatalogs = $productCategoriesTable->ProductCatalogs->find('list', limit: 200)->all(); $productCatalogs = $this->fetchTable('ProductCatalogs')->find('list', limit: 200)->all();
$parentProductCategories = $productCategoriesTable->ParentProductCategories->find('list', limit: 200)->all(); $parentProductCategories = $this->fetchTable('ProductCategories')->find('list', limit: 200)->all();
$this->set(compact('productCategory', 'productCatalogs', 'parentProductCategories')); $this->set(compact('productCategory', 'productCatalogs', 'parentProductCategories'));
} }
@@ -126,15 +125,14 @@ class ProductCategoriesController extends AppController {
*/ */
public function delete($id = null) { public function delete($id = null) {
$this->request->allowMethod(['post', 'delete']); $this->request->allowMethod(['post', 'delete']);
$productCategoriesTable = $this->ProductCategories;
$productCategory = $productCategoriesTable->get($id); $productCategory = $this->ProductCategories->get($id);
// $productCategoriesTable->behaviors()->get('Tree')->setConfig([ // $productCategoriesTable->behaviors()->get('Tree')->setConfig([
// 'scope' => [ // 'scope' => [
// 'product_catalog_id' => $productCategory->product_catalog_id, // 'product_catalog_id' => $productCategory->product_catalog_id,
// ], // ],
// ]); // ]);
if ($productCategoriesTable->delete($productCategory)) { if ($this->ProductCategories->delete($productCategory)) {
$this->Flash->success(__('The product category has been deleted.')); $this->Flash->success(__('The product category has been deleted.'));
} else { } else {
$this->Flash->error(__('The product category could not be deleted. Please, try again.')); $this->Flash->error(__('The product category could not be deleted. Please, try again.'));
@@ -147,15 +145,14 @@ class ProductCategoriesController extends AppController {
* @return \Cake\Http\Response|null|void Renders view * @return \Cake\Http\Response|null|void Renders view
*/ */
public function select() { public function select() {
$productCategoriesTable = $this->ProductCategories; $this->ProductCategories->getBehavior('Tree')->setConfig([
$productCategoriesTable->behaviors()->get('Tree')->setConfig([
'scope' => [ 'scope' => [
'product_catalog_id' => $this->request->getQuery('product_catalog_id', -1), 'product_catalog_id' => $this->request->getQuery('product_catalog_id', -1),
], ],
]); ]);
$productCategoriesQ = $this->request->getQuery('form', 'product_category') === 'product' ? $productCategoriesQ = $this->request->getQuery('form', 'product_category') === 'product' ?
$productCategoriesTable->find('treeList', keyPath: 'internal_id', valuePath: 'name') : $this->ProductCategories->find('treeList', keyPath: 'internal_id', valuePath: 'name') :
$productCategoriesTable->find('treeList'); $this->ProductCategories->find('treeList');
$productCategories = $productCategoriesQ $productCategories = $productCategoriesQ
->orderBy(['ProductCategories.name']) ->orderBy(['ProductCategories.name'])
@@ -17,8 +17,6 @@ class ProductCategoryAttributesController extends AppController {
*/ */
public function initialize(): void { public function initialize(): void {
parent::initialize(); // TODO: Change the autogenerated stub parent::initialize(); // TODO: Change the autogenerated stub
// $this->_defaultTable = 'CakeProducts.ProductCategoryAttributes';
// $this->_tableConfigKey = 'CakeProducts.ProductCategoryAttributes.table';
} }
/** /**
@@ -27,7 +25,7 @@ class ProductCategoryAttributesController extends AppController {
* @return \Cake\Http\Response|null|void Renders view * @return \Cake\Http\Response|null|void Renders view
*/ */
public function index() { public function index() {
$query = $this->ProductCategoryAttributes->find() $query = $this->fetchTable()->find()
->contain(['ProductCategories']); ->contain(['ProductCategories']);
$productCategoryAttributes = $this->paginate($query); $productCategoryAttributes = $this->paginate($query);
@@ -38,11 +36,11 @@ class ProductCategoryAttributesController extends AppController {
* View method * View method
* *
* @param string|null $id Product Category Attribute id. * @param string|null $id Product Category Attribute id.
* @throws RecordNotFoundException When record not found. * @throws \Cake\Datasource\Exception\RecordNotFoundException When record not found.
* @return Response|null|void Renders view * @return \Cake\Http\Response|null|void Renders view
*/ */
public function view($id = null) { public function view($id = null) {
$productCategoryAttribute = $this->ProductCategoryAttributes->get($id, contain: [ $productCategoryAttribute = $this->fetchTable()->get($id, contain: [
'ProductCategories', 'ProductCategories',
'ProductCategoryAttributeOptions', 'ProductCategoryAttributeOptions',
]); ]);
@@ -56,8 +54,7 @@ class ProductCategoryAttributesController extends AppController {
* @return \Cake\Http\Response|null|void Redirects on successful add, renders view otherwise. * @return \Cake\Http\Response|null|void Redirects on successful add, renders view otherwise.
*/ */
public function add() { public function add() {
$productCategoryAttributesTable = $this->ProductCategoryAttributes; $productCategoryAttribute = $this->fetchTable()->newEmptyEntity();
$productCategoryAttribute = $productCategoryAttributesTable->newEmptyEntity();
if ($this->request->is('post')) { if ($this->request->is('post')) {
$postData = $this->request->getData(); $postData = $this->request->getData();
if ($this->request->getSession()->read('Auth.User.id')) { if ($this->request->getSession()->read('Auth.User.id')) {
@@ -70,12 +67,12 @@ class ProductCategoryAttributesController extends AppController {
'ProductCategoryAttributeOptions', 'ProductCategoryAttributeOptions',
], ],
]; ];
$productCategoryAttribute = $productCategoryAttributesTable->patchEntity($productCategoryAttribute, $postData, $saveOptions); $productCategoryAttribute = $this->fetchTable()->patchEntity($productCategoryAttribute, $postData, $saveOptions);
if ($productCategoryAttribute->getErrors()) { if ($productCategoryAttribute->getErrors()) {
Log::debug(print_r('$productCategoryAttribute->getErrors() next - failed to save from create new product category attribute', true)); Log::debug(print_r('$productCategoryAttribute->getErrors() next - failed to save from create new product category attribute', true));
Log::debug(print_r($productCategoryAttribute->getErrors(), true)); Log::debug(print_r($productCategoryAttribute->getErrors(), true));
} }
if ($productCategoryAttributesTable->save($productCategoryAttribute, $saveOptions)) { if ($this->fetchTable()->save($productCategoryAttribute, $saveOptions)) {
$this->Flash->success(__('The product category attribute has been saved.')); $this->Flash->success(__('The product category attribute has been saved.'));
return $this->redirect(['action' => 'index']); return $this->redirect(['action' => 'index']);
@@ -85,7 +82,7 @@ class ProductCategoryAttributesController extends AppController {
Log::debug(print_r($productCategoryAttribute->getErrors(), true)); Log::debug(print_r($productCategoryAttribute->getErrors(), true));
$this->Flash->error(__('The product category attribute could not be saved. Please, try again.')); $this->Flash->error(__('The product category attribute could not be saved. Please, try again.'));
} }
$productCategories = $productCategoryAttributesTable->ProductCategories->find('list', keyField: 'internal_id', valueField: 'name')->all(); $productCategories = $this->fetchTable()->ProductCategories->find('list', keyField: 'internal_id', valueField: 'name')->all();
$this->set(compact('productCategoryAttribute', 'productCategories')); $this->set(compact('productCategoryAttribute', 'productCategories'));
} }
@@ -93,12 +90,11 @@ class ProductCategoryAttributesController extends AppController {
* Edit method * Edit method
* *
* @param string|null $id Product Category Attribute id. * @param string|null $id Product Category Attribute id.
* @throws RecordNotFoundException When record not found. * @throws \Cake\Datasource\Exception\RecordNotFoundException When record not found.
* @return Response|null|void Redirects on successful edit, renders view otherwise. * @return \Cake\Http\Response|null|void Redirects on successful edit, renders view otherwise.
*/ */
public function edit($id = null) { public function edit($id = null) {
$productCategoryAttributesTable = $this->ProductCategoryAttributes; $productCategoryAttribute = $this->fetchTable()->get($id, contain: ['ProductCategoryAttributeOptions']);
$productCategoryAttribute = $productCategoryAttributesTable->get($id, contain: ['ProductCategoryAttributeOptions']);
if ($this->request->is(['patch', 'post', 'put'])) { if ($this->request->is(['patch', 'post', 'put'])) {
$postData = $this->request->getData(); $postData = $this->request->getData();
$saveOptions = [ $saveOptions = [
@@ -112,9 +108,9 @@ class ProductCategoryAttributesController extends AppController {
// } // }
Log::debug(print_r('$postData', true)); Log::debug(print_r('$postData', true));
Log::debug(print_r($postData, true)); Log::debug(print_r($postData, true));
$productCategoryAttribute = $productCategoryAttributesTable->patchEntity($productCategoryAttribute, $postData, $saveOptions); $productCategoryAttribute = $this->fetchTable()->patchEntity($productCategoryAttribute, $postData, $saveOptions);
if ($productCategoryAttributesTable->save($productCategoryAttribute, $saveOptions)) { if ($this->fetchTable()->save($productCategoryAttribute, $saveOptions)) {
$this->Flash->success(__('The product category attribute has been saved.')); $this->Flash->success(__('The product category attribute has been saved.'));
return $this->redirect(['action' => 'index']); return $this->redirect(['action' => 'index']);
@@ -124,7 +120,7 @@ class ProductCategoryAttributesController extends AppController {
Log::debug(print_r($productCategoryAttribute->getErrors(), true)); Log::debug(print_r($productCategoryAttribute->getErrors(), true));
$this->Flash->error(__('The product category attribute could not be saved. Please, try again.')); $this->Flash->error(__('The product category attribute could not be saved. Please, try again.'));
} }
$productCategories = $productCategoryAttributesTable->ProductCategories->find('list', limit: 200, keyField: 'internal_id', valueField: 'name')->all(); $productCategories = $this->fetchTable('ProductCategories')->find('list', limit: 200, keyField: 'internal_id', valueField: 'name')->all();
$this->set(compact('productCategoryAttribute', 'productCategories')); $this->set(compact('productCategoryAttribute', 'productCategories'));
} }
@@ -132,15 +128,14 @@ class ProductCategoryAttributesController extends AppController {
* Delete method * Delete method
* *
* @param string|null $id Product Category Attribute id. * @param string|null $id Product Category Attribute id.
* @throws RecordNotFoundException When record not found. * @throws \Cake\Datasource\Exception\RecordNotFoundException When record not found.
* @return Response|null Redirects to index. * @return \Cake\Http\Response|null Redirects to index.
*/ */
public function delete($id = null) { public function delete($id = null) {
$this->request->allowMethod(['post', 'delete']); $this->request->allowMethod(['post', 'delete']);
$productCategoryAttributesTable = $this->ProductCategoryAttributes; $productCategoryAttribute = $this->fetchTable()->get($id);
$productCategoryAttribute = $productCategoryAttributesTable->get($id); if ($this->fetchTable()->delete($productCategoryAttribute)) {
if ($productCategoryAttributesTable->delete($productCategoryAttribute)) {
$this->Flash->success(__('The product category attribute has been deleted.')); $this->Flash->success(__('The product category attribute has been deleted.'));
} else { } else {
$this->Flash->error(__('The product category attribute could not be deleted. Please, try again.')); $this->Flash->error(__('The product category attribute could not be deleted. Please, try again.'));
@@ -153,7 +148,7 @@ class ProductCategoryAttributesController extends AppController {
* @return void * @return void
*/ */
public function form() { public function form() {
$productCategories = $this->ProductCategoryAttributes->getAllCategoryAttributesForCategoryId($this->request->getQuery('product_category_id', '-1')); $productCategories = $this->fetchTable()->getAllCategoryAttributesForCategoryId($this->request->getQuery('product_category_id', '-1'));
$this->set(compact('productCategories')); $this->set(compact('productCategories'));
} }
@@ -8,7 +8,7 @@ use Cake\Log\Log;
/** /**
* ProductCategoryVariants Controller * ProductCategoryVariants Controller
* *
* @property CakeProducts\Model\Table\ProductCategoryVariantsTable $ProductCategoryVariants * @property \CakeProducts\Model\Table\ProductCategoryVariantsTable $ProductCategoryVariants
*/ */
class ProductCategoryVariantsController extends AppController { class ProductCategoryVariantsController extends AppController {
@@ -17,8 +17,6 @@ class ProductCategoryVariantsController extends AppController {
*/ */
public function initialize(): void { public function initialize(): void {
parent::initialize(); // TODO: Change the autogenerated stub parent::initialize(); // TODO: Change the autogenerated stub
// $this->_defaultTable = 'CakeProducts.ProductCategoryVariants';
// $this->_tableConfigKey = 'CakeProducts.ProductCategoryVariants.table';
} }
/** /**
@@ -27,7 +25,7 @@ class ProductCategoryVariantsController extends AppController {
* @return \Cake\Http\Response|null|void Renders view * @return \Cake\Http\Response|null|void Renders view
*/ */
public function index() { public function index() {
$query = $this->ProductCategoryVariants->find() $query = $this->fetchTable()->find()
->contain(['ProductCategories', 'Products', 'ProductCategoryVariantOptions']); ->contain(['ProductCategories', 'Products', 'ProductCategoryVariantOptions']);
$productCategoryVariants = $this->paginate($query); $productCategoryVariants = $this->paginate($query);
@@ -42,7 +40,7 @@ class ProductCategoryVariantsController extends AppController {
* @return \Cake\Http\Response|null|void Renders view * @return \Cake\Http\Response|null|void Renders view
*/ */
public function view($id = null) { public function view($id = null) {
$productCategoryVariant = $this->ProductCategoryVariants->get($id, contain: [ $productCategoryVariant = $this->fetchTable()->get($id, contain: [
'ProductCategories', 'ProductCategories',
'Products', 'Products',
'ProductCategoryVariantOptions', 'ProductCategoryVariantOptions',
@@ -56,7 +54,7 @@ class ProductCategoryVariantsController extends AppController {
* @return \Cake\Http\Response|null|void Redirects on successful add, renders view otherwise. * @return \Cake\Http\Response|null|void Redirects on successful add, renders view otherwise.
*/ */
public function add() { public function add() {
$productCategoryVariantsTable = $this->ProductCategoryVariants; $productCategoryVariantsTable = $this->fetchTable();
$productCategoryVariant = $productCategoryVariantsTable->newEmptyEntity(); $productCategoryVariant = $productCategoryVariantsTable->newEmptyEntity();
if ($this->request->is('post')) { if ($this->request->is('post')) {
@@ -92,8 +90,7 @@ class ProductCategoryVariantsController extends AppController {
* @return \Cake\Http\Response|null|void Redirects on successful edit, renders view otherwise. * @return \Cake\Http\Response|null|void Redirects on successful edit, renders view otherwise.
*/ */
public function edit($id = null) { public function edit($id = null) {
$productCategoryVariantsTable = $this->ProductCategoryVariants; $productCategoryVariant = $this->fetchTable()->get($id, contain: []);
$productCategoryVariant = $productCategoryVariantsTable->get($id, contain: []);
if ($this->request->is(['patch', 'post', 'put'])) { if ($this->request->is(['patch', 'post', 'put'])) {
$postData = $this->request->getData(); $postData = $this->request->getData();
// if ($this->request->getSession()->read('Auth.User.id')) { // if ($this->request->getSession()->read('Auth.User.id')) {
@@ -113,9 +110,9 @@ class ProductCategoryVariantsController extends AppController {
'ProductCategoryVariantOptions', 'ProductCategoryVariantOptions',
], ],
]; ];
$productCategoryVariant = $productCategoryVariantsTable->patchEntity($productCategoryVariant, $postData, $saveOptions); $productCategoryVariant = $this->fetchTable()->patchEntity($productCategoryVariant, $postData, $saveOptions);
// dd($postData); // dd($postData);
if ($productCategoryVariantsTable->save($productCategoryVariant, $saveOptions)) { if ($this->fetchTable()->save($productCategoryVariant, $saveOptions)) {
$this->Flash->success(__('The product category variant has been saved.')); $this->Flash->success(__('The product category variant has been saved.'));
return $this->redirect(['action' => 'index']); return $this->redirect(['action' => 'index']);
@@ -123,8 +120,9 @@ class ProductCategoryVariantsController extends AppController {
// dd($productCategoryVariant->getErrors()); // dd($productCategoryVariant->getErrors());
$this->Flash->error(__('The product category variant could not be saved. Please, try again.')); $this->Flash->error(__('The product category variant could not be saved. Please, try again.'));
} }
$productCategories = $productCategoryVariantsTable->ProductCategories->find('list', keyField: 'internal_id', valueField: 'name')->all(); $productCategories = $this->fetchTable('ProductCategories')->find('list', keyField: 'internal_id', valueField: 'name')->all();
$products = isset($productCategoryVariant->product_category_id) ? $productCategoryVariantsTable->Products->find('list', limit: 200)->where(['product_category_id' => $productCategoryVariant->product_category_id])->all() : []; $products = isset($productCategoryVariant->product_category_id) ? $this->fetchTable('Products')->find('list', limit: 200)
->where(['product_category_id' => $productCategoryVariant->product_category_id])->all() : [];
$this->set(compact('productCategoryVariant', 'productCategories', 'products')); $this->set(compact('productCategoryVariant', 'productCategories', 'products'));
} }
@@ -137,10 +135,9 @@ class ProductCategoryVariantsController extends AppController {
*/ */
public function delete($id = null) { public function delete($id = null) {
$this->request->allowMethod(['post', 'delete']); $this->request->allowMethod(['post', 'delete']);
$productCategoryVariantsTable = $this->ProductCategoryVariants;
$productCategoryVariant = $productCategoryVariantsTable->get($id); $productCategoryVariant = $this->fetchTable()->get($id);
if ($productCategoryVariantsTable->delete($productCategoryVariant)) { if ($this->fetchTable()->delete($productCategoryVariant)) {
$this->Flash->success(__('The product category variant has been deleted.')); $this->Flash->success(__('The product category variant has been deleted.'));
} else { } else {
$this->Flash->error(__('The product category variant could not be deleted. Please, try again.')); $this->Flash->error(__('The product category variant could not be deleted. Please, try again.'));
+21 -21
View File
@@ -45,13 +45,14 @@ class ProductPhotosController extends AppController {
* @return \Cake\Http\Response|null|void Redirects on successful add, renders view otherwise. * @return \Cake\Http\Response|null|void Redirects on successful add, renders view otherwise.
*/ */
public function add() { public function add() {
$productPhotosTable = $this->ProductPhotos; $productPhoto = $this->fetchTable()->newEmptyEntity();
$productPhoto = $productPhotosTable->newEmptyEntity();
if ($this->request->is('post')) { if ($this->request->is('post')) {
// dd($this->request->getData());
if (!$this->request->getData('photo')) { if (!$this->request->getData('photo')) {
$this->Flash->error('Photo is required. Nothing was uploaded. Please try again.'); $this->Flash->error('Photo is required. Nothing was uploaded. Please try again.');
$productCategory = $productPhoto->product_category_id ? $productPhotosTable->ProductCategories->find()->where(['internal_id' => $productPhoto->product_category_id ?? '-1'])->first() : null; $productCategory = $productPhoto->product_category_id ? $this->fetchTable('CakeProducts.ProductCategories')->find()
$productCatalogs = $productPhotosTable->ProductCategories->ProductCatalogs->find('list')->toArray(); ->where(['internal_id' => $productPhoto->product_category_id ?? '-1'])->first() : null;
$productCatalogs = $this->fetchTable('CakeProducts.ProductCatalogs')->find('list')->toArray();
$this->set(compact('productPhoto', 'productCatalogs', 'productCategory')); $this->set(compact('productPhoto', 'productCatalogs', 'productCategory'));
return; return;
@@ -62,7 +63,7 @@ class ProductPhotosController extends AppController {
$baseDir = Configure::readOrFail('CakeProducts.photos.directory'); $baseDir = Configure::readOrFail('CakeProducts.photos.directory');
$path = ''; $path = '';
if ($this->request->getData('product_sku_id')) { if ($this->request->getData('product_sku_id')) {
$productSku = $productPhotosTable->ProductSkus $productSku = $this->fetchTable('CakeProducts.ProductSkus')
->find() ->find()
->contain(['Products', 'Products.ProductCategories']) ->contain(['Products', 'Products.ProductCategories'])
->where([ ->where([
@@ -74,7 +75,7 @@ class ProductPhotosController extends AppController {
$postData['product_id'] = $productSku->product->id ?? null; $postData['product_id'] = $productSku->product->id ?? null;
$postData['product_category_id'] = $productSku->product->product_category->internal_id ?? null; $postData['product_category_id'] = $productSku->product->product_category->internal_id ?? null;
} else if ($this->request->getData('product_id')) { } else if ($this->request->getData('product_id')) {
$product = $productPhotosTable->Products $product = $this->fetchTable('CakeProducts.Products')
->find() ->find()
->contain(['ProductCategories']) ->contain(['ProductCategories'])
->where([ ->where([
@@ -89,7 +90,7 @@ class ProductPhotosController extends AppController {
// @link https://developer.wordpress.org/reference/functions/wp_is_uuid/ // @link https://developer.wordpress.org/reference/functions/wp_is_uuid/
$regex = '/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/'; $regex = '/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/';
$field = preg_match($regex, $categoryId) ? 'ProductCategories.internal_id' : 'ProductCategories.id'; $field = preg_match($regex, $categoryId) ? 'ProductCategories.internal_id' : 'ProductCategories.id';
$productCategoryPosted = $productPhotosTable->ProductCategories $productCategoryPosted = $this->fetchTable('ProductCategories')
->find() ->find()
->where([ ->where([
$field => $categoryId, $field => $categoryId,
@@ -127,8 +128,8 @@ class ProductPhotosController extends AppController {
$postData['photo_filename'] = $uuid . '.' . $ext; $postData['photo_filename'] = $uuid . '.' . $ext;
// dd($postData); // dd($postData);
$productPhoto = $productPhotosTable->patchEntity($productPhoto, $postData); $productPhoto = $this->fetchTable()->patchEntity($productPhoto, $postData);
if ($productPhotosTable->save($productPhoto)) { if ($this->fetchTable()->save($productPhoto)) {
$this->Flash->success(__('The product photo has been saved.')); $this->Flash->success(__('The product photo has been saved.'));
return $this->redirect(['action' => 'index']); return $this->redirect(['action' => 'index']);
@@ -136,8 +137,9 @@ class ProductPhotosController extends AppController {
// dd($productPhoto->getErrors()); // dd($productPhoto->getErrors());
$this->Flash->error(__('The product photo could not be saved. Please, try again.')); $this->Flash->error(__('The product photo could not be saved. Please, try again.'));
} }
$productCategory = $productPhoto->product_category_id ? $productPhotosTable->ProductCategories->find()->where(['internal_id' => $productPhoto->product_category_id ?? '-1'])->first() : null; $productCategory = $productPhoto->product_category_id ? $this->fetchTable('ProductCategories')->find()
$productCatalogs = $productPhotosTable->ProductCategories->ProductCatalogs->find('list')->toArray(); ->where(['internal_id' => $productPhoto->product_category_id ?? '-1'])->first() : null;
$productCatalogs = $this->fetchTable('ProductCatalogs')->find('list')->toArray();
$this->set(compact('productPhoto', 'productCatalogs', 'productCategory')); $this->set(compact('productPhoto', 'productCatalogs', 'productCategory'));
} }
@@ -149,21 +151,20 @@ class ProductPhotosController extends AppController {
* @return Response|null|void Redirects on successful edit, renders view otherwise. * @return Response|null|void Redirects on successful edit, renders view otherwise.
*/ */
public function edit($id = null) { public function edit($id = null) {
$productPhotosTable = $this->ProductPhotos; $productPhoto = $this->fetchTable()->get($id, contain: []);
$productPhoto = $productPhotosTable->get($id, contain: []);
if ($this->request->is(['patch', 'post', 'put'])) { if ($this->request->is(['patch', 'post', 'put'])) {
$postData = $this->request->getData(); $postData = $this->request->getData();
$productPhoto = $productPhotosTable->patchEntity($productPhoto, $postData); $productPhoto = $this->fetchTable()->patchEntity($productPhoto, $postData);
if ($productPhotosTable->save($productPhoto)) { if ($this->fetchTable()->save($productPhoto)) {
$this->Flash->success(__('The product photo has been saved.')); $this->Flash->success(__('The product photo has been saved.'));
return $this->redirect(['action' => 'index']); return $this->redirect(['action' => 'index']);
} }
$this->Flash->error(__('The product photo could not be saved. Please, try again.')); $this->Flash->error(__('The product photo could not be saved. Please, try again.'));
} }
$products = $productPhotosTable->Products->find('list', limit: 200)->all(); $products = $this->fetchTable('Products')->find('list', limit: 200)->all();
$productSkus = $productPhotosTable->ProductSkus->find('list', limit: 200)->all(); $productSkus = $this->fetchTable('ProductSkus')->find('list', limit: 200)->all();
$this->set(compact('productPhoto', 'products', 'productSkus')); $this->set(compact('productPhoto', 'products', 'productSkus'));
} }
@@ -176,10 +177,9 @@ class ProductPhotosController extends AppController {
*/ */
public function delete($id = null) { public function delete($id = null) {
$this->request->allowMethod(['post', 'delete']); $this->request->allowMethod(['post', 'delete']);
$productPhotosTable = $this->ProductPhotos;
$productPhoto = $productPhotosTable->get($id); $productPhoto = $this->fetchTable()->get($id);
if ($productPhotosTable->delete($productPhoto)) { if ($this->fetchTable()->delete($productPhoto)) {
$this->Flash->success(__('The product photo has been deleted.')); $this->Flash->success(__('The product photo has been deleted.'));
} else { } else {
$this->Flash->error(__('The product photo could not be deleted. Please, try again.')); $this->Flash->error(__('The product photo could not be deleted. Please, try again.'));
@@ -193,7 +193,7 @@ class ProductPhotosController extends AppController {
* @return \Cake\Http\Response * @return \Cake\Http\Response
*/ */
public function image($id = null) { public function image($id = null) {
$productPhoto = $this->ProductPhotos->get($id); $productPhoto = $this->fetchTable()->get($id);
$fullPath = Configure::readOrFail('CakeProducts.photos.directory') . $productPhoto->photo_dir . DS . $productPhoto->photo_filename; $fullPath = Configure::readOrFail('CakeProducts.photos.directory') . $productPhoto->photo_dir . DS . $productPhoto->photo_filename;
+1 -3
View File
@@ -19,8 +19,6 @@ class ProductSkusController extends AppController {
*/ */
public function initialize(): void { public function initialize(): void {
parent::initialize(); // TODO: Change the autogenerated stub parent::initialize(); // TODO: Change the autogenerated stub
// $this->_defaultTable = 'CakeProducts.ProductSkus';
// $this->_tableConfigKey = 'CakeProducts.ProductSkus.table';
} }
/** /**
@@ -159,7 +157,7 @@ class ProductSkusController extends AppController {
if (!$this->ProductSkus->save($productSkuToSave, $saveOptions)) { if (!$this->ProductSkus->save($productSkuToSave, $saveOptions)) {
Log::debug(print_r('$productSkuToSave->getErrors()', true)); Log::debug(print_r('$productSkuToSave->getErrors()', true));
Log::debug(print_r($productSkuToSave->getErrors(), true)); Log::debug(print_r($productSkuToSave->getErrors(), true));
dd($productSkuToSave->getErrors()); // dd($productSkuToSave->getErrors());
continue; continue;
} }
+19 -16
View File
@@ -8,7 +8,7 @@ use Cake\Log\Log;
/** /**
* ProductVariants Controller * ProductVariants Controller
* *
* @property CakeProducts\Model\Table\ProductVariantsTable $ProductVariants * @property \CakeProducts\Model\Table\ProductVariantsTable $ProductVariants
*/ */
class ProductVariantsController extends AppController { class ProductVariantsController extends AppController {
@@ -18,7 +18,7 @@ class ProductVariantsController extends AppController {
* @return \Cake\Http\Response|null|void Renders view * @return \Cake\Http\Response|null|void Renders view
*/ */
public function index() { public function index() {
$query = $this->ProductVariants->find() $query = $this->fetchTable()->find()
->contain(['ProductCategoryVariants', 'Products']); ->contain(['ProductCategoryVariants', 'Products']);
$productVariants = $this->paginate($query); $productVariants = $this->paginate($query);
@@ -33,7 +33,7 @@ class ProductVariantsController extends AppController {
* @return \Cake\Http\Response|null|void Renders view * @return \Cake\Http\Response|null|void Renders view
*/ */
public function view($id = null) { public function view($id = null) {
$productVariant = $this->ProductVariants->get($id, contain: ['ProductCategoryVariants', 'Products']); $productVariant = $this->fetchTable()->get($id, contain: ['ProductCategoryVariants', 'Products']);
$this->set(compact('productVariant')); $this->set(compact('productVariant'));
} }
@@ -43,16 +43,19 @@ class ProductVariantsController extends AppController {
* @return \Cake\Http\Response|null|void Redirects on successful add, renders view otherwise. * @return \Cake\Http\Response|null|void Redirects on successful add, renders view otherwise.
*/ */
public function add($productId) { public function add($productId) {
$product = $this->ProductVariants->Products->get($productId); $product = $this->fetchTable()->Products->get($productId);
$productVariant = $this->ProductVariants->newEmptyEntity(); $productVariant = $this->fetchTable()->newEmptyEntity();
if ($this->request->is('post')) { if ($this->request->is('post')) {
$saveOptions = []; $saveOptions = [];
$postData = $this->request->getData(); $postData = $this->request->getData();
$productCategoryVariant = $this->ProductVariants->ProductCategoryVariants->get($this->request->getData('product_category_variant_id', '-1')); /**
* @var \CakeProducts\Model\Entity\ProductCategoryVariant $productCategoryVariant
*/
$productCategoryVariant = $this->fetchTable('ProductCategoryVariants')->get($this->request->getData('product_category_variant_id', '-1'));
$postData['name'] = $productCategoryVariant->name; $postData['name'] = $productCategoryVariant->name;
$postData['product_id'] = $productId; $postData['product_id'] = $productId;
$productVariant = $this->ProductVariants->patchEntity($productVariant, $postData); $productVariant = $this->fetchTable()->patchEntity($productVariant, $postData);
if ($this->ProductVariants->save($productVariant)) { if ($this->fetchTable()->save($productVariant)) {
$this->Flash->success(__('The product variant has been saved.')); $this->Flash->success(__('The product variant has been saved.'));
return $this->redirect(['action' => 'index']); return $this->redirect(['action' => 'index']);
@@ -62,7 +65,7 @@ class ProductVariantsController extends AppController {
Log::debug(print_r($productVariant->getErrors(), true)); Log::debug(print_r($productVariant->getErrors(), true));
$this->Flash->error(__('The product variant could not be saved. Please, try again.')); $this->Flash->error(__('The product variant could not be saved. Please, try again.'));
} }
$productCategoryVariants = $this->ProductVariants->ProductCategoryVariants $productCategoryVariants = $this->fetchTable('ProductCategoryVariants')
->find('list', limit: 200) ->find('list', limit: 200)
->where(['product_category_id' => $product->product_category_id]) ->where(['product_category_id' => $product->product_category_id])
->toArray(); ->toArray();
@@ -77,18 +80,18 @@ class ProductVariantsController extends AppController {
* @return \Cake\Http\Response|null|void Redirects on successful edit, renders view otherwise. * @return \Cake\Http\Response|null|void Redirects on successful edit, renders view otherwise.
*/ */
public function edit($id = null) { public function edit($id = null) {
$productVariant = $this->ProductVariants->get($id, contain: []); $productVariant = $this->fetchTable()->get($id, contain: []);
if ($this->request->is(['patch', 'post', 'put'])) { if ($this->request->is(['patch', 'post', 'put'])) {
$productVariant = $this->ProductVariants->patchEntity($productVariant, $this->request->getData()); $productVariant = $this->fetchTable()->patchEntity($productVariant, $this->request->getData());
if ($this->ProductVariants->save($productVariant)) { if ($this->fetchTable()->save($productVariant)) {
$this->Flash->success(__('The product variant has been saved.')); $this->Flash->success(__('The product variant has been saved.'));
return $this->redirect(['action' => 'index']); return $this->redirect(['action' => 'index']);
} }
$this->Flash->error(__('The product variant could not be saved. Please, try again.')); $this->Flash->error(__('The product variant could not be saved. Please, try again.'));
} }
$productCategoryVariants = $this->ProductVariants->ProductCategoryVariants->find('list', limit: 200)->all(); $productCategoryVariants = $this->fetchTable('ProductCategoryVariants')->find('list', limit: 200)->all();
$products = $this->ProductVariants->Products->find('list', limit: 200)->all(); $products = $this->fetchTable('Products')->find('list', limit: 200)->all();
$this->set(compact('productVariant', 'productCategoryVariants', 'products')); $this->set(compact('productVariant', 'productCategoryVariants', 'products'));
} }
@@ -101,8 +104,8 @@ class ProductVariantsController extends AppController {
*/ */
public function delete($id = null) { public function delete($id = null) {
$this->request->allowMethod(['post', 'delete']); $this->request->allowMethod(['post', 'delete']);
$productVariant = $this->ProductVariants->get($id); $productVariant = $this->fetchTable()->get($id);
if ($this->ProductVariants->delete($productVariant)) { if ($this->fetchTable()->delete($productVariant)) {
$this->Flash->success(__('The product variant has been deleted.')); $this->Flash->success(__('The product variant has been deleted.'));
} else { } else {
$this->Flash->error(__('The product variant could not be deleted. Please, try again.')); $this->Flash->error(__('The product variant could not be deleted. Please, try again.'));
+17 -17
View File
@@ -4,6 +4,7 @@ declare(strict_types=1);
namespace CakeProducts\Controller; namespace CakeProducts\Controller;
use Cake\Log\Log; use Cake\Log\Log;
use CakeProducts\Model\Entity\ProductCategoryVariant;
/** /**
* Products Controller * Products Controller
@@ -25,7 +26,7 @@ class ProductsController extends AppController {
* @return \Cake\Http\Response|null|void Renders view * @return \Cake\Http\Response|null|void Renders view
*/ */
public function index() { public function index() {
$query = $this->Products->find() $query = $this->fetchTable()->find()
->contain(['ProductCategories']); ->contain(['ProductCategories']);
$products = $this->paginate($query); $products = $this->paginate($query);
@@ -40,7 +41,7 @@ class ProductsController extends AppController {
* @return \Cake\Http\Response|null|void Renders view * @return \Cake\Http\Response|null|void Renders view
*/ */
public function view($id = null) { public function view($id = null) {
$product = $this->Products->get($id, contain: [ $product = $this->fetchTable()->get($id, contain: [
'ProductCategories', 'ProductCategories',
'ProductAttributes', 'ProductAttributes',
'ProductAttributes.ProductCategoryAttributes', 'ProductAttributes.ProductCategoryAttributes',
@@ -60,8 +61,7 @@ class ProductsController extends AppController {
* @return \Cake\Http\Response|null|void Redirects on successful add, renders view otherwise. * @return \Cake\Http\Response|null|void Redirects on successful add, renders view otherwise.
*/ */
public function add() { public function add() {
$productsTable = $this->Products; $product = $this->fetchTable()->newEmptyEntity();
$product = $productsTable->newEmptyEntity();
if ($this->request->is('post')) { if ($this->request->is('post')) {
$postData = $this->request->getData(); $postData = $this->request->getData();
$saveOptions = [ $saveOptions = [
@@ -77,13 +77,13 @@ class ProductsController extends AppController {
if (!isset($postedProductVariant['enabled']) || !$postedProductVariant['enabled'] || !isset($postedProductVariant['product_category_variant_id'])) { if (!isset($postedProductVariant['enabled']) || !$postedProductVariant['enabled'] || !isset($postedProductVariant['product_category_variant_id'])) {
continue; continue;
} }
$existingVariant = $this->Products->ProductCategories->ProductCategoryVariants->get($postedProductVariant['product_category_variant_id'], contain: ['ProductCategoryVariantOptions']); $existingVariant = $this->fetchTable('ProductCategoryVariants')->get($postedProductVariant['product_category_variant_id'], contain: ['ProductCategoryVariantOptions']);
$optionsData = []; $optionsData = [];
foreach ($existingVariant->product_category_variant_options as $existingOption) { foreach ($existingVariant->product_category_variant_options as $existingOption) {
$optionsData[] = [ $optionsData[] = [
'variant_value' => $existingOption->variant_value, 'variant_value' => $existingOption->variant_value,
'variant_label' => $existingOption->variant_label ?? null, 'variant_label' => $existingOption->variant_label ?? null,
'enabled' => $existingOption->enabled, 'enabled' => $existingOption->enabled ?? false,
]; ];
} }
$tmpVariantData = [ $tmpVariantData = [
@@ -113,8 +113,8 @@ class ProductsController extends AppController {
$saveOptions['associated'][] = 'ProductCategoryVariants.ProductCategoryVariantOptions'; $saveOptions['associated'][] = 'ProductCategoryVariants.ProductCategoryVariantOptions';
$postData['product_category_variants'] = $productVariantsData; $postData['product_category_variants'] = $productVariantsData;
} }
$product = $productsTable->patchEntity($product, $postData, $saveOptions); $product = $this->fetchTable()->patchEntity($product, $postData, $saveOptions);
if ($productsTable->save($product, $saveOptions)) { if ($this->fetchTable()->save($product, $saveOptions)) {
$this->Flash->success(__('The product has been saved.')); $this->Flash->success(__('The product has been saved.'));
return $this->redirect(['action' => 'index']); return $this->redirect(['action' => 'index']);
@@ -123,8 +123,10 @@ class ProductsController extends AppController {
Log::debug(print_r($product->getErrors(), true)); Log::debug(print_r($product->getErrors(), true));
$this->Flash->error(__('The product could not be saved. Please, try again.')); $this->Flash->error(__('The product could not be saved. Please, try again.'));
} }
$productCategory = $product->product_category_id ? $productsTable->ProductCategories->find()->where(['internal_id' => $product->product_category_id])->first() : null; $productCategory = $product->product_category_id ? $this->fetchTable('ProductCategories')->find()
$productCatalogs = $productsTable->ProductCategories->ProductCatalogs->find('list')->toArray(); ->where(['internal_id' => $product->product_category_id])->first() : null;
$productCatalogs = $this->fetchTable('ProductCatalogs')->find('list')->toArray();
$this->set(compact('product', 'productCatalogs', 'productCategory')); $this->set(compact('product', 'productCatalogs', 'productCategory'));
} }
@@ -136,7 +138,7 @@ class ProductsController extends AppController {
* @return \Cake\Http\Response|null|void Redirects on successful edit, renders view otherwise. * @return \Cake\Http\Response|null|void Redirects on successful edit, renders view otherwise.
*/ */
public function edit($id = null) { public function edit($id = null) {
$productsTable = $this->Products; $productsTable = $this->fetchTable();
$product = $productsTable->get($id, contain: [ $product = $productsTable->get($id, contain: [
'ProductAttributes', 'ProductAttributes',
'ProductAttributes.ProductCategoryAttributes', 'ProductAttributes.ProductCategoryAttributes',
@@ -171,9 +173,8 @@ class ProductsController extends AppController {
public function delete($id = null) { public function delete($id = null) {
$this->request->allowMethod(['post', 'delete']); $this->request->allowMethod(['post', 'delete']);
$productsTable = $this->Products; $product = $this->fetchTable()->get($id);
$product = $productsTable->get($id); if ($this->fetchTable()->delete($product)) {
if ($productsTable->delete($product)) {
$this->Flash->success(__('The product has been deleted.')); $this->Flash->success(__('The product has been deleted.'));
} else { } else {
$this->Flash->error(__('The product could not be deleted. Please, try again.')); $this->Flash->error(__('The product could not be deleted. Please, try again.'));
@@ -186,11 +187,10 @@ class ProductsController extends AppController {
* @return \Cake\Http\Response|null|void Renders view * @return \Cake\Http\Response|null|void Renders view
*/ */
public function select() { public function select() {
$productsTable = $this->Products; $productCategory = $this->fetchTable()->ProductCategories->find()
$productCategory = $productsTable->ProductCategories->find()
->where(['id' => $this->request->getQuery('product_category_id', '-1')]) ->where(['id' => $this->request->getQuery('product_category_id', '-1')])
->first(); ->first();
$products = $productsTable $products = $this->fetchTable()
->find('list') ->find('list')
->where(['product_category_id' => $productCategory->internal_id ?? '-1']) ->where(['product_category_id' => $productCategory->internal_id ?? '-1'])
->orderBy(['Products.name']) ->orderBy(['Products.name'])
@@ -18,14 +18,18 @@ use Cake\Validation\Validator;
* @property ProductCatalogsTable&\Cake\ORM\Association\BelongsTo $ProductCatalogs * @property ProductCatalogsTable&\Cake\ORM\Association\BelongsTo $ProductCatalogs
* *
* @method \CakeProducts\Model\Entity\ExternalProductCatalogsProductCatalog newEmptyEntity() * @method \CakeProducts\Model\Entity\ExternalProductCatalogsProductCatalog newEmptyEntity()
* @method \CakeProducts\Model\Entity\ExternalProductCatalogsProductCatalog newEntity() * @method \CakeProducts\Model\Entity\ExternalProductCatalogsProductCatalog newEntity(array $data, array $options = [])
* @method array<\CakeProducts\Model\Entity\ExternalProductCatalogsProductCatalog> newEntities(array $data, array $options = []) * @method array<\CakeProducts\Model\Entity\ExternalProductCatalogsProductCatalog> newEntities(array $data, array $options = [])
* @method \CakeProducts\Model\Entity\ExternalProductCatalogsProductCatalog get() * @method \CakeProducts\Model\Entity\ExternalProductCatalogsProductCatalog get(mixed $primaryKey, array|string $finder = 'all', \Psr\SimpleCache\CacheInterface|string|null $cache = null, \Closure|string|null $cacheKey = null, mixed ...$args)
* @method \CakeProducts\Model\Entity\ExternalProductCatalogsProductCatalog findOrCreate() * @method \CakeProducts\Model\Entity\ExternalProductCatalogsProductCatalog findOrCreate($search, ?callable $callback = null, array $options = [])
* @method \CakeProducts\Model\Entity\ExternalProductCatalogsProductCatalog patchEntity() * @method \CakeProducts\Model\Entity\ExternalProductCatalogsProductCatalog patchEntity(\Cake\Datasource\EntityInterface $entity, array $data, array $options = [])
* @method array<\CakeProducts\Model\Entity\ExternalProductCatalogsProductCatalog> patchEntities(iterable $entities, array $data, array $options = []) * @method array<\CakeProducts\Model\Entity\ExternalProductCatalogsProductCatalog> patchEntities(iterable $entities, array $data, array $options = [])
* @method \CakeProducts\Model\Entity\ExternalProductCatalogsProductCatalog|false save(\CakeProducts\Model\Entity\ExternalProductCatalogsProductCatalog|\Cake\Datasource\EntityInterface $entity, array $options = []) * @method \CakeProducts\Model\Entity\ExternalProductCatalogsProductCatalog|false save(\Cake\Datasource\EntityInterface $entity, array $options = [])
* @method \CakeProducts\Model\Entity\ExternalProductCatalogsProductCatalog saveOrFail() * @method \CakeProducts\Model\Entity\ExternalProductCatalogsProductCatalog saveOrFail(\Cake\Datasource\EntityInterface $entity, array $options = [])
* @method iterable<\CakeProducts\Model\Entity\ExternalProductCatalogsProductCatalog>|\Cake\Datasource\ResultSetInterface<\CakeProducts\Model\Entity\ExternalProductCatalogsProductCatalog>|false saveMany(iterable $entities, array $options = [])
* @method iterable<\CakeProducts\Model\Entity\ExternalProductCatalogsProductCatalog>|\Cake\Datasource\ResultSetInterface<\CakeProducts\Model\Entity\ExternalProductCatalogsProductCatalog> saveManyOrFail(iterable $entities, array $options = [])
* @method iterable<\CakeProducts\Model\Entity\ExternalProductCatalogsProductCatalog>|\Cake\Datasource\ResultSetInterface<\CakeProducts\Model\Entity\ExternalProductCatalogsProductCatalog>|false deleteMany(iterable $entities, array $options = [])
* @method iterable<\CakeProducts\Model\Entity\ExternalProductCatalogsProductCatalog>|\Cake\Datasource\ResultSetInterface<\CakeProducts\Model\Entity\ExternalProductCatalogsProductCatalog> deleteManyOrFail(iterable $entities, array $options = [])
* *
* @mixin TimestampBehavior * @mixin TimestampBehavior
*/ */
@@ -14,14 +14,18 @@ use Cake\Validation\Validator;
* @property ProductCatalogsTable&\Cake\ORM\Association\BelongsTo $ProductCatalogs * @property ProductCatalogsTable&\Cake\ORM\Association\BelongsTo $ProductCatalogs
* *
* @method \CakeProducts\Model\Entity\ExternalProductCatalog newEmptyEntity() * @method \CakeProducts\Model\Entity\ExternalProductCatalog newEmptyEntity()
* @method \CakeProducts\Model\Entity\ExternalProductCatalog newEntity() * @method \CakeProducts\Model\Entity\ExternalProductCatalog newEntity(array $data, array $options = [])
* @method array<\CakeProducts\Model\Entity\ExternalProductCatalog> newEntities(array $data, array $options = []) * @method array<\CakeProducts\Model\Entity\ExternalProductCatalog> newEntities(array $data, array $options = [])
* @method \CakeProducts\Model\Entity\ExternalProductCatalog get() * @method \CakeProducts\Model\Entity\ExternalProductCatalog get(mixed $primaryKey, array|string $finder = 'all', \Psr\SimpleCache\CacheInterface|string|null $cache = null, \Closure|string|null $cacheKey = null, mixed ...$args)
* @method \CakeProducts\Model\Entity\ExternalProductCatalog findOrCreate() * @method \CakeProducts\Model\Entity\ExternalProductCatalog findOrCreate($search, ?callable $callback = null, array $options = [])
* @method \CakeProducts\Model\Entity\ExternalProductCatalog patchEntity() * @method \CakeProducts\Model\Entity\ExternalProductCatalog patchEntity(\Cake\Datasource\EntityInterface $entity, array $data, array $options = [])
* @method array<\CakeProducts\Model\Entity\ExternalProductCatalog> patchEntities(iterable $entities, array $data, array $options = []) * @method array<\CakeProducts\Model\Entity\ExternalProductCatalog> patchEntities(iterable $entities, array $data, array $options = [])
* @method \CakeProducts\Model\Entity\ExternalProductCatalog|false save(\Cake\Datasource\EntityInterface $entity, array $options = []) * @method \CakeProducts\Model\Entity\ExternalProductCatalog|false save(\Cake\Datasource\EntityInterface $entity, array $options = [])
* @method \CakeProducts\Model\Entity\ExternalProductCatalog saveOrFail() * @method \CakeProducts\Model\Entity\ExternalProductCatalog saveOrFail(\Cake\Datasource\EntityInterface $entity, array $options = [])
* @method iterable<\CakeProducts\Model\Entity\ExternalProductCatalog>|\Cake\Datasource\ResultSetInterface<\CakeProducts\Model\Entity\ExternalProductCatalog>|false saveMany(iterable $entities, array $options = [])
* @method iterable<\CakeProducts\Model\Entity\ExternalProductCatalog>|\Cake\Datasource\ResultSetInterface<\CakeProducts\Model\Entity\ExternalProductCatalog> saveManyOrFail(iterable $entities, array $options = [])
* @method iterable<\CakeProducts\Model\Entity\ExternalProductCatalog>|\Cake\Datasource\ResultSetInterface<\CakeProducts\Model\Entity\ExternalProductCatalog>|false deleteMany(iterable $entities, array $options = [])
* @method iterable<\CakeProducts\Model\Entity\ExternalProductCatalog>|\Cake\Datasource\ResultSetInterface<\CakeProducts\Model\Entity\ExternalProductCatalog> deleteManyOrFail(iterable $entities, array $options = [])
* *
* @mixin \Cake\ORM\Behavior\TimestampBehavior * @mixin \Cake\ORM\Behavior\TimestampBehavior
*/ */
+10 -6
View File
@@ -12,14 +12,18 @@ use Cake\Validation\Validator;
* ProductCatalogs Model * ProductCatalogs Model
* *
* @method \CakeProducts\Model\Entity\ProductCatalog newEmptyEntity() * @method \CakeProducts\Model\Entity\ProductCatalog newEmptyEntity()
* @method \CakeProducts\Model\Entity\ProductCatalog newEntity() * @method \CakeProducts\Model\Entity\ProductCatalog newEntity(array $data, array $options = [])
* @method array<\CakeProducts\Model\Entity\ProductCatalog> newEntities(array $data, array $options = []) * @method array<\CakeProducts\Model\Entity\ProductCatalog> newEntities(array $data, array $options = [])
* @method \CakeProducts\Model\Entity\ProductCatalog get() * @method \CakeProducts\Model\Entity\ProductCatalog get(mixed $primaryKey, array|string $finder = 'all', \Psr\SimpleCache\CacheInterface|string|null $cache = null, \Closure|string|null $cacheKey = null, mixed ...$args)
* @method \CakeProducts\Model\Entity\ProductCatalog findOrCreate() * @method \CakeProducts\Model\Entity\ProductCatalog findOrCreate($search, ?callable $callback = null, array $options = [])
* @method \CakeProducts\Model\Entity\ProductCatalog patchEntity() * @method \CakeProducts\Model\Entity\ProductCatalog patchEntity(\Cake\Datasource\EntityInterface $entity, array $data, array $options = [])
* @method array<\CakeProducts\Model\Entity\ProductCatalog> patchEntities(iterable $entities, array $data, array $options = []) * @method array<\CakeProducts\Model\Entity\ProductCatalog> patchEntities(iterable $entities, array $data, array $options = [])
* @method \CakeProducts\Model\Entity\ProductCatalog|false save(\CakeProducts\Model\Entity\ProductCatalog|\Cake\Datasource\EntityInterface $entity, array $options = []) * @method \CakeProducts\Model\Entity\ProductCatalog|false save(\Cake\Datasource\EntityInterface $entity, array $options = [])
* @method \CakeProducts\Model\Entity\ProductCatalog saveOrFail() * @method \CakeProducts\Model\Entity\ProductCatalog saveOrFail(\Cake\Datasource\EntityInterface $entity, array $options = [])
* @method iterable<\CakeProducts\Model\Entity\ProductCatalog>|\Cake\Datasource\ResultSetInterface<\CakeProducts\Model\Entity\ProductCatalog>|false saveMany(iterable $entities, array $options = [])
* @method iterable<\CakeProducts\Model\Entity\ProductCatalog>|\Cake\Datasource\ResultSetInterface<\CakeProducts\Model\Entity\ProductCatalog> saveManyOrFail(iterable $entities, array $options = [])
* @method iterable<\CakeProducts\Model\Entity\ProductCatalog>|\Cake\Datasource\ResultSetInterface<\CakeProducts\Model\Entity\ProductCatalog>|false deleteMany(iterable $entities, array $options = [])
* @method iterable<\CakeProducts\Model\Entity\ProductCatalog>|\Cake\Datasource\ResultSetInterface<\CakeProducts\Model\Entity\ProductCatalog> deleteManyOrFail(iterable $entities, array $options = [])
*/ */
class ProductCatalogsTable extends Table { class ProductCatalogsTable extends Table {
+15 -11
View File
@@ -19,13 +19,17 @@ use CakeProducts\Model\Enum\ProductProductTypeId;
* @property ProductCategoriesTable&\Cake\ORM\Association\HasMany $ChildProductCategories * @property ProductCategoriesTable&\Cake\ORM\Association\HasMany $ChildProductCategories
* *
* @method \CakeProducts\Model\Entity\ProductCategory newEmptyEntity() * @method \CakeProducts\Model\Entity\ProductCategory newEmptyEntity()
* @method \CakeProducts\Model\Entity\ProductCategory newEntity() * @method \CakeProducts\Model\Entity\ProductCategory newEntity(array $data, array $options = [])
* @method array<\CakeProducts\Model\Entity\ProductCategory> newEntities(array $data, array $options = []) * @method array<\CakeProducts\Model\Entity\ProductCategory> newEntities(array $data, array $options = [])
* @method \CakeProducts\Model\Entity\ProductCategory get() * @method \CakeProducts\Model\Entity\ProductCategory get(mixed $primaryKey, array|string $finder = 'all', \Psr\SimpleCache\CacheInterface|string|null $cache = null, \Closure|string|null $cacheKey = null, mixed ...$args)
* @method \CakeProducts\Model\Entity\ProductCategory findOrCreate() * @method \CakeProducts\Model\Entity\ProductCategory findOrCreate($search, ?callable $callback = null, array $options = [])
* @method \CakeProducts\Model\Entity\ProductCategory patchEntity() * @method \CakeProducts\Model\Entity\ProductCategory patchEntity(\Cake\Datasource\EntityInterface $entity, array $data, array $options = [])
* @method array<\CakeProducts\Model\Entity\ProductCategory> patchEntities(iterable $entities, array $data, array $options = []) * @method array<\CakeProducts\Model\Entity\ProductCategory> patchEntities(iterable $entities, array $data, array $options = [])
* @method \CakeProducts\Model\Entity\ProductCategory saveOrFail() * @method \CakeProducts\Model\Entity\ProductCategory saveOrFail(\Cake\Datasource\EntityInterface $entity, array $options = [])
* @method iterable<\CakeProducts\Model\Entity\ProductCategory>|\Cake\Datasource\ResultSetInterface<\CakeProducts\Model\Entity\ProductCategory>|false saveMany(iterable $entities, array $options = [])
* @method iterable<\CakeProducts\Model\Entity\ProductCategory>|\Cake\Datasource\ResultSetInterface<\CakeProducts\Model\Entity\ProductCategory> saveManyOrFail(iterable $entities, array $options = [])
* @method iterable<\CakeProducts\Model\Entity\ProductCategory>|\Cake\Datasource\ResultSetInterface<\CakeProducts\Model\Entity\ProductCategory>|false deleteMany(iterable $entities, array $options = [])
* @method iterable<\CakeProducts\Model\Entity\ProductCategory>|\Cake\Datasource\ResultSetInterface<\CakeProducts\Model\Entity\ProductCategory> deleteManyOrFail(iterable $entities, array $options = [])
* *
* @mixin \Cake\ORM\Behavior\TreeBehavior * @mixin \Cake\ORM\Behavior\TreeBehavior
*/ */
@@ -59,9 +63,9 @@ class ProductCategoriesTable extends Table {
]); ]);
$this->belongsTo('ProductCatalogs', [ $this->belongsTo('ProductCatalogs', [
'className' => 'CakeProducts.ProductCatalogs',
'foreignKey' => 'product_catalog_id', 'foreignKey' => 'product_catalog_id',
'joinType' => 'INNER', 'joinType' => 'INNER',
'className' => 'CakeProducts.ProductCatalogs',
]); ]);
$this->belongsTo('ParentProductCategories', [ $this->belongsTo('ParentProductCategories', [
'className' => 'CakeProducts.ProductCategories', 'className' => 'CakeProducts.ProductCategories',
@@ -74,38 +78,38 @@ class ProductCategoriesTable extends Table {
'cascadeCallbacks' => true, 'cascadeCallbacks' => true,
]); ]);
$this->hasMany('ProductCategoryAttributes', [ $this->hasMany('ProductCategoryAttributes', [
'className' => 'CakeProducts.ProductCategoryAttributes',
'foreignKey' => 'product_category_id', 'foreignKey' => 'product_category_id',
'bindingKey' => 'internal_id', 'bindingKey' => 'internal_id',
'className' => 'CakeProducts.ProductCategoryAttributes',
'dependent' => true, 'dependent' => true,
'cascadeCallbacks' => true, 'cascadeCallbacks' => true,
]); ]);
$this->hasMany('ProductCategoryVariants', [ $this->hasMany('ProductCategoryVariants', [
'className' => 'CakeProducts.ProductCategoryVariants',
'foreignKey' => 'product_category_id', 'foreignKey' => 'product_category_id',
'bindingKey' => 'internal_id', 'bindingKey' => 'internal_id',
'className' => 'CakeProducts.ProductCategoryVariants',
'dependent' => true, 'dependent' => true,
'cascadeCallbacks' => true, 'cascadeCallbacks' => true,
]); ]);
$this->hasMany('Products', [ $this->hasMany('Products', [
'className' => 'CakeProducts.Products',
'foreignKey' => 'product_category_id', 'foreignKey' => 'product_category_id',
'bindingKey' => 'internal_id', 'bindingKey' => 'internal_id',
'className' => 'CakeProducts.Products',
'dependent' => true, 'dependent' => true,
'cascadeCallbacks' => true, 'cascadeCallbacks' => true,
]); ]);
$this->hasMany('ProductPhotos', [ $this->hasMany('ProductPhotos', [
'className' => 'CakeProducts.ProductPhotos',
'foreignKey' => 'product_category_id', 'foreignKey' => 'product_category_id',
'bindingKey' => 'internal_id', 'bindingKey' => 'internal_id',
'className' => 'CakeProducts.ProductPhotos',
'dependent' => true, 'dependent' => true,
'cascadeCallbacks' => true, 'cascadeCallbacks' => true,
]); ]);
$this->hasOne('PrimaryProductPhotos', [ $this->hasOne('PrimaryProductPhotos', [
'className' => 'CakeProducts.ProductPhotos',
'foreignKey' => 'product_category_id', 'foreignKey' => 'product_category_id',
'bindingKey' => 'internal_id', 'bindingKey' => 'internal_id',
'conditions' => ['PrimaryProductPhotos.primary_category_photo' => true], 'conditions' => ['PrimaryProductPhotos.primary_category_photo' => true],
'className' => 'CakeProducts.ProductPhotos',
'dependent' => true, 'dependent' => true,
]); ]);
@@ -14,14 +14,18 @@ use Cake\Validation\Validator;
* @property ProductCategoryAttributesTable&\Cake\ORM\Association\BelongsTo $ProductCategoryAttributes * @property ProductCategoryAttributesTable&\Cake\ORM\Association\BelongsTo $ProductCategoryAttributes
* *
* @method \CakeProducts\Model\Entity\ProductCategoryAttributeOption newEmptyEntity() * @method \CakeProducts\Model\Entity\ProductCategoryAttributeOption newEmptyEntity()
* @method \CakeProducts\Model\Entity\ProductCategoryAttributeOption newEntity() * @method \CakeProducts\Model\Entity\ProductCategoryAttributeOption newEntity(array $data, array $options = [])
* @method array<\CakeProducts\Model\Entity\ProductCategoryAttributeOption> newEntities(array $data, array $options = []) * @method array<\CakeProducts\Model\Entity\ProductCategoryAttributeOption> newEntities(array $data, array $options = [])
* @method \CakeProducts\Model\Entity\ProductCategoryAttributeOption get() * @method \CakeProducts\Model\Entity\ProductCategoryAttributeOption get(mixed $primaryKey, array|string $finder = 'all', \Psr\SimpleCache\CacheInterface|string|null $cache = null, \Closure|string|null $cacheKey = null, mixed ...$args)
* @method \CakeProducts\Model\Entity\ProductCategoryAttributeOption findOrCreate() * @method \CakeProducts\Model\Entity\ProductCategoryAttributeOption findOrCreate($search, ?callable $callback = null, array $options = [])
* @method \CakeProducts\Model\Entity\ProductCategoryAttributeOption patchEntity() * @method \CakeProducts\Model\Entity\ProductCategoryAttributeOption patchEntity(\Cake\Datasource\EntityInterface $entity, array $data, array $options = [])
* @method array<\CakeProducts\Model\Entity\ProductCategoryAttributeOption> patchEntities(iterable $entities, array $data, array $options = []) * @method array<\CakeProducts\Model\Entity\ProductCategoryAttributeOption> patchEntities(iterable $entities, array $data, array $options = [])
* @method \CakeProducts\Model\Entity\ProductCategoryAttributeOption|false save(\CakeProducts\Model\Entity\ProductCategoryAttributeOption|\Cake\Datasource\EntityInterface $entity, array $options = []) * @method \CakeProducts\Model\Entity\ProductCategoryAttributeOption|false save(\Cake\Datasource\EntityInterface $entity, array $options = [])
* @method \CakeProducts\Model\Entity\ProductCategoryAttributeOption saveOrFail() * @method \CakeProducts\Model\Entity\ProductCategoryAttributeOption saveOrFail(\Cake\Datasource\EntityInterface $entity, array $options = [])
* @method iterable<\CakeProducts\Model\Entity\ProductCategoryAttributeOption>|\Cake\Datasource\ResultSetInterface<\CakeProducts\Model\Entity\ProductCategoryAttributeOption>|false saveMany(iterable $entities, array $options = [])
* @method iterable<\CakeProducts\Model\Entity\ProductCategoryAttributeOption>|\Cake\Datasource\ResultSetInterface<\CakeProducts\Model\Entity\ProductCategoryAttributeOption> saveManyOrFail(iterable $entities, array $options = [])
* @method iterable<\CakeProducts\Model\Entity\ProductCategoryAttributeOption>|\Cake\Datasource\ResultSetInterface<\CakeProducts\Model\Entity\ProductCategoryAttributeOption>|false deleteMany(iterable $entities, array $options = [])
* @method iterable<\CakeProducts\Model\Entity\ProductCategoryAttributeOption>|\Cake\Datasource\ResultSetInterface<\CakeProducts\Model\Entity\ProductCategoryAttributeOption> deleteManyOrFail(iterable $entities, array $options = [])
*/ */
class ProductCategoryAttributeOptionsTable extends Table { class ProductCategoryAttributeOptionsTable extends Table {
@@ -17,14 +17,18 @@ use CakeProducts\Model\Enum\ProductCategoryAttributeTypeId;
* @property ProductCategoriesTable&\Cake\ORM\Association\BelongsTo $ProductCategories * @property ProductCategoriesTable&\Cake\ORM\Association\BelongsTo $ProductCategories
* *
* @method \CakeProducts\Model\Entity\ProductCategoryAttribute newEmptyEntity() * @method \CakeProducts\Model\Entity\ProductCategoryAttribute newEmptyEntity()
* @method \CakeProducts\Model\Entity\ProductCategoryAttribute newEntity() * @method \CakeProducts\Model\Entity\ProductCategoryAttribute newEntity(array $data, array $options = [])
* @method array<\CakeProducts\Model\Entity\ProductCategoryAttribute> newEntities(array $data, array $options = []) * @method array<\CakeProducts\Model\Entity\ProductCategoryAttribute> newEntities(array $data, array $options = [])
* @method \CakeProducts\Model\Entity\ProductCategoryAttribute get() * @method \CakeProducts\Model\Entity\ProductCategoryAttribute get(mixed $primaryKey, array|string $finder = 'all', \Psr\SimpleCache\CacheInterface|string|null $cache = null, \Closure|string|null $cacheKey = null, mixed ...$args)
* @method \CakeProducts\Model\Entity\ProductCategoryAttribute findOrCreate() * @method \CakeProducts\Model\Entity\ProductCategoryAttribute findOrCreate($search, ?callable $callback = null, array $options = [])
* @method \CakeProducts\Model\Entity\ProductCategoryAttribute patchEntity() * @method \CakeProducts\Model\Entity\ProductCategoryAttribute patchEntity(\Cake\Datasource\EntityInterface $entity, array $data, array $options = [])
* @method array<\CakeProducts\Model\Entity\ProductCategoryAttribute> patchEntities(iterable $entities, array $data, array $options = []) * @method array<\CakeProducts\Model\Entity\ProductCategoryAttribute> patchEntities(iterable $entities, array $data, array $options = [])
* @method \CakeProducts\Model\Entity\ProductCategoryAttribute|false save(\CakeProducts\Model\Entity\ProductCategoryAttribute|\Cake\Datasource\EntityInterface $entity, array $options = []) * @method \CakeProducts\Model\Entity\ProductCategoryAttribute|false save(\Cake\Datasource\EntityInterface $entity, array $options = [])
* @method \CakeProducts\Model\Entity\ProductCategoryAttribute saveOrFail() * @method \CakeProducts\Model\Entity\ProductCategoryAttribute saveOrFail(\Cake\Datasource\EntityInterface $entity, array $options = [])
* @method iterable<\CakeProducts\Model\Entity\ProductCategoryAttribute>|\Cake\Datasource\ResultSetInterface<\CakeProducts\Model\Entity\ProductCategoryAttribute>|false saveMany(iterable $entities, array $options = [])
* @method iterable<\CakeProducts\Model\Entity\ProductCategoryAttribute>|\Cake\Datasource\ResultSetInterface<\CakeProducts\Model\Entity\ProductCategoryAttribute> saveManyOrFail(iterable $entities, array $options = [])
* @method iterable<\CakeProducts\Model\Entity\ProductCategoryAttribute>|\Cake\Datasource\ResultSetInterface<\CakeProducts\Model\Entity\ProductCategoryAttribute>|false deleteMany(iterable $entities, array $options = [])
* @method iterable<\CakeProducts\Model\Entity\ProductCategoryAttribute>|\Cake\Datasource\ResultSetInterface<\CakeProducts\Model\Entity\ProductCategoryAttribute> deleteManyOrFail(iterable $entities, array $options = [])
*/ */
class ProductCategoryAttributesTable extends Table { class ProductCategoryAttributesTable extends Table {
@@ -14,14 +14,18 @@ use Cake\Validation\Validator;
* @property ProductCategoryVariantsTable&\Cake\ORM\Association\BelongsTo $ProductCategoryVariants * @property ProductCategoryVariantsTable&\Cake\ORM\Association\BelongsTo $ProductCategoryVariants
* *
* @method \CakeProducts\Model\Entity\ProductCategoryVariantOption newEmptyEntity() * @method \CakeProducts\Model\Entity\ProductCategoryVariantOption newEmptyEntity()
* @method \CakeProducts\Model\Entity\ProductCategoryVariantOption newEntity() * @method \CakeProducts\Model\Entity\ProductCategoryVariantOption newEntity(array $data, array $options = [])
* @method array<\CakeProducts\Model\Entity\ProductCategoryVariantOption> newEntities(array $data, array $options = []) * @method array<\CakeProducts\Model\Entity\ProductCategoryVariantOption> newEntities(array $data, array $options = [])
* @method \CakeProducts\Model\Entity\ProductCategoryVariantOption get() * @method \CakeProducts\Model\Entity\ProductCategoryVariantOption get(mixed $primaryKey, array|string $finder = 'all', \Psr\SimpleCache\CacheInterface|string|null $cache = null, \Closure|string|null $cacheKey = null, mixed ...$args)
* @method \CakeProducts\Model\Entity\ProductCategoryVariantOption findOrCreate() * @method \CakeProducts\Model\Entity\ProductCategoryVariantOption findOrCreate($search, ?callable $callback = null, array $options = [])
* @method \CakeProducts\Model\Entity\ProductCategoryVariantOption patchEntity() * @method \CakeProducts\Model\Entity\ProductCategoryVariantOption patchEntity(\Cake\Datasource\EntityInterface $entity, array $data, array $options = [])
* @method array<\CakeProducts\Model\Entity\ProductCategoryVariantOption> patchEntities(iterable $entities, array $data, array $options = []) * @method array<\CakeProducts\Model\Entity\ProductCategoryVariantOption> patchEntities(iterable $entities, array $data, array $options = [])
* @method \CakeProducts\Model\Entity\ProductCategoryVariantOption|false save(\CakeProducts\Model\Entity\ProductCategoryVariantOption|\Cake\Datasource\EntityInterface $entity, array $options = []) * @method \CakeProducts\Model\Entity\ProductCategoryVariantOption|false save(\Cake\Datasource\EntityInterface $entity, array $options = [])
* @method \CakeProducts\Model\Entity\ProductCategoryVariantOption saveOrFail() * @method \CakeProducts\Model\Entity\ProductCategoryVariantOption saveOrFail(\Cake\Datasource\EntityInterface $entity, array $options = [])
* @method iterable<\CakeProducts\Model\Entity\ProductCategoryVariantOption>|\Cake\Datasource\ResultSetInterface<\CakeProducts\Model\Entity\ProductCategoryVariantOption>|false saveMany(iterable $entities, array $options = [])
* @method iterable<\CakeProducts\Model\Entity\ProductCategoryVariantOption>|\Cake\Datasource\ResultSetInterface<\CakeProducts\Model\Entity\ProductCategoryVariantOption> saveManyOrFail(iterable $entities, array $options = [])
* @method iterable<\CakeProducts\Model\Entity\ProductCategoryVariantOption>|\Cake\Datasource\ResultSetInterface<\CakeProducts\Model\Entity\ProductCategoryVariantOption>|false deleteMany(iterable $entities, array $options = [])
* @method iterable<\CakeProducts\Model\Entity\ProductCategoryVariantOption>|\Cake\Datasource\ResultSetInterface<\CakeProducts\Model\Entity\ProductCategoryVariantOption> deleteManyOrFail(iterable $entities, array $options = [])
* *
* @mixin \Cake\ORM\Behavior\TimestampBehavior * @mixin \Cake\ORM\Behavior\TimestampBehavior
*/ */
@@ -16,14 +16,19 @@ use Cake\Validation\Validator;
* @property ProductsTable&\Cake\ORM\Association\BelongsTo $Products * @property ProductsTable&\Cake\ORM\Association\BelongsTo $Products
* *
* @method \CakeProducts\Model\Entity\ProductCategoryVariant newEmptyEntity() * @method \CakeProducts\Model\Entity\ProductCategoryVariant newEmptyEntity()
* @method \CakeProducts\Model\Entity\ProductCategoryVariant newEntity() * @method \CakeProducts\Model\Entity\ProductCategoryVariant newEntity(array $data, array $options = [])
* @method array<\CakeProducts\Model\Entity\ProductCategoryVariant> newEntities(array $data, array $options = []) * @method array<\CakeProducts\Model\Entity\ProductCategoryVariant> newEntities(array $data, array $options = [])
* @method \CakeProducts\Model\Entity\ProductCategoryVariant get() * @method \CakeProducts\Model\Entity\ProductCategoryVariant get(mixed $primaryKey, array|string $finder = 'all', \Psr\SimpleCache\CacheInterface|string|null $cache = null, \Closure|string|null $cacheKey = null, mixed ...$args)
* @method \CakeProducts\Model\Entity\ProductCategoryVariant findOrCreate() * @method \CakeProducts\Model\Entity\ProductCategoryVariant findOrCreate($search, ?callable $callback = null, array $options = [])
* @method \CakeProducts\Model\Entity\ProductCategoryVariant patchEntity() * @method \CakeProducts\Model\Entity\ProductCategoryVariant patchEntity(\Cake\Datasource\EntityInterface $entity, array $data, array $options = [])
* @method array<\CakeProducts\Model\Entity\ProductCategoryVariant> patchEntities(iterable $entities, array $data, array $options = []) * @method array<\CakeProducts\Model\Entity\ProductCategoryVariant> patchEntities(iterable $entities, array $data, array $options = [])
* @method \CakeProducts\Model\Entity\ProductCategoryVariant|false save(\CakeProducts\Model\Entity\ProductCategoryVariant|\Cake\Datasource\EntityInterface $entity, array $options = []) * @method \CakeProducts\Model\Entity\ProductCategoryVariant|false save(\Cake\Datasource\EntityInterface $entity, array $options = [])
* @method \CakeProducts\Model\Entity\ProductCategoryVariant saveOrFail() * @method \CakeProducts\Model\Entity\ProductCategoryVariant saveOrFail(\Cake\Datasource\EntityInterface $entity, array $options = [])
* @method iterable<\CakeProducts\Model\Entity\ProductCategoryVariant>|\Cake\Datasource\ResultSetInterface<\CakeProducts\Model\Entity\ProductCategoryVariant>|false saveMany(iterable $entities, array $options = [])
* @method iterable<\CakeProducts\Model\Entity\ProductCategoryVariant>|\Cake\Datasource\ResultSetInterface<\CakeProducts\Model\Entity\ProductCategoryVariant> saveManyOrFail(iterable $entities, array $options = [])
* @method iterable<\CakeProducts\Model\Entity\ProductCategoryVariant>|\Cake\Datasource\ResultSetInterface<\CakeProducts\Model\Entity\ProductCategoryVariant>|false deleteMany(iterable $entities, array $options = [])
* @method iterable<\CakeProducts\Model\Entity\ProductCategoryVariant>|\Cake\Datasource\ResultSetInterface<\CakeProducts\Model\Entity\ProductCategoryVariant> deleteManyOrFail(iterable $entities, array $options = [])
* /
*/ */
class ProductCategoryVariantsTable extends Table { class ProductCategoryVariantsTable extends Table {
+11 -7
View File
@@ -15,15 +15,19 @@ use Cake\Validation\Validator;
* @property ProductSkusTable&\Cake\ORM\Association\BelongsTo $ProductSkus * @property ProductSkusTable&\Cake\ORM\Association\BelongsTo $ProductSkus
* *
* @method \CakeProducts\Model\Entity\ProductPhoto newEmptyEntity() * @method \CakeProducts\Model\Entity\ProductPhoto newEmptyEntity()
* @method \CakeProducts\Model\Entity\ProductPhoto newEntity() * @method \CakeProducts\Model\Entity\ProductPhoto newEntity(array $data, array $options = [])
* @method array<\CakeProducts\Model\Entity\ProductPhoto> newEntities(array $data, array $options = []) * @method array<\CakeProducts\Model\Entity\ProductPhoto> newEntities(array $data, array $options = [])
* @method \CakeProducts\Model\Entity\ProductPhoto get() * @method \CakeProducts\Model\Entity\ProductPhoto get(mixed $primaryKey, array|string $finder = 'all', \Psr\SimpleCache\CacheInterface|string|null $cache = null, \Closure|string|null $cacheKey = null, mixed ...$args)
* @method \CakeProducts\Model\Entity\ProductPhoto findOrCreate() * @method \CakeProducts\Model\Entity\ProductPhoto findOrCreate($search, ?callable $callback = null, array $options = [])
* @method \CakeProducts\Model\Entity\ProductPhoto patchEntity() * @method \CakeProducts\Model\Entity\ProductPhoto patchEntity(\Cake\Datasource\EntityInterface $entity, array $data, array $options = [])
* @method array<\CakeProducts\Model\Entity\ProductPhoto> patchEntities(iterable $entities, array $data, array $options = []) * @method array<\CakeProducts\Model\Entity\ProductPhoto> patchEntities(iterable $entities, array $data, array $options = [])
* @method \CakeProducts\Model\Entity\ProductPhoto|false save(\CakeProducts\Model\Entity\ProductPhoto|\Cake\Datasource\EntityInterface $entity, array $options = []) * @method \CakeProducts\Model\Entity\ProductPhoto|false save(\Cake\Datasource\EntityInterface $entity, array $options = [])
* @method \CakeProducts\Model\Entity\ProductPhoto saveOrFail() * @method \CakeProducts\Model\Entity\ProductPhoto saveOrFail(\Cake\Datasource\EntityInterface $entity, array $options = [])
* * @method iterable<\CakeProducts\Model\Entity\ProductPhoto>|\Cake\Datasource\ResultSetInterface<\CakeProducts\Model\Entity\ProductPhoto>|false saveMany(iterable $entities, array $options = [])
* @method iterable<\CakeProducts\Model\Entity\ProductPhoto>|\Cake\Datasource\ResultSetInterface<\CakeProducts\Model\Entity\ProductPhoto> saveManyOrFail(iterable $entities, array $options = [])
* @method iterable<\CakeProducts\Model\Entity\ProductPhoto>|\Cake\Datasource\ResultSetInterface<\CakeProducts\Model\Entity\ProductPhoto>|false deleteMany(iterable $entities, array $options = [])
* @method iterable<\CakeProducts\Model\Entity\ProductPhoto>|\Cake\Datasource\ResultSetInterface<\CakeProducts\Model\Entity\ProductPhoto> deleteManyOrFail(iterable $entities, array $options = [])
*
* @mixin \Cake\ORM\Behavior\TimestampBehavior * @mixin \Cake\ORM\Behavior\TimestampBehavior
*/ */
class ProductPhotosTable extends Table { class ProductPhotosTable extends Table {
@@ -15,14 +15,18 @@ use Cake\Validation\Validator;
* @property ProductCategoryVariantOptionsTable&\Cake\ORM\Association\BelongsTo $ProductCategoryVariantOptions * @property ProductCategoryVariantOptionsTable&\Cake\ORM\Association\BelongsTo $ProductCategoryVariantOptions
* *
* @method \CakeProducts\Model\Entity\ProductSkuVariantValue newEmptyEntity() * @method \CakeProducts\Model\Entity\ProductSkuVariantValue newEmptyEntity()
* @method \CakeProducts\Model\Entity\ProductSkuVariantValue newEntity() * @method \CakeProducts\Model\Entity\ProductSkuVariantValue newEntity(array $data, array $options = [])
* @method array<\CakeProducts\Model\Entity\ProductSkuVariantValue> newEntities(array $data, array $options = []) * @method array<\CakeProducts\Model\Entity\ProductSkuVariantValue> newEntities(array $data, array $options = [])
* @method \CakeProducts\Model\Entity\ProductSkuVariantValue get() * @method \CakeProducts\Model\Entity\ProductSkuVariantValue get(mixed $primaryKey, array|string $finder = 'all', \Psr\SimpleCache\CacheInterface|string|null $cache = null, \Closure|string|null $cacheKey = null, mixed ...$args)
* @method \CakeProducts\Model\Entity\ProductSkuVariantValue findOrCreate() * @method \CakeProducts\Model\Entity\ProductSkuVariantValue findOrCreate($search, ?callable $callback = null, array $options = [])
* @method \CakeProducts\Model\Entity\ProductSkuVariantValue patchEntity() * @method \CakeProducts\Model\Entity\ProductSkuVariantValue patchEntity(\Cake\Datasource\EntityInterface $entity, array $data, array $options = [])
* @method array<\CakeProducts\Model\Entity\ProductSkuVariantValue> patchEntities(iterable $entities, array $data, array $options = []) * @method array<\CakeProducts\Model\Entity\ProductSkuVariantValue> patchEntities(iterable $entities, array $data, array $options = [])
* @method \CakeProducts\Model\Entity\ProductSkuVariantValue|false save(\CakeProducts\Model\Entity\ProductSkuVariantValue|\Cake\Datasource\EntityInterface $entity, array $options = []) * @method \CakeProducts\Model\Entity\ProductSkuVariantValue|false save(\Cake\Datasource\EntityInterface $entity, array $options = [])
* @method \CakeProducts\Model\Entity\ProductSkuVariantValue saveOrFail() * @method \CakeProducts\Model\Entity\ProductSkuVariantValue saveOrFail(\Cake\Datasource\EntityInterface $entity, array $options = [])
* @method iterable<\CakeProducts\Model\Entity\ProductSkuVariantValue>|\Cake\Datasource\ResultSetInterface<\CakeProducts\Model\Entity\ProductSkuVariantValue>|false saveMany(iterable $entities, array $options = [])
* @method iterable<\CakeProducts\Model\Entity\ProductSkuVariantValue>|\Cake\Datasource\ResultSetInterface<\CakeProducts\Model\Entity\ProductSkuVariantValue> saveManyOrFail(iterable $entities, array $options = [])
* @method iterable<\CakeProducts\Model\Entity\ProductSkuVariantValue>|\Cake\Datasource\ResultSetInterface<\CakeProducts\Model\Entity\ProductSkuVariantValue>|false deleteMany(iterable $entities, array $options = [])
* @method iterable<\CakeProducts\Model\Entity\ProductSkuVariantValue>|\Cake\Datasource\ResultSetInterface<\CakeProducts\Model\Entity\ProductSkuVariantValue> deleteManyOrFail(iterable $entities, array $options = [])
*/ */
class ProductSkuVariantValuesTable extends Table { class ProductSkuVariantValuesTable extends Table {
+10 -6
View File
@@ -14,14 +14,18 @@ use Cake\Validation\Validator;
* @property ProductsTable&\Cake\ORM\Association\BelongsTo $Products * @property ProductsTable&\Cake\ORM\Association\BelongsTo $Products
* *
* @method \CakeProducts\Model\Entity\ProductSku newEmptyEntity() * @method \CakeProducts\Model\Entity\ProductSku newEmptyEntity()
* @method \CakeProducts\Model\Entity\ProductSku newEntity() * @method \CakeProducts\Model\Entity\ProductSku newEntity(array $data, array $options = [])
* @method array<\CakeProducts\Model\Entity\ProductSku> newEntities(array $data, array $options = []) * @method array<\CakeProducts\Model\Entity\ProductSku> newEntities(array $data, array $options = [])
* @method \CakeProducts\Model\Entity\ProductSku get() * @method \CakeProducts\Model\Entity\ProductSku get(mixed $primaryKey, array|string $finder = 'all', \Psr\SimpleCache\CacheInterface|string|null $cache = null, \Closure|string|null $cacheKey = null, mixed ...$args)
* @method \CakeProducts\Model\Entity\ProductSku findOrCreate() * @method \CakeProducts\Model\Entity\ProductSku findOrCreate($search, ?callable $callback = null, array $options = [])
* @method \CakeProducts\Model\Entity\ProductSku patchEntity() * @method \CakeProducts\Model\Entity\ProductSku patchEntity(\Cake\Datasource\EntityInterface $entity, array $data, array $options = [])
* @method array<\CakeProducts\Model\Entity\ProductSku> patchEntities(iterable $entities, array $data, array $options = []) * @method array<\CakeProducts\Model\Entity\ProductSku> patchEntities(iterable $entities, array $data, array $options = [])
* @method \CakeProducts\Model\Entity\ProductSku|false save(\CakeProducts\Model\Entity\ProductSku|\Cake\Datasource\EntityInterface $entity, array $options = []) * @method \CakeProducts\Model\Entity\ProductSku|false save(\Cake\Datasource\EntityInterface $entity, array $options = [])
* @method \CakeProducts\Model\Entity\ProductSku saveOrFail() * @method \CakeProducts\Model\Entity\ProductSku saveOrFail(\Cake\Datasource\EntityInterface $entity, array $options = [])
* @method iterable<\CakeProducts\Model\Entity\ProductSku>|\Cake\Datasource\ResultSetInterface<\CakeProducts\Model\Entity\ProductSku>|false saveMany(iterable $entities, array $options = [])
* @method iterable<\CakeProducts\Model\Entity\ProductSku>|\Cake\Datasource\ResultSetInterface<\CakeProducts\Model\Entity\ProductSku> saveManyOrFail(iterable $entities, array $options = [])
* @method iterable<\CakeProducts\Model\Entity\ProductSku>|\Cake\Datasource\ResultSetInterface<\CakeProducts\Model\Entity\ProductSku>|false deleteMany(iterable $entities, array $options = [])
* @method iterable<\CakeProducts\Model\Entity\ProductSku>|\Cake\Datasource\ResultSetInterface<\CakeProducts\Model\Entity\ProductSku> deleteManyOrFail(iterable $entities, array $options = [])
* *
* @mixin \Cake\ORM\Behavior\TimestampBehavior * @mixin \Cake\ORM\Behavior\TimestampBehavior
*/ */
+10 -6
View File
@@ -14,14 +14,18 @@ use Cake\Validation\Validator;
* @property ProductsTable&\Cake\ORM\Association\BelongsTo $Products * @property ProductsTable&\Cake\ORM\Association\BelongsTo $Products
* *
* @method \CakeProducts\Model\Entity\ProductVariant newEmptyEntity() * @method \CakeProducts\Model\Entity\ProductVariant newEmptyEntity()
* @method \CakeProducts\Model\Entity\ProductVariant newEntity() * @method \CakeProducts\Model\Entity\ProductVariant newEntity(array $data, array $options = [])
* @method array<\CakeProducts\Model\Entity\ProductVariant> newEntities(array $data, array $options = []) * @method array<\CakeProducts\Model\Entity\ProductVariant> newEntities(array $data, array $options = [])
* @method \CakeProducts\Model\Entity\ProductVariant get() * @method \CakeProducts\Model\Entity\ProductVariant get(mixed $primaryKey, array|string $finder = 'all', \Psr\SimpleCache\CacheInterface|string|null $cache = null, \Closure|string|null $cacheKey = null, mixed ...$args)
* @method \CakeProducts\Model\Entity\ProductVariant findOrCreate() * @method \CakeProducts\Model\Entity\ProductVariant findOrCreate($search, ?callable $callback = null, array $options = [])
* @method \CakeProducts\Model\Entity\ProductVariant patchEntity() * @method \CakeProducts\Model\Entity\ProductVariant patchEntity(\Cake\Datasource\EntityInterface $entity, array $data, array $options = [])
* @method array<\CakeProducts\Model\Entity\ProductVariant> patchEntities(iterable $entities, array $data, array $options = []) * @method array<\CakeProducts\Model\Entity\ProductVariant> patchEntities(iterable $entities, array $data, array $options = [])
* @method \CakeProducts\Model\Entity\ProductVariant|false save(\CakeProducts\Model\Entity\ProductVariant|\Cake\Datasource\EntityInterface $entity, array $options = []) * @method \CakeProducts\Model\Entity\ProductVariant|false save(\Cake\Datasource\EntityInterface $entity, array $options = [])
* @method \CakeProducts\Model\Entity\ProductVariant saveOrFail() * @method \CakeProducts\Model\Entity\ProductVariant saveOrFail(\Cake\Datasource\EntityInterface $entity, array $options = [])
* @method iterable<\CakeProducts\Model\Entity\ProductVariant>|\Cake\Datasource\ResultSetInterface<\CakeProducts\Model\Entity\ProductVariant>|false saveMany(iterable $entities, array $options = [])
* @method iterable<\CakeProducts\Model\Entity\ProductVariant>|\Cake\Datasource\ResultSetInterface<\CakeProducts\Model\Entity\ProductVariant> saveManyOrFail(iterable $entities, array $options = [])
* @method iterable<\CakeProducts\Model\Entity\ProductVariant>|\Cake\Datasource\ResultSetInterface<\CakeProducts\Model\Entity\ProductVariant>|false deleteMany(iterable $entities, array $options = [])
* @method iterable<\CakeProducts\Model\Entity\ProductVariant>|\Cake\Datasource\ResultSetInterface<\CakeProducts\Model\Entity\ProductVariant> deleteManyOrFail(iterable $entities, array $options = [])
*/ */
class ProductVariantsTable extends Table { class ProductVariantsTable extends Table {
+10 -6
View File
@@ -16,14 +16,18 @@ use CakeProducts\Model\Enum\ProductProductTypeId;
* @property ProductCategoriesTable&\Cake\ORM\Association\BelongsTo $ProductCategories * @property ProductCategoriesTable&\Cake\ORM\Association\BelongsTo $ProductCategories
* *
* @method \CakeProducts\Model\Entity\Product newEmptyEntity() * @method \CakeProducts\Model\Entity\Product newEmptyEntity()
* @method \CakeProducts\Model\Entity\Product newEntity() * @method \CakeProducts\Model\Entity\Product newEntity(array $data, array $options = [])
* @method array<\CakeProducts\Model\Entity\Product> newEntities(array $data, array $options = []) * @method array<\CakeProducts\Model\Entity\Product> newEntities(array $data, array $options = [])
* @method \CakeProducts\Model\Entity\Product get() * @method \CakeProducts\Model\Entity\Product get(mixed $primaryKey, array|string $finder = 'all', \Psr\SimpleCache\CacheInterface|string|null $cache = null, \Closure|string|null $cacheKey = null, mixed ...$args)
* @method \CakeProducts\Model\Entity\Product findOrCreate() * @method \CakeProducts\Model\Entity\Product findOrCreate($search, ?callable $callback = null, array $options = [])
* @method \CakeProducts\Model\Entity\Product patchEntity() * @method \CakeProducts\Model\Entity\Product patchEntity(\Cake\Datasource\EntityInterface $entity, array $data, array $options = [])
* @method array<\CakeProducts\Model\Entity\Product> patchEntities(iterable $entities, array $data, array $options = []) * @method array<\CakeProducts\Model\Entity\Product> patchEntities(iterable $entities, array $data, array $options = [])
* @method \CakeProducts\Model\Entity\Product|false save(\CakeProducts\Model\Entity\Product|\Cake\Datasource\EntityInterface $entity, array $options = []) * @method \CakeProducts\Model\Entity\Product|false save(\Cake\Datasource\EntityInterface $entity, array $options = [])
* @method \CakeProducts\Model\Entity\Product saveOrFail() * @method \CakeProducts\Model\Entity\Product saveOrFail(\Cake\Datasource\EntityInterface $entity, array $options = [])
* @method iterable<\CakeProducts\Model\Entity\Product>|\Cake\Datasource\ResultSetInterface<\CakeProducts\Model\Entity\Product>|false saveMany(iterable $entities, array $options = [])
* @method iterable<\CakeProducts\Model\Entity\Product>|\Cake\Datasource\ResultSetInterface<\CakeProducts\Model\Entity\Product> saveManyOrFail(iterable $entities, array $options = [])
* @method iterable<\CakeProducts\Model\Entity\Product>|\Cake\Datasource\ResultSetInterface<\CakeProducts\Model\Entity\Product>|false deleteMany(iterable $entities, array $options = [])
* @method iterable<\CakeProducts\Model\Entity\Product>|\Cake\Datasource\ResultSetInterface<\CakeProducts\Model\Entity\Product> deleteManyOrFail(iterable $entities, array $options = [])
*/ */
class ProductsTable extends Table { class ProductsTable extends Table {
@@ -178,6 +178,8 @@ class ProductPhotosControllerTest extends BaseControllerTest {
'photo' => $image, 'photo' => $image,
'enabled' => 1, 'enabled' => 1,
]; ];
// dd($data);
$this->post($url, $data); $this->post($url, $data);
// dd($this->_response); // dd($this->_response);
$this->assertResponseCode(302); $this->assertResponseCode(302);