composer update + load more dev dependencies for code quality, checkstyle fix
This commit is contained in:
@@ -29,88 +29,86 @@ use Cake\Validation\Validator;
|
||||
* @method iterable<\App\Model\Entity\ProductAttribute>|\Cake\Datasource\ResultSetInterface<\App\Model\Entity\ProductAttribute>|false deleteMany(iterable $entities, array $options = [])
|
||||
* @method iterable<\App\Model\Entity\ProductAttribute>|\Cake\Datasource\ResultSetInterface<\App\Model\Entity\ProductAttribute> deleteManyOrFail(iterable $entities, array $options = [])
|
||||
*/
|
||||
class ProductAttributesTable extends Table
|
||||
{
|
||||
/**
|
||||
class ProductAttributesTable extends Table {
|
||||
|
||||
/**
|
||||
* Initialize method
|
||||
*
|
||||
* @param array<string, mixed> $config The configuration for the Table.
|
||||
* @return void
|
||||
*/
|
||||
public function initialize(array $config): void
|
||||
{
|
||||
parent::initialize($config);
|
||||
public function initialize(array $config): void {
|
||||
parent::initialize($config);
|
||||
|
||||
$this->setTable('product_attributes');
|
||||
$this->setDisplayField('id');
|
||||
$this->setPrimaryKey('id');
|
||||
$this->setTable('product_attributes');
|
||||
$this->setDisplayField('id');
|
||||
$this->setPrimaryKey('id');
|
||||
|
||||
$this->setEntityClass(
|
||||
Configure::read('CakeProducts.ProductAttributes.entity', 'CakeProducts\Model\Entity\ProductAttribute')
|
||||
);
|
||||
$this->setEntityClass(
|
||||
Configure::read('CakeProducts.ProductAttributes.entity', 'CakeProducts\Model\Entity\ProductAttribute'),
|
||||
);
|
||||
|
||||
$this->belongsTo('Products', [
|
||||
'foreignKey' => 'product_id',
|
||||
'className' => 'CakeProducts.Products',
|
||||
'joinType' => 'INNER',
|
||||
]);
|
||||
$this->belongsTo('ProductCategoryAttributes', [
|
||||
'foreignKey' => 'product_category_attribute_id',
|
||||
'className' => 'CakeProducts.ProductCategoryAttributes',
|
||||
'joinType' => 'INNER',
|
||||
]);
|
||||
$this->belongsTo('ProductCategoryAttributeOptions', [
|
||||
'foreignKey' => 'product_category_attribute_option_id',
|
||||
'className' => 'CakeProducts.ProductCategoryAttributeOptions',
|
||||
]);
|
||||
$this->belongsTo('Products', [
|
||||
'foreignKey' => 'product_id',
|
||||
'className' => 'CakeProducts.Products',
|
||||
'joinType' => 'INNER',
|
||||
]);
|
||||
$this->belongsTo('ProductCategoryAttributes', [
|
||||
'foreignKey' => 'product_category_attribute_id',
|
||||
'className' => 'CakeProducts.ProductCategoryAttributes',
|
||||
'joinType' => 'INNER',
|
||||
]);
|
||||
$this->belongsTo('ProductCategoryAttributeOptions', [
|
||||
'foreignKey' => 'product_category_attribute_option_id',
|
||||
'className' => 'CakeProducts.ProductCategoryAttributeOptions',
|
||||
]);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
/**
|
||||
* Default validation rules.
|
||||
*
|
||||
* @param \Cake\Validation\Validator $validator Validator instance.
|
||||
* @return \Cake\Validation\Validator
|
||||
*/
|
||||
public function validationDefault(Validator $validator): Validator
|
||||
{
|
||||
$validator
|
||||
->uuid('product_id')
|
||||
->notEmptyString('product_id');
|
||||
public function validationDefault(Validator $validator): Validator {
|
||||
$validator
|
||||
->uuid('product_id')
|
||||
->notEmptyString('product_id');
|
||||
|
||||
$validator
|
||||
->uuid('product_category_attribute_id')
|
||||
->notEmptyString('product_category_attribute_id');
|
||||
$validator
|
||||
->uuid('product_category_attribute_id')
|
||||
->notEmptyString('product_category_attribute_id');
|
||||
|
||||
$validator
|
||||
->scalar('attribute_value')
|
||||
->maxLength('attribute_value', 255)
|
||||
->allowEmptyString('attribute_value');
|
||||
$validator
|
||||
->scalar('attribute_value')
|
||||
->maxLength('attribute_value', 255)
|
||||
->allowEmptyString('attribute_value');
|
||||
|
||||
$validator
|
||||
->uuid('product_category_attribute_option_id')
|
||||
->allowEmptyString('product_category_attribute_option_id');
|
||||
$validator
|
||||
->uuid('product_category_attribute_option_id')
|
||||
->allowEmptyString('product_category_attribute_option_id');
|
||||
|
||||
$validator
|
||||
->dateTime('deleted')
|
||||
->allowEmptyDateTime('deleted');
|
||||
$validator
|
||||
->dateTime('deleted')
|
||||
->allowEmptyDateTime('deleted');
|
||||
|
||||
return $validator;
|
||||
}
|
||||
return $validator;
|
||||
}
|
||||
|
||||
/**
|
||||
/**
|
||||
* Returns a rules checker object that will be used for validating
|
||||
* application integrity.
|
||||
*
|
||||
* @param \Cake\ORM\RulesChecker $rules The rules object to be modified.
|
||||
* @return \Cake\ORM\RulesChecker
|
||||
*/
|
||||
public function buildRules(RulesChecker $rules): RulesChecker
|
||||
{
|
||||
$rules->add($rules->existsIn(['product_id'], 'Products'), ['errorField' => 'product_id']);
|
||||
$rules->add($rules->existsIn(['product_category_attribute_id'], 'ProductCategoryAttributes'), ['errorField' => 'product_category_attribute_id']);
|
||||
$rules->add($rules->existsIn(['product_category_attribute_option_id'], 'ProductCategoryAttributeOptions'), ['errorField' => 'product_category_attribute_option_id']);
|
||||
public function buildRules(RulesChecker $rules): RulesChecker {
|
||||
$rules->add($rules->existsIn(['product_id'], 'Products'), ['errorField' => 'product_id']);
|
||||
$rules->add($rules->existsIn(['product_category_attribute_id'], 'ProductCategoryAttributes'), ['errorField' => 'product_category_attribute_id']);
|
||||
$rules->add($rules->existsIn(['product_category_attribute_option_id'], 'ProductCategoryAttributeOptions'), ['errorField' => 'product_category_attribute_option_id']);
|
||||
|
||||
return $rules;
|
||||
}
|
||||
|
||||
return $rules;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user