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


PHP self::fromArray方法代码示例

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


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

示例1: createFromOptions

 /**
  * Create IngestManifestAsset from array.
  *
  * @param array $options Array containing values for object properties
  *
  * @return WindowsAzure\MediaServices\Models\IngestManifestAsset
  */
 public static function createFromOptions($options)
 {
     Validate::notNull($options['ParentIngestManifestId'], 'options[ParentIngestManifestId]');
     $asset = new self($options['ParentIngestManifestId']);
     $asset->fromArray($options);
     return $asset;
 }
开发者ID:southworkscom,项目名称:azure-sdk-for-php,代码行数:14,代码来源:IngestManifestAsset.php

示例2: import

 public static function import($new_songs, $force = false)
 {
     $db_stats = array('skipped' => 0, 'updated' => 0, 'inserted' => 0, 'deleted' => 0);
     if (empty($new_songs)) {
         return false;
     }
     Debug::startTimer('Import data into database');
     $em = self::getEntityManager();
     $existing_hashes = self::getHashes();
     $existing_ids = self::getIds();
     $unused_hashes = $existing_hashes;
     $song_ids = Song::getIds();
     $i = 0;
     foreach ($new_songs as $song_hash => $processed) {
         if (!in_array($song_hash, $song_ids)) {
             Song::getOrCreate($processed);
         }
         if (isset($existing_hashes[$song_hash])) {
             if ($force && $existing_hashes[$song_hash] == $processed['id']) {
                 $db_stats['updated']++;
                 $record = self::find($processed['id']);
             } else {
                 $db_stats['skipped']++;
                 $record = null;
             }
         } else {
             if (isset($existing_ids[$processed['id']])) {
                 $db_stats['updated']++;
                 $record = self::find($processed['id']);
             } else {
                 $db_stats['inserted']++;
                 $record = new self();
             }
         }
         if ($record instanceof self) {
             $existing_ids[$processed['id']] = $processed['hash'];
             $existing_hashes[$processed['hash']] = $processed['id'];
             $record->fromArray($processed);
             $em->persist($record);
         }
         unset($unused_hashes[$song_hash]);
         $i++;
         if ($i % 200 == 0) {
             $em->flush();
             $em->clear();
         }
     }
     $em->flush();
     $em->clear();
     // Clear out any songs not found.
     $hashes_remaining = array_keys($unused_hashes);
     $db_stats['deleted'] = count($hashes_remaining);
     $em->createQuery('DELETE FROM ' . __CLASS__ . ' e WHERE e.hash IN (:hashes)')->setParameter('hashes', $hashes_remaining)->execute();
     Debug::endTimer('Import data into database');
     Debug::print_r($db_stats);
     return $db_stats;
 }
开发者ID:Lavoaster,项目名称:PVLive,代码行数:57,代码来源:ExternalSongs.php

示例3: initfromArray

 /**
  *
  * 使用数组初始化对象
  * @param array $array
  * @param 是否检测签名 $noCheckSign
  * @param string $mchKey 商户Api密钥
  */
 public static function initfromArray($array, $noCheckSign = false, $mchKey = '')
 {
     $obj = new self();
     if ($mchKey) {
         $obj->setMchKey($mchKey);
     }
     $obj->fromArray($array);
     if ($noCheckSign == false) {
         $obj->checkSign();
     }
     return $obj;
 }
开发者ID:ruzemd,项目名称:phppayment,代码行数:19,代码来源:WxPayResults.php

示例4: fromFile

 public static function fromFile($filePath, $env)
 {
     if (is_file($filePath)) {
         $configuration = parse_ini_file($filePath, true);
         if (isset($configuration[$env])) {
             $config = new self();
             $config->fromArray($configuration[$env]);
             return $config;
         }
         throw new Exception("File Env:[{$env}] Not Found");
     }
     throw new Exception("File Not Found");
 }
开发者ID:ecomz,项目名称:payment,代码行数:13,代码来源:Container.php

示例5: post

 /**
  * Static Functions
  */
 public static function post($nowplaying)
 {
     $em = self::getEntityManager();
     $active_shortcodes = Station::getShortNameLookup();
     $total_overall = 0;
     foreach ($nowplaying as $short_code => $info) {
         $listeners = (int) $info['listeners']['current'];
         $station_id = $info['station']['id'];
         if (isset($active_shortcodes[$short_code])) {
             $total_overall += $listeners;
         }
         $record = new self();
         $record->fromArray(array('station_id' => $station_id, 'type' => 'second', 'timestamp' => time(), 'number_min' => $listeners, 'number_max' => $listeners, 'number_avg' => $listeners));
         $em->persist($record);
     }
     // Create "overall" statistic.
     $record = new self();
     $record->fromArray(array('type' => 'second', 'timestamp' => time(), 'number_min' => $total_overall, 'number_max' => $total_overall, 'number_avg' => $total_overall));
     $em->persist($record);
     $em->flush();
 }
开发者ID:Lavoaster,项目名称:PVLive,代码行数:24,代码来源:Analytics.php

示例6: createFromOptions

 /**
  * Create asset from array.
  *
  * @param array $options Array containing values for object properties
  *
  * @return WindowsAzure\MediaServices\Models\Job
  */
 public static function createFromOptions($options)
 {
     $job = new self();
     $job->fromArray($options);
     return $job;
 }
开发者ID:southworkscom,项目名称:azure-sdk-for-php,代码行数:13,代码来源:Job.php

示例7: createFromOptions

 /**
  * Create Program from array.
  *
  * @param array $options Array containing values for object properties
  *
  * @return Program
  */
 public static function createFromOptions($options)
 {
     $program = new self();
     $program->fromArray($options);
     return $program;
 }
开发者ID:southworkscom,项目名称:azure-sdk-for-php,代码行数:13,代码来源:Program.php

示例8: fetchAll

 public static function fetchAll($lentry_id = 0, $active = 1)
 {
     global $db;
     $entry_objectives = false;
     $query = "SELECT * FROM `logbook_entry_objectives` WHERE `lentry_id` = ? AND `objective_active` = ?";
     $results = $db->GetAll($query, array($lentry_id, $active));
     if ($results) {
         foreach ($results as $result) {
             if ($result["objective_id"]) {
                 $result["objective"] = Models_Objective::fetchRow($result["objective_id"]);
             }
             $entry_objective = new self();
             $entry_objectives[$result["objective_id"]] = $entry_objective->fromArray($result);
         }
     }
     return $entry_objectives;
 }
开发者ID:nadeemshafique,项目名称:entrada-1x,代码行数:17,代码来源:Objective.php

示例9: fetchRow

 public static function fetchRow($objective_id = 0, $active = 1)
 {
     global $db;
     $return = false;
     if ($objective_id != 0) {
         $query = "SELECT * FROM `global_lu_objectives` WHERE `objective_id` = ? AND `objective_active` = ?";
         $result = $db->GetRow($query, array($objective_id, $active));
         if ($result) {
             $objective = new self();
             $return = $objective->fromArray($result);
         }
     }
     return $return;
 }
开发者ID:nadeemshafique,项目名称:entrada-1x,代码行数:14,代码来源:Objective.php

示例10: createFromOptions

 /**
  * Create EncodingReservedUnitType from array.
  *
  * @param array $options Array containing values for object properties
  *
  * @return EncodingReservedUnit
  */
 public static function createFromOptions($options)
 {
     $encodingReservedUnitType = new self();
     $encodingReservedUnitType->fromArray($options);
     return $encodingReservedUnitType;
 }
开发者ID:southworkscom,项目名称:azure-sdk-for-php,代码行数:13,代码来源:EncodingReservedUnit.php

示例11: createFromOptions

 /**
  * Create media processor from array.
  *
  * @param array $options Array containing values for object properties
  *
  * @return WindowsAzure\MediaServices\Models\MediaProcessor
  */
 public static function createFromOptions($options)
 {
     $mediaProcessor = new self();
     $mediaProcessor->fromArray($options);
     return $mediaProcessor;
 }
开发者ID:southworkscom,项目名称:azure-sdk-for-php,代码行数:13,代码来源:MediaProcessor.php

示例12: createFromOptions

 /**
  * Create task template from array.
  *
  * @param array $options Array containing values for object properties
  *
  * @return WindowsAzure\MediaServices\Models\TaskTemplate
  */
 public static function createFromOptions($options)
 {
     Validate::notNull($options['NumberofInputAssets'], 'options[NumberofInputAssets]');
     Validate::notNull($options['NumberofOutputAssets'], 'options[NumberofOutputAssets]');
     $taskTemplate = new self($options['NumberofInputAssets'], $options['NumberofOutputAssets']);
     $taskTemplate->fromArray($options);
     return $taskTemplate;
 }
开发者ID:southworkscom,项目名称:azure-sdk-for-php,代码行数:15,代码来源:TaskTemplate.php

示例13: createFromOptions

 /**
  * Create asset file from array.
  *
  * @param array $options Array containing values for object properties
  *
  * @return WindowsAzure\MediaServices\Models\AssetFile
  */
 public static function createFromOptions($options)
 {
     Validate::notNull($options['Name'], 'options[Name]');
     Validate::notNull($options['ParentAssetId'], 'options[ParentAssetId]');
     $assetFile = new self($options['Name'], $options['ParentAssetId']);
     $assetFile->fromArray($options);
     return $assetFile;
 }
开发者ID:southworkscom,项目名称:azure-sdk-for-php,代码行数:15,代码来源:AssetFile.php

示例14: create

 /**
  * @param $packageName
  * @return Package
  */
 public static function create($packageName)
 {
     $package = new self();
     $package->fromArray(array('name' => $packageName, 'visited' => false, 'blacklisted' => false));
     return $package;
 }
开发者ID:pugx,项目名称:botrelli,代码行数:10,代码来源:Package.php

示例15: initFromArray

 /**
  *
  * 使用数组初始化对象
  * @param array $array
  * @param 是否检测签名 $noCheckSign
  */
 public static function initFromArray($array, $noCheckSign = false)
 {
     $obj = new self();
     $obj->fromArray($array);
     if ($noCheckSign == false) {
         $obj->checkSign();
     }
     return $obj;
 }
开发者ID:formatcc,项目名称:laravel-wechat,代码行数:15,代码来源:Wechat.php


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