當前位置: 首頁>>代碼示例>>PHP>>正文


PHP type::update方法代碼示例

本文整理匯總了PHP中type::update方法的典型用法代碼示例。如果您正苦於以下問題:PHP type::update方法的具體用法?PHP type::update怎麽用?PHP type::update使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在type的用法示例。


在下文中一共展示了type::update方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: update

 /**
  * 
  * @param array $data
  * @param type $id
  * @return type
  */
 public function update(array $data, $id)
 {
     try {
         $this->validator->with($data)->passesOrFail();
         return $this->repository->update($data, $id);
     } catch (ValidatorException $e) {
         return ['error' => 'true', 'messege' => $e->getMessageBag()];
     } catch (\Exception $e) {
         return ['error' => 'true', 'messege' => "Usuário não encontrado!"];
     }
 }
開發者ID:mariosas,項目名稱:plusf,代碼行數:17,代碼來源:UserServices.php

示例2: saveArtist

 /**
  *
  * @param \Music\Model\Artist $artist
  * @throws \Exception
  */
 public function saveArtist(Artist $artist)
 {
     $data = array('full_name' => $artist->getFullName(), 'year_found' => $artist->getYearFound(), 'origin' => $artist->getOrigin(), 'createdby' => $this->id);
     $artist_id = (int) $artist->getArtistId();
     if ($artist_id == 0) {
         $this->tableGateway->insert($data);
     } else {
         if ($this->getArtist($artist_id)) {
             //\Zend\Debug\Debug::dump($artist_id);
             $this->tableGateway->update($data, array('artist_id' => $artist_id));
         } else {
             throw new \Exception('Form id does not exist');
         }
     }
 }
開發者ID:hejames,項目名稱:jTrMuzik,代碼行數:20,代碼來源:ArtistTable.php

示例3: update

 /**
  * 
  * @param Request $request
  * @param type $id
  */
 public function update(Request $request, $id)
 {
     $produto = $this->service->show($id);
     if ($produto['error']) {
         return redirect($this->url)->with("danger", $produto['messege']);
     }
     $this->service->update($request->all(), $id);
     return redirect($this->url)->with("success", "Produto atualizado!");
 }
開發者ID:mariosas,項目名稱:plusf,代碼行數:14,代碼來源:ProdutosController.php

示例4: updateContact

 /**
  * Updates a contact
  * @param array $data
  * @param int $id
  * @return boolean
  */
 public function updateContact($data, $id)
 {
     try {
         $this->tableGateway->update($data, array('contact_id' => $id));
         return true;
     } catch (Exception $e) {
         return false;
     }
 }
開發者ID:hejames,項目名稱:jTrContact,代碼行數:15,代碼來源:ContactTable.php

示例5: update

 /**
  * 修改數據
  * @param array $entity                 鍵值組成的數組
  * @param array $whereData              一維數組或k、v、s結構組成的數組。一維數組元素之間為and關係,鍵和值為等於關係;k、v、s結構數組,k:屬性名,v:屬性值,s:屬性名和屬性值之間的操作符
  * @param string $table                 修改數據的表,若為空,修改默認表數據
  * @param array $filter                 認為是表達式的鍵,$entity的鍵在該參數中時,認為$entity相應鍵對應的值是表達式
  * @param boolean $isReturnAffectedRows 是否返回刪除記錄的條數,默認是不返回
  * @return boolean
  */
 public function update(array $entity, $whereData = array(), $table = '', $isReturnAffectedRows = 0, array $filter = array())
 {
     if (is_null($this->db)) {
         $this->db = \Util\Db\Manager::getInstance($this->dbName);
     }
     //如果方法中沒傳遞表名,則向默認表中插入數據
     $table = is_string($table) && $table != '' ? $table : $this->defaultTable;
     $state = $this->db->update($entity, $table, $whereData, $filter);
     if ($isReturnAffectedRows && $state) {
         return $this->db->getAffectedRows();
     }
     return $state;
 }
開發者ID:echoOly,項目名稱:php_base,代碼行數:22,代碼來源:BaseModel.php

示例6: reset

 private function reset(Section $section = null)
 {
     if (null != $section) {
         // Get default values for section
         $names = array();
         foreach ($section->fields as $field) {
             if ($field instanceof ValueFieldInterface) {
                 $names[] = $field->get_name();
             }
         }
         $this->options->update($this->updater->reset($names));
     } else {
         // No values are passed to the OptionsUpdater so that the default values
         // Will be returned.
         $this->options->update($this->updater->reset());
     }
 }
開發者ID:Air-Craft,項目名稱:air-craft-www,代碼行數:17,代碼來源:OptionsPage.php

示例7: save

 /**
  * Save
  * 
  * @return integer 
  */
 public function save()
 {
     if (is_array($this->primaryKey)) {
         // @todo compound primary keys
     }
     if (isset($this->originalData[$this->primaryKey])) {
         // UPDATE
         $where = array($this->primaryKey => $this->originalData[$this->primaryKey]);
         $data = $this->currentData;
         unset($data[$this->primaryKey]);
         $rowsAffected = $this->tableGateway->update($data, $where);
     } else {
         // INSERT
         $rowsAffected = $this->tableGateway->insert($this->currentData);
         $primaryKey = $this->tableGateway->getLastInsertId();
         $where = array($this->primaryKey => $primaryKey);
     }
     // refresh data
     $result = $this->tableGateway->select($where);
     $rowData = $result->current();
     $this->populateOriginalData($rowData);
     return $rowsAffected;
 }
開發者ID:bradley-holt,項目名稱:zf2,代碼行數:28,代碼來源:RowGateway.php

示例8: update

 /**
  * 
  * @param Request $request
  * @param type $id
  */
 public function update(Request $request, $id)
 {
     $this->service->update($request->all(), $id);
 }
開發者ID:mariosas,項目名稱:plusf,代碼行數:9,代碼來源:VendasController.php

示例9: update

 /**
  * 
  * @param User $entity
  * @return type
  */
 public function update(User $entity)
 {
     $result = $this->cbo->update($entity);
     return $result;
 }
開發者ID:serbinario,項目名稱:ProtocoloCERTAMES,代碼行數:10,代碼來源:UserRN.php

示例10: makeInput

 /**
  * 
  * @param type $answer
  * @param type $results
  * @param type $options
  * @param type $form
  * @return string
  */
 public function makeInput($answer, $results = null, $options = [], $form = '')
 {
     $html = '';
     $type = $answer->type;
     $name = $answer->akey;
     $text = !empty($answer->text) ? _t(ucfirst($answer->text)) : '';
     $ansval = $answer->value;
     $section = $answer->question->section;
     $qslug = $answer->question->slug;
     $qid = $answer->question->id;
     if (empty($answer->slug)) {
         $answer->update(['slug' => snake_case($answer->akey)]);
     }
     $ans_slug = $answer->slug;
     $options['id'] = $ans_slug;
     $options['data-logic'] = json_encode($answer->logic);
     $value = null;
     if (!is_null($results)) {
         $rs = $results->where('section_id', $section)->first();
         if (!is_null($rs)) {
             foreach ($rs->answers as $values) {
                 if (in_array($ans_slug, $values->toArray())) {
                     if ($type == 'radio') {
                         $value = true;
                     } else {
                         $value = $values->value;
                     }
                     break;
                 } else {
                     $value = null;
                 }
             }
         }
     } else {
         $value = null;
     }
     if ($type == 'radio') {
         $inputname = "answer[{$section}][{$qslug}][radio]";
     } else {
         $inputname = "answer[{$section}][{$qslug}][{$ans_slug}]";
     }
     if (array_key_exists('class', $options)) {
         $cssClass = $options['class'];
     } else {
         $cssClass = '';
     }
     switch ($type) {
         case 'radio':
             $options['data-value'] = $ansval;
             $html .= "<div class=\"radio\">";
             $html .= "<label class='control-label'>";
             $html .= $this->radio($inputname, $ans_slug, $value, $options);
             $html .= "<span class='badge'>{$ansval}</span> ";
             $html .= $text;
             $html .= "</label>";
             $html .= "</div>";
             break;
         case 'checkbox':
             $html .= "<div class=\"checkbox\">";
             $html .= "<label class='control-label'>";
             $html .= $this->checkbox($inputname, $ansval, $value, $options);
             $html .= "<span class='badge'>{$ansval}</span> ";
             $html .= $text;
             $html .= "</label>";
             $html .= "</div>";
             break;
         case 'textarea':
             $options['class'] = $cssClass . ' form-control';
             $html .= "<label for=\"{$inputname}\" class='col-xs-2 text-normal'>{$text}</label>";
             $html .= "<div class='col-xs-10' style='padding-left:0px'>";
             $html .= $this->textarea($inputname, $value, $options);
             $html .= "</div>";
             break;
         case 'option':
             break;
         case 'question':
             break;
         default:
             $options['class'] = $cssClass . ' form-control';
             $html .= "<label style='padding-left:0px;margin-top:15px' for=\"{$inputname}\" class='col-xs-3 text-normal'>{$text}</label>";
             $html .= "<div style='padding-left:0px;margin-top:15px' class='col-xs-9' style='padding-left:0px'>";
             $html .= $this->input($type, $inputname, $value, $options);
             $html .= "</div>";
             break;
     }
     return $html;
 }
開發者ID:herzcthu,項目名稱:Laravel-HS,代碼行數:95,代碼來源:Macros.php

示例11: update

 /**
  * 
  * @param Subsecretaria $subsecretaria
  * @return type
  */
 public function update(Subsecretaria $subsecretaria)
 {
     $result = $this->subsecretariaDAO->update($subsecretaria);
     return $result;
 }
開發者ID:serbinario,項目名稱:ProtocoloCERTAMES,代碼行數:10,代碼來源:SubsecretariaRN.php

示例12: update

 /**
  * 
  * @param Permissao $entity
  * @return type
  */
 public function update(Permissao $entity)
 {
     $result = $this->cbo->update($entity);
     return $result;
 }
開發者ID:serbinario,項目名稱:ProtocoloCERTAMES,代碼行數:10,代碼來源:PermissaoRN.php

示例13: update

 /**
  * 
  * @param Setores $setores
  * @return type
  */
 public function update(Setores $setores)
 {
     $result = $this->setoresDAO->update($setores);
     return $result;
 }
開發者ID:serbinario,項目名稱:ProtocoloCERTAMES,代碼行數:10,代碼來源:SetoresRN.php

示例14: updateModelWithFormValidation

 /**
  * @param type $form
  * @param type $model
  * @param type $successMsg
  * @return boolean
  * @throws InvalidArgumentException
  */
 protected function updateModelWithFormValidation($form, $model, $successMsg)
 {
     if ($form->isValid() && $model->update()) {
         if (!empty($successMsg)) {
             $this->flashSession->notice($successMsg);
         }
         return true;
     }
     $m = "";
     foreach ($form->getMessages() as $msg) {
         $m .= $msg . "<br>";
     }
     foreach ($model->getMessages() as $msg) {
         $m .= $msg . "<br>";
     }
     throw new InvalidArgumentException($m);
 }
開發者ID:willmontiel,項目名稱:sayvot,代碼行數:24,代碼來源:ControllerBase.php

示例15: update

 /**
  * 
  * @param Encaminhamentos $encaminhamentos
  * @return type
  */
 public function update(Encaminhamentos $encaminhamentos)
 {
     $result = $this->encaminhamentosDAO->update($encaminhamentos);
     return $result;
 }
開發者ID:serbinario,項目名稱:ProtocoloCERTAMES,代碼行數:10,代碼來源:EncaminhamentosRN.php


注:本文中的type::update方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。