Ignore:
Timestamp:
2014/05/29 14:40:57 (12 years ago)
Author:
pineray
Message:

#2515 無駄な処理を改善する for 2.13.3

カテゴリーID取得部分の処理を整理.

Location:
branches/version-2_13-dev/data/class/helper
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • branches/version-2_13-dev/data/class/helper/SC_Helper_Category.php

    r23439 r23459  
    397397        return $objQuery->update($table, array(), $where, array(), $arrRawVal); 
    398398    } 
     399 
     400    /** 
     401     * 有効なカテゴリーIDかチェックする. 
     402     * 
     403     * @param int $category_id 
     404     * @param bool $include_deleted 
     405     * @return bool 
     406     */ 
     407    public function isValidCategoryId($category_id, $include_deleted = false) { 
     408        if ($include_deleted) { 
     409            $where = ''; 
     410        } else { 
     411            $where = 'del_flg = 0'; 
     412        } 
     413        if ( 
     414            SC_Utils_Ex::sfIsInt($category_id) 
     415            && !SC_Utils_Ex::sfIsZeroFilling($category_id) 
     416            && SC_Helper_DB_Ex::sfIsRecord('dtb_category','category_id', array($category_id), $where) 
     417        ) { 
     418            return true; 
     419        } 
     420        return false; 
     421    } 
    399422} 
  • branches/version-2_13-dev/data/class/helper/SC_Helper_DB.php

    r23458 r23459  
    524524        $category_id = (int) $category_id; 
    525525        $product_id = (int) $product_id; 
    526         if (SC_Utils_Ex::sfIsInt($category_id) && $category_id != 0 && SC_Helper_DB_Ex::sfIsRecord('dtb_category','category_id', array($category_id))) { 
     526        $objCategory = new SC_Helper_Category_Ex(); 
     527        if ($objCategory->isValidCategoryId($category_id, $closed)) { 
    527528            $category_id = array($category_id); 
    528529        } else { 
Note: See TracChangeset for help on using the changeset viewer.