default product type id on categories table
This commit is contained in:
@@ -4,6 +4,7 @@ declare(strict_types=1);
|
||||
namespace CakeProducts\Model\Table;
|
||||
|
||||
use Cake\Core\Configure;
|
||||
use Cake\Database\Type\EnumType;
|
||||
use Cake\Datasource\EntityInterface;
|
||||
use Cake\Datasource\ResultSetInterface;
|
||||
use Cake\ORM\Association\BelongsTo;
|
||||
@@ -14,6 +15,7 @@ use Cake\ORM\RulesChecker;
|
||||
use Cake\ORM\Table;
|
||||
use Cake\Validation\Validator;
|
||||
use CakeProducts\Model\Entity\ProductCategory;
|
||||
use CakeProducts\Model\Enum\ProductProductTypeId;
|
||||
use Closure;
|
||||
use Psr\SimpleCache\CacheInterface;
|
||||
|
||||
@@ -99,6 +101,8 @@ class ProductCategoriesTable extends Table
|
||||
'cascadeCallbacks' => true,
|
||||
]);
|
||||
|
||||
$this->getSchema()->setColumnType('default_product_type_id', EnumType::from(ProductProductTypeId::class));
|
||||
|
||||
$this->behaviors()->Tree->setConfig('scope', ['product_catalog_id' => $this->treeCatalogId]);
|
||||
$this->addBehavior('Muffin/Trash.Trash');
|
||||
}
|
||||
@@ -137,6 +141,10 @@ class ProductCategoriesTable extends Table
|
||||
->dateTime('deleted')
|
||||
->allowEmptyDateTime('deleted');
|
||||
|
||||
$validator
|
||||
->integer('default_product_type_id')
|
||||
->allowEmptyString('default_product_type_id');
|
||||
|
||||
return $validator;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user