allow customizing entity class but default to CakeProducts entities - catalogs + categories
This commit is contained in:
@@ -47,6 +47,9 @@ class ProductCatalogsTable extends Table
|
||||
$this->setDisplayField('name');
|
||||
$this->setPrimaryKey('id');
|
||||
|
||||
$this->setEntityClass(
|
||||
Configure::read('CakeProducts.ProductCatalogs.entity', 'CakeProducts\Model\Entity\ProductCatalog')
|
||||
);
|
||||
$this->hasMany('ProductCategories', [
|
||||
'className' => 'CakeProducts.ProductCategories',
|
||||
]);
|
||||
|
||||
@@ -3,6 +3,7 @@ declare(strict_types=1);
|
||||
|
||||
namespace CakeProducts\Model\Table;
|
||||
|
||||
use Cake\Core\Configure;
|
||||
use Cake\Datasource\EntityInterface;
|
||||
use Cake\Datasource\ResultSetInterface;
|
||||
use Cake\ORM\Association\BelongsTo;
|
||||
@@ -61,7 +62,9 @@ class ProductCategoriesTable extends Table
|
||||
$this->setTable('product_categories');
|
||||
$this->setDisplayField('name');
|
||||
$this->setPrimaryKey('id');
|
||||
|
||||
$this->setEntityClass(
|
||||
Configure::read('CakeProducts.ProductCategories.entity', 'CakeProducts\Model\Entity\ProductCategory')
|
||||
);
|
||||
$this->addBehavior('Tree');
|
||||
|
||||
$this->belongsTo('ProductCatalogs', [
|
||||
|
||||
Reference in New Issue
Block a user