flexible table classes in controllers for rest of tables

This commit is contained in:
2025-03-28 23:34:21 -07:00
parent 3f461cabb8
commit b868cc11fb
6 changed files with 164 additions and 53 deletions

View File

@@ -3,7 +3,10 @@ declare(strict_types=1);
namespace CakeProducts\Controller;
use Cake\Core\Configure;
use Cake\Log\Log;
use Cake\ORM\Table;
use Cake\ORM\TableRegistry;
use CakeProducts\Controller\AppController;
/**
@@ -13,6 +16,28 @@ use CakeProducts\Controller\AppController;
*/
class ExternalProductCatalogsController extends AppController
{
/**
* @var Table|null
*/
protected ?Table $_table = null;
/**
* Gets the table instance
*
* @return Table
*/
public function getTable()
{
if ($this->_table instanceof Table) {
return $this->_table;
}
$this->_table = TableRegistry::getTableLocator()->get(
Configure::read('CakeProducts.ExternalProductCatalogs.table', 'CakeProducts.ExternalProductCatalogs')
);
return $this->_table;
}
/**
* Index method
*