use the cheese cake table override trait instead of keeping in this repo
CI / testsuite (mysql, 8.1, ) (push) Failing after 4s
Details
CI / testsuite (mysql, 8.4, ) (push) Failing after 4s
Details
CI / testsuite (pgsql, 8.1, ) (push) Failing after 4s
Details
CI / testsuite (pgsql, 8.4, ) (push) Failing after 4s
Details
CI / testsuite (sqlite, 8.1, ) (push) Failing after 4s
Details
CI / testsuite (sqlite, 8.1, prefer-lowest) (push) Failing after 3s
Details
CI / testsuite (sqlite, 8.4, ) (push) Failing after 3s
Details
CI / Coding Standard & Static Analysis (push) Failing after 7m3s
Details
CI / testsuite (mysql, 8.1, ) (push) Failing after 4s
Details
CI / testsuite (mysql, 8.4, ) (push) Failing after 4s
Details
CI / testsuite (pgsql, 8.1, ) (push) Failing after 4s
Details
CI / testsuite (pgsql, 8.4, ) (push) Failing after 4s
Details
CI / testsuite (sqlite, 8.1, ) (push) Failing after 4s
Details
CI / testsuite (sqlite, 8.1, prefer-lowest) (push) Failing after 3s
Details
CI / testsuite (sqlite, 8.4, ) (push) Failing after 3s
Details
CI / Coding Standard & Static Analysis (push) Failing after 7m3s
Details
This commit is contained in:
parent
1477b4b96d
commit
e8e7afa86c
|
@ -6,6 +6,7 @@
|
|||
"require": {
|
||||
"php": ">=8.1",
|
||||
"dereuromark/cakephp-tools": "^3.9",
|
||||
"hi-powered-dev/cheese-cake": "^0.0.6",
|
||||
"cakephp/migrations": "^4.0.0",
|
||||
"cakephp/cakephp": "^5.0.1"
|
||||
},
|
||||
|
|
|
@ -8,7 +8,7 @@ use Cake\Log\Log;
|
|||
use Cake\ORM\Table;
|
||||
use Cake\ORM\TableRegistry;
|
||||
use CakeProducts\Controller\AppController;
|
||||
use CakeProducts\Controller\Traits\OverrideTableTrait;
|
||||
use CheeseCake\Controller\Traits\OverrideTableTrait;
|
||||
|
||||
/**
|
||||
* ExternalProductCatalogs Controller
|
||||
|
|
|
@ -10,7 +10,8 @@ use Cake\Log\Log;
|
|||
use Cake\ORM\Table;
|
||||
use Cake\ORM\TableRegistry;
|
||||
use CakeProducts\Controller\AppController;
|
||||
use CakeProducts\Controller\Traits\OverrideTableTrait;
|
||||
use CheeseCake\Controller\Traits\OverrideTableTrait;
|
||||
;
|
||||
use CakeProducts\Model\Table\ProductCatalogsTable;
|
||||
|
||||
/**
|
||||
|
|
|
@ -8,7 +8,8 @@ use Cake\Log\Log;
|
|||
use Cake\ORM\Table;
|
||||
use Cake\ORM\TableRegistry;
|
||||
use Cake\Utility\Text;
|
||||
use CakeProducts\Controller\Traits\OverrideTableTrait;
|
||||
use CheeseCake\Controller\Traits\OverrideTableTrait;
|
||||
;
|
||||
|
||||
/**
|
||||
* ProductCategories Controller
|
||||
|
|
|
@ -8,7 +8,8 @@ use Cake\Log\Log;
|
|||
use Cake\ORM\Table;
|
||||
use Cake\ORM\TableRegistry;
|
||||
use CakeProducts\Controller\AppController;
|
||||
use CakeProducts\Controller\Traits\OverrideTableTrait;
|
||||
use CheeseCake\Controller\Traits\OverrideTableTrait;
|
||||
;
|
||||
|
||||
/**
|
||||
* ProductCategoryAttributeOptions Controller
|
||||
|
|
|
@ -10,7 +10,8 @@ use Cake\Log\Log;
|
|||
use Cake\ORM\Table;
|
||||
use Cake\ORM\TableRegistry;
|
||||
use CakeProducts\Controller\AppController;
|
||||
use CakeProducts\Controller\Traits\OverrideTableTrait;
|
||||
use CheeseCake\Controller\Traits\OverrideTableTrait;
|
||||
;
|
||||
use CakeProducts\Model\Enum\ProductCategoryAttributeTypeId;
|
||||
use CakeProducts\Model\Table\ProductCategoryAttributesTable;
|
||||
|
||||
|
|
|
@ -8,7 +8,8 @@ use Cake\Log\Log;
|
|||
use Cake\ORM\Table;
|
||||
use Cake\ORM\TableRegistry;
|
||||
use CakeProducts\Controller\AppController;
|
||||
use CakeProducts\Controller\Traits\OverrideTableTrait;
|
||||
use CheeseCake\Controller\Traits\OverrideTableTrait;
|
||||
;
|
||||
|
||||
/**
|
||||
* Products Controller
|
||||
|
|
|
@ -1,70 +0,0 @@
|
|||
<?php
|
||||
|
||||
namespace CakeProducts\Controller\Traits;
|
||||
|
||||
use Cake\Core\Configure;
|
||||
use Cake\ORM\Table;
|
||||
use Cake\ORM\TableRegistry;
|
||||
|
||||
trait OverrideTableTrait
|
||||
{
|
||||
/**
|
||||
* @var 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 Table
|
||||
*/
|
||||
public function getTable(string $tableName = null)
|
||||
{
|
||||
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;
|
||||
}
|
||||
|
||||
protected function getTableConfigKey()
|
||||
{
|
||||
if (!$this->_tableConfigKey) {
|
||||
$this->_tableConfigKey = $this->getPlugin() . '.' . $this->defaultTable . '.table';
|
||||
}
|
||||
|
||||
return $this->_tableConfigKey;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the users table
|
||||
*
|
||||
* @param Table $table table
|
||||
* @return void
|
||||
*/
|
||||
public function setTable(Table $table)
|
||||
{
|
||||
$this->_table = $table;
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue