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


PHP type::insert方法代碼示例

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


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

示例1: gravar

 /**
  * 
  * @param array $data
  * @throws Exception
  */
 public function gravar(array $data)
 {
     try {
         $this->_modelNotificacao->insert($data);
     } catch (Exception $ex) {
         throw new Exception($ex->getMessage());
     }
 }
開發者ID:nandorodpires2,項目名稱:homemakes,代碼行數:13,代碼來源:Notificacao.php

示例2: insert

 /**
  * 保存數據
  * @param array $entity 有屬性名和所要插入的屬性值組成的一維數組或二維數組,如:$parameter = array('shopName'=>'kongfz','userId'=>1)
  * @param string $table 表名
  * @param boolean $isReturnLastInsertId true:獲取插入記錄自增id,false:不返回插入記錄自增id
  * @param int $dimension 參數$parameter維度 1:插入一條數據,2:插入多條數據
  * @return boolean or int
  */
 public function insert(array $entity, $table = '', $isReturnLastInsertId = true, $dimension = 1)
 {
     if (is_null($this->db)) {
         $this->db = \Util\Db\Manager::getInstance($this->dbName);
     }
     //如果方法中沒傳遞表名,則向默認表中插入數據
     $table = is_string($table) && $table != '' ? $table : $this->defaultTable;
     $state = $this->db->insert($entity, $table, $dimension);
     if ($isReturnLastInsertId && $state) {
         return $this->db->getLastInsertId();
     }
     return $state;
 }
開發者ID:echoOly,項目名稱:php_base,代碼行數:21,代碼來源:BaseModel.php

示例3: 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

示例4: insertContactData

 /**
  * Insert a row in contact table
  * @param type $data
  * @return boolean
  */
 public function insertContactData($data)
 {
     try {
         $this->tableGateway->insert($data);
         return true;
     } catch (Exception $e) {
         return false;
     }
 }
開發者ID:hejames,項目名稱:jTrContact,代碼行數:14,代碼來源:ContactTable.php

示例5: 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

示例6: salvar

 /**
  * 
  * @throws Exception
  */
 public function salvar()
 {
     $this->validar();
     $this->table->insert(array('nmCargo' => $this->getCargo(), 'dsJustificativa' => $this->getJustificativa()));
 }
開發者ID:hackultura,項目名稱:novosalic,代碼行數:9,代碼來源:CargoAssinantePrestacaoDeConstasModel.php


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