当前位置: 首页>>代码示例>>PHP>>正文


PHP ActiveRecordModel::transformArray方法代码示例

本文整理汇总了PHP中ActiveRecordModel::transformArray方法的典型用法代码示例。如果您正苦于以下问题:PHP ActiveRecordModel::transformArray方法的具体用法?PHP ActiveRecordModel::transformArray怎么用?PHP ActiveRecordModel::transformArray使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在ActiveRecordModel的用法示例。


在下文中一共展示了ActiveRecordModel::transformArray方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: transformArray

 /**
  * Creates array representation
  *
  * @return array
  */
 protected static function transformArray($array, ARSchema $schema)
 {
     if (!empty($array['serializedData'])) {
         $array['serializedData'] = unserialize($array['serializedData']);
     }
     return parent::transformArray($array, $schema);
 }
开发者ID:saiber,项目名称:livecart,代码行数:12,代码来源:DiscountAction.php

示例2: transformArray

 public static function transformArray($array, ARSchema $schema)
 {
     $array = parent::transformArray($array, $schema);
     $array['countryName'] = self::getApplication()->getLocale()->info()->getCountryName($array['countryID']);
     $array['fullName'] = $array['firstName'] . ' ' . $array['lastName'];
     if (!empty($array['State']) && is_array($array['State'])) {
         $array['stateName'] = $array['State']['name'];
     }
     $array['compact'] = self::getAddressString($array, ', ');
     $array['compactAddressOnly'] = self::getAddressString(array_diff_key($array, array_flip(array('fullName', 'firstName', 'lastName'))), ', ');
     if (!isset($array['stateID']) && isset($array['State']) && is_array($array['State']) && array_key_exists('ID', $array['State'])) {
         $array['stateID'] = $array['State']['ID'];
     }
     return $array;
 }
开发者ID:saiber,项目名称:livecart,代码行数:15,代码来源:UserAddress.php

示例3: transformArray

 public static function transformArray($array, ARSchema $schema)
 {
     $array = parent::transformArray($array, $schema);
     $array['fullName'] = $array['firstName'] . ' ' . $array['lastName'];
     return $array;
 }
开发者ID:saiber,项目名称:www,代码行数:6,代码来源:User.php

示例4: transformArray

 public static function transformArray($array, ARSchema $schema)
 {
     $array = parent::transformArray($array, $schema);
     $array['name'] = self::getApplication()->getLocale()->info()->getCurrencyName($array['ID']);
     $array['format'] = $array['pricePrefix'] . '%d.' . $array['decimalCount'] . 'f' . $array['priceSuffix'];
     $array['rounding'] = unserialize($array['rounding']);
     return $array;
 }
开发者ID:saiber,项目名称:livecart,代码行数:8,代码来源:Currency.php

示例5: transformArray

 public static function transformArray($array, ARSchema $schema)
 {
     $array = parent::transformArray($array, $schema);
     try {
         $array['formattedAmount'] = Currency::getInstanceByID($array['Currency']['ID'])->getFormattedPrice($array['amount']);
         $array['formattedRealAmount'] = Currency::getInstanceByID($array['RealCurrency']['ID'])->getFormattedPrice($array['realAmount']);
     } catch (ARNotFoundException $e) {
     }
     $array['methodName'] = self::getApplication()->getLocale()->translator()->translate($array['method']);
     $array['serializedData'] = unserialize($array['serializedData']);
     $array['ccLastDigits'] = self::decrypt($array['ccLastDigits']);
     if (strlen($array['ccCVV']) > 0) {
         $array['ccCVV'] = self::decrypt($array['ccCVV']);
     }
     return $array;
 }
开发者ID:saiber,项目名称:www,代码行数:16,代码来源:Transaction.php

示例6: transformArray

 public static function transformArray($array, ARSchema $schema)
 {
     $array = parent::transformArray($array, $schema);
     $currency = Currency::getInstanceByID($array['currencyID']);
     $array['serializedRules'] = unserialize($array['serializedRules']);
     if ($array['serializedRules'] && !is_array($array['serializedRules'])) {
         $array['serializedRules'] = array();
     }
     if ($array['serializedRules'] && is_array($array['serializedRules'])) {
         $ruleController = self::getApplication()->getBusinessRuleController();
         $quantities = array_keys($array['serializedRules']);
         $nextQuant = array();
         foreach ($quantities as $key => $quant) {
             $nextQuant[$quant] = isset($quantities[$key + 1]) ? $quantities[$key + 1] - 1 : null;
         }
         foreach ($array['serializedRules'] as $quantity => $prices) {
             foreach ($prices as $group => $price) {
                 $originalPrice = $currency->roundPrice($price);
                 $product = isset($array['Product']) ? $array['Product'] : Product::getInstanceByID($array['productID']);
                 $price = $ruleController->getProductPrice($product, $originalPrice);
                 $array['quantityPrices'][$group][$quantity] = array('originalPrice' => $originalPrice, 'price' => $price, 'originalFormattedPrice' => $currency->getFormattedPrice($originalPrice), 'formattedPrice' => $currency->getFormattedPrice($price), 'from' => $quantity, 'to' => $nextQuant[$quantity]);
             }
         }
     }
     return $array;
 }
开发者ID:saiber,项目名称:www,代码行数:26,代码来源:ProductPrice.php

示例7: transformArray

 public static function transformArray($array, ARSchema $schema)
 {
     $array = parent::transformArray($array, $schema);
     $array['formattedPrice'] = '';
     if (!empty($array['OrderedItem']['customerOrderID'])) {
         $order = CustomerOrder::getInstanceByID($array['OrderedItem']['customerOrderID']);
         $currency = $order->getCurrency();
         $array['formattedPrice'] = $currency->getFormattedPrice($array['priceDiff']);
     }
     // get uploaded file name
     if (!empty($array['optionText']) && strpos($array['optionText'], '___')) {
         $array['fileName'] = self::getFileName($array['optionText']);
         $array = array_merge($array, self::getImagePaths($array['optionText']));
     }
     return $array;
 }
开发者ID:GregerA,项目名称:livecart,代码行数:16,代码来源:OrderedItemOption.php

示例8: transformArray

 /**
  * Tranforms object data to data array in the following format:
  *
  * simpleField => value,
  * multilingualField_langCode => value,
  * multilingualField2_langCode => otherValue, and etc.
  *
  * @param array $array
  * @todo cleanup
  * @return array
  */
 public static function transformArray($array, ARSchema $schema)
 {
     $array = parent::transformArray($array, $schema);
     foreach ($schema->getArrayFieldList() as $fieldName) {
         if (!empty($array[$fieldName])) {
             $data = $array[$fieldName];
             $array[$fieldName . 'Data'] = $data;
             if (!is_array($data)) {
                 continue;
             }
             if (!self::$defaultLanguageCode) {
                 self::loadLanguageCodes();
             }
             foreach ($data as $lang => $value) {
                 $array[$fieldName . '_' . $lang] = $value;
             }
             $array[$fieldName] = !empty($data[self::$defaultLanguageCode]) ? $data[self::$defaultLanguageCode] : '';
             reset($data);
             $array[$fieldName . '_lang'] = !empty($data[self::$currentLanguageCode]) ? $data[self::$currentLanguageCode] : (!empty($array[$fieldName]) ? $array[$fieldName] : $data[key($data)]);
             /* use data from any language if the default language is empty */
         }
     }
     return $array;
 }
开发者ID:saiber,项目名称:www,代码行数:35,代码来源:MultilingualObject.php


注:本文中的ActiveRecordModel::transformArray方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。