// Set $definition in ObjectModel classes for modules

git-svn-id: http://dev.prestashop.com/svn/v1/branches/1.5.x@11950 b9a71923-0436-4b27-9f14-aed3839534dd
This commit is contained in:
rMalie
2011-12-30 15:37:57 +00:00
parent c07fb96831
commit 92b2d682f1
8 changed files with 157 additions and 249 deletions
+16 -18
View File
@@ -38,24 +38,22 @@ class LoyaltyModule extends ObjectModel
public $date_add;
public $date_upd;
protected $fieldsRequired = array('id_customer', 'points');
protected $fieldsValidate = array('id_loyalty_state' => 'isInt', 'id_customer' => 'isInt', 'id_cart_rule' => 'isInt', 'id_order' => 'isInt', 'points' => 'isInt');
protected $table = 'loyalty';
protected $identifier = 'id_loyalty';
public function getFields()
{
$this->validateFields();
$fields['id_loyalty_state'] = (int)$this->id_loyalty_state;
$fields['id_customer'] = (int)$this->id_customer;
$fields['id_order'] = (int)$this->id_order;
$fields['id_cart_rule'] = (int)$this->id_cart_rule;
$fields['points'] = (int)$this->points;
$fields['date_add'] = pSQL($this->date_add);
$fields['date_upd'] = pSQL($this->date_upd);
return $fields;
}
/**
* @see ObjectModel::$definition
*/
public static $definition = array(
'table' => 'loyalty',
'primary' => 'id_loyalty',
'fields' => array(
'id_loyalty_state' => array('type' => self::TYPE_INT, 'validate' => 'isInt'),
'id_customer' => array('type' => self::TYPE_INT, 'validate' => 'isInt', 'required' => true),
'id_order' => array('type' => self::TYPE_INT, 'validate' => 'isInt'),
'id_cart_rule' => array('type' => self::TYPE_INT, 'validate' => 'isInt'),
'points' => array('type' => self::TYPE_INT, 'validate' => 'isInt', 'required' => true),
'date_add' => array('type' => self::TYPE_DATE, 'validate' => 'isDate'),
'date_upd' => array('type' => self::TYPE_DATE, 'validate' => 'isDate'),
)
);
public function save($nullValues = false, $autodate = true)
{