<?php
/**
 * Created by JetBrains PhpStorm.
 * User: user
 * Date: 15-6-5
 * Time: 上午11:43
 * To change this template use File | Settings | File Templates.
 */
class Service_Account
{
    private static $_model = NULL;

    private static function getModelInstance() {
        if (is_null(self::$_model)) {
            self::$_model = new Table_Account();
        }

        return self::$_model;
    }

    /**
     * @see Table_Account::insert()
     */
    public static function insert($data) {
        $model = self::getModelInstance();

        return $model->insert($data);
    }

    public static function getByField($value, $field = 'account_id', $colums = "*"){
        $model = self::getModelInstance();
        return $model->getByField($value,$field,$colums);
    }

    /**
     * @see Table_Account::update()
     */
    public static function update($data, $value, $key = 'account_id') {
        $model = self::getModelInstance();

        return $model->update($data, $value, $key);
    }

    /**
     * @see Table_Account::delete()
     */
    public static function delete($value, $key = 'account_id') {
        $model = self::getModelInstance();

        return $model->delete($value, $key);
    }

    /**
     * @see Table_Account::getByCondition()
     */
    public static function getByCondition($condition, $count = FALSE) {
        $model = self::getModelInstance();

        return $model->getByCondition($condition, $count);
    }

    /**
     * @see Table_Account::isUniqueName()
     */
    public static function isUniqueName($name, $customer) {
        $model = self::getModelInstance();

        return $model->isUniqueName($name, $customer);
    }

    /**
     * @see Table_Account::isUniqueEmail()
     */
    public static function isUniqueEmail($email) {
        $model = self::getModelInstance();

        return $model->isUniqueEmail($email);
    }
}
