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


PHP Model::load方法代码示例

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


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

示例1: performAjaxValidation

 /**
  * Performs model ajax validation
  *
  * @param Model $model
  * @return array|null
  */
 protected function performAjaxValidation(Model $model)
 {
     if (Yii::$app->request->isAjax && $model->load(Yii::$app->request->post()) && Yii::$app->request->post('ajax') == $model->formName()) {
         // AJAX validation
         Yii::$app->response->format = Response::FORMAT_JSON;
         return ActiveForm::validate($model);
     }
     return null;
 }
开发者ID:kalyabin,项目名称:comitka,代码行数:15,代码来源:ProfileController.php

示例2: performValidationModel

 /**
  * Performs ajax validation.
  *
  * @param \yii\base\Model $model
  *
  * @throws \yii\base\ExitException
  */
 protected function performValidationModel(Model $model)
 {
     if ($model->load(Yii::$app->request->post())) {
         return ActiveForm::validate($model);
     }
     return;
 }
开发者ID:ostashevdv,项目名称:brick,代码行数:14,代码来源:AjaxValidation.php

示例3: performAjaxValidation

 /**
  * Performs ajax validation.
  * @param Model $model
  * @throws \yii\base\ExitException
  */
 protected function performAjaxValidation(Model $model)
 {
     if (\Yii::$app->request->isAjax && $model->load(\Yii::$app->request->post())) {
         \Yii::$app->response->format = Response::FORMAT_JSON;
         echo json_encode(ActiveForm::validate($model));
         \Yii::$app->end();
     }
 }
开发者ID:softal,项目名称:yii-user,代码行数:13,代码来源:RecoveryController.php

示例4: performAjaxValidation

 /**
  * Performs ajax validation.
  * @param Model $model
  */
 protected function performAjaxValidation(Model $model)
 {
     if (Yii::$app->request->isAjax && $model->load(Yii::$app->request->post())) {
         Yii::$app->response->format = Response::FORMAT_JSON;
         return ActiveForm::validate($model);
     }
 }
开发者ID:just-leo,项目名称:cardgame-serial,代码行数:11,代码来源:AjaxValidationTrait.php

示例5: load

 /**
  * Populates the model with input data.
  * @param Model $model model instance.
  * @param array $data the data array to load, typically `$_POST` or `$_GET`.
  * @return boolean whether expected forms are found in `$data`.
  */
 protected function load($model, $data)
 {
     /* @var $this Action */
     $event = new ActionEvent($this, ['model' => $model, 'result' => $model->load($data)]);
     $this->trigger('afterDataLoad', $event);
     return $event->result;
 }
开发者ID:yii2tech,项目名称:admin,代码行数:13,代码来源:ModelFormTrait.php

示例6: load

 public function load($data, $formName = null)
 {
     $isLoad = true;
     foreach ($this->models as $key => $model) {
         $isLoad = $model->load($data, $formName) && $isLoad;
     }
     return parent::load($data, $formName) && $isLoad;
 }
开发者ID:yinheark,项目名称:yincart2,代码行数:8,代码来源:FormModel.php

示例7: load

 /**
  * @inheritdoc
  */
 public function load($data, $formName = null)
 {
     $files = \yii\web\UploadedFile::getInstancesByName('logo');
     if (count($files) != 0) {
         $file = $files[0];
         $this->logo = $file;
     }
     return parent::load($data, $formName);
 }
开发者ID:kreativmind,项目名称:humhub,代码行数:12,代码来源:DesignSettingsForm.php

示例8: load

 public function load($data, $formName = null)
 {
     if (parent::load($data, $formName)) {
         $this->file = UploadedFile::getInstance($this, 'file');
         return true;
     } else {
         return false;
     }
 }
开发者ID:omnilight,项目名称:yz2-admin-import,代码行数:9,代码来源:ImportForm.php

示例9: load

 public function load($post)
 {
     if ($post["AdminUserFunctionsForm"]["id_user"]) {
         foreach ($post["AdminUserFunctionsForm"]["id_user"] as $id_user) {
             $this->id_user[] = $id_user;
         }
     }
     return parent::load($post);
 }
开发者ID:a7000q,项目名称:yasvoboden,代码行数:9,代码来源:AdminUserFunctionsForm.php

示例10: load

 /**
  * @inheritdoc
  */
 public function load($data, $formName = null)
 {
     if (!parent::load($data, $formName)) {
         return false;
     }
     $this->name = preg_replace('/\\s+/', '_', $this->name);
     $this->name = preg_replace('/[^0-9a-zA-Z$_]+/', '', $this->name);
     return true;
 }
开发者ID:blumster,项目名称:yii2-gii-migration-designer,代码行数:12,代码来源:Table.php

示例11: load

 public function load($data = null, $formName = '')
 {
     parent::load($data, $formName);
     foreach ($this->_defaults as $k => $v) {
         if (is_null($this->{$k})) {
             $this->{$k} = $v;
         }
     }
     return true;
 }
开发者ID:hiqdev,项目名称:yii2-thememanager,代码行数:10,代码来源:Settings.php

示例12: performAjaxValidation

 protected function performAjaxValidation(Model $model)
 {
     $isAjaxRequest = \Yii::$app->request->isAjax();
     $postData = \Yii::$app->request->post();
     if ($isAjaxRequest && $model->load($postData)) {
         Yii::$app->response->format = Response::FORMAT_JSON;
         echo json_encode(ActiveForm::validate($model));
         Yii::$app->end();
     }
 }
开发者ID:epoxxid,项目名称:user,代码行数:10,代码来源:AjaxValidationTrait.php

示例13: load

 /**
  * @inheritdoc
  */
 public function load($data, $formName = '')
 {
     if (strlen($data['fqdn']) && strpos($data['fqdn'], '.') === false) {
         if (strlen($data['zone'])) {
             $data['fqdn'] .= '.' . $data['zone'];
             unset($data['zone']);
         } else {
             $data['fqdn'] .= '.' . static::DEFAULT_ZONE;
         }
     }
     return parent::load($data, $formName);
 }
开发者ID:hiqdev,项目名称:hipanel-module-domain,代码行数:15,代码来源:CheckForm.php

示例14: setAjaxData

 /**
  * Validate Form action
  * @param Model $model
  * @param string $action
  * @return array
  */
 public function setAjaxData(Model $model, $action = 'save', $json = false)
 {
     $response = ['status' => 0, 'errors' => '', 'text' => ''];
     if (\Yii::$app->request->isAjax && $model->load(\Yii::$app->request->post())) {
         if ($model->{$action}()) {
             $response['status'] = 1;
         } else {
             $response['errors'] = Html::errorSummary($model);
         }
     }
     return $json ? json_encode($response) : [$model, $response];
 }
开发者ID:h11Nox,项目名称:slug,代码行数:18,代码来源:ActionWidget.php

示例15: load

 /**
  * Populates the main model and variation models with input data.
  * @param Model $model main model instance.
  * @param array $data the data array to load, typically `$_POST` or `$_GET`.
  * @return boolean whether expected forms are found in `$data`.
  */
 protected function load($model, $data)
 {
     if (!$model->load($data)) {
         return false;
     }
     foreach ($this->getVariationModelBatches($model) as $variationName => $variationModels) {
         if (!Model::loadMultiple($variationModels, $data)) {
             return false;
         }
     }
     return true;
 }
开发者ID:Ryadnov,项目名称:admin,代码行数:18,代码来源:VariationTrait.php


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