Пример #1
0
 /**
  * Override of getById in RedBeanModel in order to cache the result.  Currency rarely  changes, so caching
  * the currency on this method provides a performance boost.
  * @param integer $id
  * @param string $modelClassName
  */
 public static function getById($id, $modelClassName = null)
 {
     assert('$modelClassName == "Currency" || $modelClassName == null');
     if (isset(self::$cachedCurrencyById[$id])) {
         return self::$cachedCurrencyById[$id];
     }
     $currency = parent::getById($id, $modelClassName);
     self::$cachedCurrencyById[$id] = $currency;
     return $currency;
 }