dont use cheese cake override table trait - dont think is necessary
This commit is contained in:
@@ -7,9 +7,6 @@ use Cake\Core\Configure;
|
||||
use Cake\Log\Log;
|
||||
use Cake\ORM\Table;
|
||||
use Cake\ORM\TableRegistry;
|
||||
use CakeProducts\Controller\AppController;
|
||||
use CheeseCake\Controller\Traits\OverrideTableTrait;
|
||||
;
|
||||
|
||||
/**
|
||||
* Products Controller
|
||||
@@ -18,8 +15,6 @@ use CheeseCake\Controller\Traits\OverrideTableTrait;
|
||||
*/
|
||||
class ProductsController extends AppController
|
||||
{
|
||||
use OverrideTableTrait;
|
||||
|
||||
/**
|
||||
* @return void
|
||||
*/
|
||||
@@ -37,7 +32,7 @@ class ProductsController extends AppController
|
||||
*/
|
||||
public function index()
|
||||
{
|
||||
$query = $this->getTable()->find()
|
||||
$query = $this->Products->find()
|
||||
->contain(['ProductCategories']);
|
||||
$products = $this->paginate($query);
|
||||
|
||||
@@ -53,7 +48,7 @@ class ProductsController extends AppController
|
||||
*/
|
||||
public function view($id = null)
|
||||
{
|
||||
$product = $this->getTable()->get($id, contain: [
|
||||
$product = $this->Products->get($id, contain: [
|
||||
'ProductCategories',
|
||||
'ProductAttributes',
|
||||
'ProductAttributes.ProductCategoryAttributes',
|
||||
@@ -74,7 +69,7 @@ class ProductsController extends AppController
|
||||
*/
|
||||
public function add()
|
||||
{
|
||||
$productsTable = $this->getTable();
|
||||
$productsTable = $this->Products;
|
||||
$product = $productsTable->newEmptyEntity();
|
||||
if ($this->request->is('post')) {
|
||||
$postData = $this->request->getData();
|
||||
@@ -151,7 +146,7 @@ class ProductsController extends AppController
|
||||
*/
|
||||
public function edit($id = null)
|
||||
{
|
||||
$productsTable = $this->getTable();
|
||||
$productsTable = $this->Products;
|
||||
$product = $productsTable->get($id, contain: [
|
||||
'ProductAttributes',
|
||||
'ProductAttributes.ProductCategoryAttributes',
|
||||
@@ -187,7 +182,7 @@ class ProductsController extends AppController
|
||||
{
|
||||
$this->request->allowMethod(['post', 'delete']);
|
||||
|
||||
$productsTable = $this->getTable();
|
||||
$productsTable = $this->Products;
|
||||
$product = $productsTable->get($id);
|
||||
if ($productsTable->delete($product)) {
|
||||
$this->Flash->success(__('The product has been deleted.'));
|
||||
@@ -203,7 +198,7 @@ class ProductsController extends AppController
|
||||
*/
|
||||
public function select()
|
||||
{
|
||||
$productsTable = $this->getTable();
|
||||
$productsTable = $this->Products;
|
||||
$productCategory = $productsTable->ProductCategories->find()
|
||||
->where(['id' => $this->request->getQuery('product_category_id', '-1')])
|
||||
->first();
|
||||
|
||||
Reference in New Issue
Block a user