use override table trait to allow for easily customzing table a controller uses

This commit is contained in:
2025-03-29 00:52:38 -07:00
parent b868cc11fb
commit 8229722779
7 changed files with 103 additions and 83 deletions

View File

@@ -10,8 +10,8 @@ use Cake\Log\Log;
use Cake\ORM\Table;
use Cake\ORM\TableRegistry;
use CakeProducts\Controller\AppController;
use CakeProducts\Controller\Traits\OverrideTableTrait;
use CakeProducts\Model\Table\ProductCatalogsTable;
use CakeProducts\Service\CatalogManagerService;
/**
* ProductCatalogs Controller
@@ -20,7 +20,17 @@ use CakeProducts\Service\CatalogManagerService;
*/
class ProductCatalogsController extends AppController
{
protected ?Table $_table = null;
use OverrideTableTrait;
/**
* @return void
*/
public function initialize(): void
{
parent::initialize(); // TODO: Change the autogenerated stub
$this->_defaultTable = 'CakeProducts.ProductCatalogs';
$this->_tableConfigKey = 'CakeProducts.ProductCatalogs.table';
}
/**
* Index method