testing brought in

This commit is contained in:
2026-03-17 01:35:40 -07:00
parent 39334d8e4a
commit 4f996eb7d2
20 changed files with 641 additions and 192 deletions

View File

@@ -5,6 +5,5 @@ namespace CheeseCake\Controller;
use App\Controller\AppController as BaseController;
class AppController extends BaseController
{
class AppController extends BaseController {
}

View File

@@ -6,65 +6,66 @@ use Cake\Core\Configure;
use Cake\ORM\Table;
use Cake\ORM\TableRegistry;
trait OverrideTableTrait
{
/**
* @var Table|null
*/
protected ?Table $_table = null;
trait OverrideTableTrait {
/**
/**
* @var \Cake\ORM\Table|null
*/
protected ?Table $_table = null;
/**
* This object's default table alias.
*
* @var string|null
*/
protected ?string $defaultTable = null;
protected ?string $defaultTable = null;
/**
/**
* @var string
*/
protected string $_tableConfigKey = '';
protected string $_tableConfigKey = '';
/**
/**
* Gets the table instance
*
* @return Table
* @return \Cake\ORM\Table
*/
public function getTable(string|null $tableName)
{
if ($this->_table instanceof Table) {
return $this->_table;
}
$this->getTableConfigKey();
$table = $tableName;
if (!isset($table)) {
$table = $this->defaultTable;
if (Configure::read($this->_tableConfigKey)) {
$table = Configure::read($this->_tableConfigKey);
}
}
$this->_table = TableRegistry::getTableLocator()->get($table);
public function getTable(string|null $tableName) {
if ($this->_table instanceof Table) {
return $this->_table;
}
$this->getTableConfigKey();
$table = $tableName;
if (!isset($table)) {
$table = $this->defaultTable;
if (Configure::read($this->_tableConfigKey)) {
$table = Configure::read($this->_tableConfigKey);
}
}
$this->_table = TableRegistry::getTableLocator()->get($table);
return $this->_table;
}
return $this->_table;
}
protected function getTableConfigKey()
{
if (!$this->_tableConfigKey) {
$this->_tableConfigKey = $this->getPlugin() . '.' . $this->defaultTable . '.table';
}
/**
* @return string
*/
protected function getTableConfigKey() {
if (!$this->_tableConfigKey) {
$this->_tableConfigKey = $this->getPlugin() . '.' . $this->defaultTable . '.table';
}
return $this->_tableConfigKey;
}
return $this->_tableConfigKey;
}
/**
/**
* Set the users table
*
* @param Table $table table
* @param \Cake\ORM\Table $table table
* @return void
*/
public function setTable(Table $table)
{
$this->_table = $table;
}
}
public function setTable(Table $table) {
$this->_table = $table;
}
}