Пример #1
0
    /**
     * @var Som_Model_Mapper_Abstract
     */
    protected static $_db = null;
    protected static $_tbname = '';
    protected static $_primary_key = 'id';
    public static $fetchColumns = array();
    public static $fetchJoins = array();
    /**
     * Static constructor
     */
    public static function __init($db = 'db')
    {
        static::$_tbname = cot::$db->subscribe_queue;
        parent::__init($db);
    }
    protected function beforeInsert()
    {
        if (empty($this->_data['created'])) {
            $this->_data['created'] = date('Y-m-d H:i:s', cot::$sys['now']);
        }
        return parent::beforeInsert();
    }
    public static function fieldList()
    {
        $fields = array('id' => array('type' => 'int', 'description' => 'id', 'primary' => true), 'subscribe' => array('type' => 'link', 'default' => 0, 'description' => cot::$L['subscribe_subscribe'], 'link' => array('model' => 'subscribe_model_Subscribe', 'relation' => SOM::TO_ONE, 'label' => 'title')), 'subscriber' => array('type' => 'link', 'default' => 0, 'description' => cot::$L['subscribe_subscribe'], 'link' => array('model' => 'subscribe_model_Subscriber', 'relation' => SOM::TO_ONE, 'label' => 'email')), 'to_email' => array('type' => 'varchar', 'length' => '255', 'default' => '', 'nullable' => false, 'description' => cot::$L['Email']), 'to_name' => array('type' => 'varchar', 'length' => '255', 'default' => '', 'description' => cot::$L['Name']), 'from_email' => array('type' => 'varchar', 'length' => '255', 'default' => '', 'nullable' => false, 'description' => cot::$L['subscribe_from_mail']), 'from_name' => array('type' => 'varchar', 'length' => '255', 'default' => '', 'description' => cot::$L['subscribe_from_title']), 'subject' => array('type' => 'varchar', 'length' => '255', 'default' => '', 'description' => cot::$L['subscribe_subject']), 'body' => array('type' => 'text', 'default' => '', 'description' => cot::$L['Text']), 'created' => array('type' => 'datetime', 'default' => date('Y-m-d H:i:s', cot::$sys['now']), 'description' => cot::$L['subscribe_created']));
        return $fields;
    }
}
subscribe_model_Queue::__init();