flexible table classes in controllers for rest of tables
This commit is contained in:
@@ -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
|
||||
*
|
||||
|
||||
Reference in New Issue
Block a user