// Set $definition in ObjectModel classes for modules
This commit is contained in:
@@ -33,31 +33,19 @@ class LoyaltyStateModule extends ObjectModel
|
||||
public $name;
|
||||
public $id_order_state;
|
||||
|
||||
protected $fieldsValidate = array('id_order_state' => 'isInt');
|
||||
protected $fieldsRequiredLang = array('name');
|
||||
protected $fieldsSizeLang = array('name' => 128);
|
||||
protected $fieldsValidateLang = array('name' => 'isGenericName');
|
||||
|
||||
protected $table = 'loyalty_state';
|
||||
protected $identifier = 'id_loyalty_state';
|
||||
|
||||
public function getFields()
|
||||
{
|
||||
$this->validateFields();
|
||||
$fields['id_order_state'] = (int)($this->id_order_state);
|
||||
return $fields;
|
||||
}
|
||||
|
||||
/**
|
||||
* Check then return multilingual fields for database interaction
|
||||
*
|
||||
* @return array Multilingual fields
|
||||
*/
|
||||
public function getTranslationsFieldsChild()
|
||||
{
|
||||
$this->validateFieldsLang();
|
||||
return $this->getTranslationsFields(array('name'));
|
||||
}
|
||||
* @see ObjectModel::$definition
|
||||
*/
|
||||
public static $definition = array(
|
||||
'table' => 'loyalty_state',
|
||||
'primary' => 'id_loyalty_state',
|
||||
'fields' => array(
|
||||
'id_order_state' => array('type' => self::TYPE_INT, 'validate' => 'isInt'),
|
||||
|
||||
// Lang fields
|
||||
'name' => array('type' => self::TYPE_STRING, 'lang' => true, 'validate' => 'isGenericName', 'required' => true, 'size' => 128),
|
||||
),
|
||||
);
|
||||
|
||||
public static function getDefaultId() { return 1; }
|
||||
public static function getValidationId() { return 2; }
|
||||
|
||||
Reference in New Issue
Block a user