Created
September 25, 2012 10:35
-
-
Save davehewy/3781105 to your computer and use it in GitHub Desktop.
Lemonstand model
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
class BwDiscountCodes_Log extends Db_ActiveRecord { | |
public $strings = array( | |
'model_title' => 'BW Discount Codes', | |
'model_name' => 'discount_code_logs', | |
'model_code' => 'bw_discount_codes_log', | |
'table_name' => 'bw_discount_codes_log', | |
'module_name' => 'bwdiscountcodes' | |
); | |
public $has_and_belongs_to_many = array( | |
'customer_email'=>array( | |
'class_name'=>'Shop_Customer', | |
'join_table'=>'shop_customers', | |
'primary_key'=>'id', | |
'foreign_key'=>'id') | |
); | |
public $custom_columns = array('customer_email'=>db_varchar); | |
public function eval_customer_name() { return $this->customer->last_name.$this->customer_first_name; } | |
public function __construct() { | |
$this->table_name = $this->strings['table_name']; | |
$this->module_name = $this->strings['module_name']; | |
$this->model_name = $this->strings['model_name']; | |
parent::__construct(); | |
} | |
public static function create() { | |
return new self(); | |
} | |
public function define_columns($context = null) | |
{ | |
$this->define_column('id', '#'); | |
$this->define_column('customer_id', 'Customer ID'); | |
//$this->define_multi_relation_column('customer_name', 'customers', 'Customer Name', "CONCAT(@first_name,' ', @last_name)"); | |
$this->define_multi_relation_column('customer_email', 'customer_email', 'Customer Email', "@email"); | |
$this->define_column('coupon_id', 'Coupon ID'); | |
$this->define_column('email_template_id', 'Email Template ID'); | |
$this->define_multi_relation_column('email_template_id', 'id', 'Email Template ID', "@code"); | |
$this->define_column('scheduled_send_time', 'Send on'); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment