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


PHP stdClass::save方法代码示例

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


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

示例1: trainOnFile

 /**
  * Train On File.
  * 
  * @return bool
  */
 public function trainOnFile()
 {
     $maxEpochs = 500000;
     $epochsBetweenReports = 1000;
     $desiredError = 0.001;
     $result = $this->neuralNetwork->trainOnFile($maxEpochs, $epochsBetweenReports, $desiredError);
     if ($result === false) {
         throw new RuntimeException(sprintf("Failed to train neural network on file: %s", $this->neuralNetwork->getConfigurationFile()), 1);
     }
     $result = $this->neuralNetwork->save();
     if ($result === false) {
         throw new RuntimeException(sprintf("Failed to save neural network to file: %s", $this->neuralNetwork->getConfigurationFile()), 1);
     }
     return $result;
 }
开发者ID:ericmdev,项目名称:NoughtsAndCrosses,代码行数:20,代码来源:Player.php

示例2: moveFile

 /**
  * Move file from the temporary destination to the original destination
  *
  * @param \stdClass $file
  * @throws File\Exception
  */
 public static final function moveFile($file)
 {
     try {
         if ($file->is_temp) {
             rename($file->temp_destination . '/' . $file->temp_name, $file->original_destination . '/' . $file->temp_name);
             if (!file_exists($file->original_destination . '/' . $file->temp_name)) {
                 throw new CannotSaveFileInHardDriveException();
             }
             $file->is_temp = false;
             $file->expire = null;
             $file->save();
         }
     } catch (\Exception $exception) {
         throw new FileException($exception->getMessage());
     }
 }
开发者ID:vegas-cmf,项目名称:media,代码行数:22,代码来源:Helper.php

示例3: submitForm

 /**
  * {@inheritdoc}
  */
 public function submitForm(array &$form, FormStateInterface $form_state)
 {
     $shipment = new \stdClass();
     $shipment->order_id = $form_state->getValue('order_id');
     if ($form_state->hasValue('sid')) {
         $shipment->sid = $form_state->getValue('sid');
     }
     $shipment->origin = (object) $form_state->getValue('pickup_address');
     $shipment->destination = new \stdClass();
     foreach ($form_state->getValues() as $key => $value) {
         if (substr($key, 0, 9) == 'delivery_') {
             $field = substr($key, 9);
             $shipment->destination->{$field} = $value;
         }
     }
     $shipment->packages = array();
     foreach ($form_state->getValue('packages') as $id => $pkg_form) {
         $package = Package::load($id);
         $package->pkg_type = $pkg_form['pkg_type'];
         $package->value = $pkg_form['declared_value'];
         $package->length = $pkg_form['dimensions']['length'];
         $package->width = $pkg_form['dimensions']['width'];
         $package->height = $pkg_form['dimensions']['height'];
         $package->length_units = $pkg_form['dimensions']['units'];
         $package->tracking_number = $pkg_form['tracking_number'];
         $package->qty = 1;
         $shipment->packages[$id] = $package;
     }
     $shipment->shipping_method = $form_state->getValue('shipping_method');
     $shipment->accessorials = $form_state->getValue('accessorials');
     $shipment->carrier = $form_state->getValue('carrier');
     $shipment->transaction_id = $form_state->getValue('transaction_id');
     $shipment->tracking_number = $form_state->getValue('tracking_number');
     $shipment->ship_date = $form_state->getValue('ship_date')->getTimestamp();
     $shipment->expected_delivery = $form_state->getValue('expected_delivery')->getTimestamp();
     $shipment->cost = $form_state->getValue('cost');
     $shipment->save();
     $form_state->setRedirect('uc_fulfillment.shipments', ['uc_order' => $form_state->getValue('order_id')]);
 }
开发者ID:justincletus,项目名称:webdrupalpro,代码行数:42,代码来源:ShipmentEditForm.php


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