override table trait isnt useful, removed
CI / testsuite (mysql, 8.2, ) (push) Successful in 3m51s
CI / testsuite (pgsql, 8.2, ) (push) Successful in 4m37s
CI / testsuite (pgsql, 8.4, ) (push) Successful in 2m49s
CI / testsuite (sqlite, 8.2, ) (push) Successful in 4m4s
CI / testsuite (sqlite, 8.2, prefer-lowest) (push) Successful in 3m53s
CI / testsuite (mysql, 8.4, ) (push) Successful in 10m51s
Release / build (push) Successful in 17s
CI / Coding Standard & Static Analysis (push) Successful in 3m32s
CI / testsuite (sqlite, 8.4, ) (push) Successful in 11m32s
CI / testsuite (mysql, 8.2, ) (push) Successful in 3m51s
CI / testsuite (pgsql, 8.2, ) (push) Successful in 4m37s
CI / testsuite (pgsql, 8.4, ) (push) Successful in 2m49s
CI / testsuite (sqlite, 8.2, ) (push) Successful in 4m4s
CI / testsuite (sqlite, 8.2, prefer-lowest) (push) Successful in 3m53s
CI / testsuite (mysql, 8.4, ) (push) Successful in 10m51s
Release / build (push) Successful in 17s
CI / Coding Standard & Static Analysis (push) Successful in 3m32s
CI / testsuite (sqlite, 8.4, ) (push) Successful in 11m32s
This commit is contained in:
@@ -9,4 +9,3 @@ parameters:
|
||||
- tests/bootstrap.php
|
||||
treatPhpDocTypesAsCertain: false
|
||||
ignoreErrors:
|
||||
- identifier: trait.unused
|
||||
|
||||
@@ -1,9 +0,0 @@
|
||||
<?php
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace CheeseCake\Controller;
|
||||
|
||||
use Cake\Controller\Controller;
|
||||
|
||||
class AppController extends Controller {
|
||||
}
|
||||
@@ -1,71 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace CheeseCake\Controller\Traits;
|
||||
|
||||
use Cake\Core\Configure;
|
||||
use Cake\ORM\Table;
|
||||
use Cake\ORM\TableRegistry;
|
||||
|
||||
trait OverrideTableTrait {
|
||||
|
||||
/**
|
||||
* @var \Cake\ORM\Table|null
|
||||
*/
|
||||
protected ?Table $_table = null;
|
||||
|
||||
/**
|
||||
* This object's default table alias.
|
||||
*
|
||||
* @var string|null
|
||||
*/
|
||||
protected ?string $defaultTable = null;
|
||||
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
protected string $_tableConfigKey = '';
|
||||
|
||||
/**
|
||||
* Gets the table instance
|
||||
*
|
||||
* @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);
|
||||
|
||||
return $this->_table;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
protected function getTableConfigKey() {
|
||||
if (!$this->_tableConfigKey) {
|
||||
$this->_tableConfigKey = $this->getPlugin() . '.' . $this->defaultTable . '.table';
|
||||
}
|
||||
|
||||
return $this->_tableConfigKey;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the users table
|
||||
*
|
||||
* @param \Cake\ORM\Table $table table
|
||||
* @return void
|
||||
*/
|
||||
public function setTable(Table $table) {
|
||||
$this->_table = $table;
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user