當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。