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


PHP Object::save方法代码示例

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


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

示例1: loadOrCreate

 /**
  * Loads or creates the file
  *
  * @return void
  * @author Dan Cox
  */
 public function loadOrCreate()
 {
     if ($this->fs->exists(LOGS . $this->file)) {
         $this->config->load(LOGS . $this->file);
     } else {
         $this->config->create(LOGS . $this->file);
         $this->config->params()->created = array('date' => date('Y-m-d H:i:s'));
         $this->config->params()->log = array();
         $this->config->save();
     }
 }
开发者ID:danzabar,项目名称:alice,代码行数:17,代码来源:Log.php

示例2: save

 /**
  * @see parent::save()
  */
 public function save()
 {
     if (!$this->OrderId) {
         return false;
     }
     return parent::save();
 }
开发者ID:vosaan,项目名称:ankor.local,代码行数:10,代码来源:row.php

示例3: save

 /**
  * @see parent::save()
  */
 public function save()
 {
     if (!$this->Position) {
         $this->Position = intval(self::getLast($this, 'Position')) + 1;
     }
     return parent::save();
 }
开发者ID:vosaan,项目名称:ankor.local,代码行数:10,代码来源:type.php

示例4: save

 /**
  * @see parent::save()
  */
 public function save()
 {
     if (!$this->Position) {
         $this->Position = intval(self::getLast($this, 'Position', array('ProductId = ' . $this->ProductId))) + 1;
     }
     return parent::save();
 }
开发者ID:vosaan,项目名称:ankor.local,代码行数:10,代码来源:document.php

示例5: save

 /**
  * @see parent::save()
  */
 public function save()
 {
     if (!$this->PostedAt) {
         $this->PostedAt = time();
     }
     return parent::save();
 }
开发者ID:vosaan,项目名称:ankor.local,代码行数:10,代码来源:announce.php

示例6: write

 /**
  * Write log
  *
  * @return void
  */
 public function write()
 {
     if ($this->Model->name == 'Log') {
         return true;
     }
     $this->Log->id = null;
     $this->Log->save(array('Log' => array('authuser_id' => $this->Session->read('Usuario.id'), 'model' => $this->Model->name, 'action' => $this->_action, 'old_data' => $this->_oldData, 'new_data' => $this->_newData)));
 }
开发者ID:alextalha,项目名称:sg,代码行数:13,代码来源:Logs.php

示例7: test_saveModel

 /**
  * Test the save function
  *
  * @return void
  * @author Dan Cox
  */
 public function test_saveModel()
 {
     DI::addMock('database', $this->database);
     $this->database->shouldReceive('getEntity')->andReturn($this->database);
     $this->database->shouldReceive('persist');
     $this->database->shouldReceive('flush');
     $this->entity->save();
 }
开发者ID:danzabar,项目名称:alice,代码行数:14,代码来源:EntityTest.php

示例8: testSaveNormal

 /**
  * 正常系 正しく保存されるか
  *
  * @covers Lib\Common\Csv::save()
  * @test testSaveNormal()
  */
 public function testSaveNormal()
 {
     $filename = 'test';
     $this->object->save($filename);
     $path = $this->object->getPath();
     $file = $path . $filename . '.csv';
     $res = file_exists($file);
     $this->assertTrue($res);
     unlink($file);
 }
开发者ID:kobabasu,项目名称:rest-slim,代码行数:16,代码来源:CsvTest.php

示例9: save

 /**
  * @see parent::save()
  */
 public function save()
 {
     if (in_array($this->Layout, array(self::PAGE, self::PRODUCT)) && !$this->RefId) {
         return false;
     }
     if ($this->Layout == self::CATALOG && !$this->CategoryId && !$this->BrandId && !$this->TypeId && !$this->MaterialId) {
         return false;
     }
     return parent::save();
 }
开发者ID:vosaan,项目名称:ankor.local,代码行数:13,代码来源:reference.php

示例10: save

 public function save()
 {
     if (!$this->store_file()) {
         throw new Error_Save("failed to move");
     }
     if (!parent::save()) {
         throw new Error_Save("failed to store");
     }
     // override long now so we can display it properly
     $this->long = SnS::make_url("file/" . $this->short . "-" . $this->long);
 }
开发者ID:helloandre,项目名称:shortnsweet,代码行数:11,代码来源:file.php

示例11: save

 public function save()
 {
     $valid_gsb = Config::$gsb_key ? $this->check_gsb() : true;
     if (!$this->check_valid()) {
         throw new Error_Save("invalud url");
     }
     if (!$valid_gsb) {
         throw new Error_Save("unsafe url");
     }
     if (!parent::save()) {
         throw new Error_Save("could not save url");
     }
 }
开发者ID:helloandre,项目名称:shortnsweet,代码行数:13,代码来源:url.php

示例12: saveBase64

 private function saveBase64($type, $files)
 {
     $img = base64_decode($files);
     $fileCache['name'] = "scrawl" . time() . rand(1, 9999) . ".png";
     $fileCache['ext'] = "png";
     $saveName = $this->getSaveName($fileCache);
     if (!file_put_contents(ROOT_PATH . $this->cachePath . $saveName, $img) || !makeDir(ROOT_PATH . $this->cachePath)) {
         $this->error = "写入上传中转文件失败";
         return false;
     }
     /* 检测上传根目录 */
     if (!$this->uploader->checkRootPath($this->rootPath)) {
         $this->error = $this->uploader->getError();
         return false;
     }
     /* 检查上传目录 */
     //检验type,默认file
     $this->savePath = $this->savePath ? $this->savePath : array_key_exists($type, $this->type) ? $type . "/" : 'file/';
     if (!$this->uploader->checkSavePath($this->savePath)) {
         $this->error = $this->uploader->getError();
         return false;
     }
     /* 检测并创建子目录 */
     $subpath = $this->getSubPath($fileCache['name']);
     if (false === $subpath) {
         return;
     } else {
         $fileCache['savepath'] = $this->savePath . $subpath;
     }
     $fileCache['savename'] = $saveName;
     $fileCache['tmp_name'] = ROOT_PATH . $this->cachePath . $saveName;
     /* 获取文件hash */
     if ($this->hash) {
         $fileCache['md5'] = md5_file($fileCache['tmp_name']);
         $fileCache['sha1'] = sha1_file($fileCache['tmp_name']);
     }
     /* 保存文件 并记录保存成功的文件 */
     if ($this->uploader->save($fileCache, $this->replace, true)) {
         $this->error = $this->uploader->getError();
         $info[] = $fileCache;
     } else {
         $this->error = $this->uploader->getError();
     }
     unlink(ROOT_PATH . $this->cachePath . $saveName);
     if (isset($finfo)) {
         finfo_close($finfo);
     }
     return empty($info) ? false : $info;
 }
开发者ID:jayxtt999,项目名称:me,代码行数:49,代码来源:Upload.php

示例13: save

 public function save()
 {
     if (empty($this->name)) {
         throw new \InvalidArgumentException('Missing required field "name"');
     }
     if (empty($this->idBoard)) {
         throw new \InvalidArgumentException('Missing required filed "idBoard" - id of the board that the list should be added to');
     }
     if (empty($this->pos)) {
         $this->pos = 'bottom';
     } else {
         if ($this->pos !== 'top' && $this->pos !== 'bototm' && $this->pos <= 0) {
             throw new \InvalidArgumentException("Invalid pos value {$this->pos}. Valid Values: A position. top, bottom, or a positive number");
         }
     }
     return parent::save();
 }
开发者ID:KristofSerre,项目名称:alfredapp-trello,代码行数:17,代码来源:Lane.php

示例14: action_add_edit

 /**
  * Handle Add & Edit operations.
  * @return Array Success or Failure response.
  */
 protected function action_add_edit()
 {
     if (isset($_REQUEST['_wpnonce'])) {
         $nonce = sanitize_text_field(wp_unslash($_REQUEST['_wpnonce']));
     }
     if (!wp_verify_nonce($nonce, 'wpgmp-nonce')) {
         die('Cheating...');
     }
     $response = array();
     // Ignore changes in these class variables while setting up class object for insertion/updation.
     $properties_to_ignore = array('validations', 'table', 'unique');
     foreach ($properties_to_ignore as $classproperty) {
         if (array_key_exists($classproperty, $this->entityObjProperties)) {
             unset($this->entityObjProperties[$classproperty]);
         }
     }
     foreach (@$this->entityObjProperties as $key => $val) {
         if (isset($_POST[$key]) and !is_array($_POST[$key])) {
             $post_key = sanitize_text_field(wp_unslash($_POST[$key]));
         } else {
             $post_key = array_map('esc_attr', (array) wp_unslash($_POST[$key]));
         }
         if (isset($post_key)) {
             @$this->entityObj->set_val($key, $post_key);
         }
     }
     if (isset($_POST['entityID'])) {
         // Setting value of Id field in case of edit.
         $this->entityObj->set_val($this->entity . '_id', intval(wp_unslash($_POST['entityID'])));
     }
     if ($this->entityObj->save() > 0) {
         $current_obj_name = ucfirst($this->entity);
         if (isset($_GET['doaction']) and 'edit' == $_GET['doaction']) {
             $response['success'] = __($current_obj_name . ' updated successfully.', WPGMP_TEXT_DOMAIN);
         } else {
             $response['success'] = __($current_obj_name . ' added successfully. You can manage your ' . $current_obj_name . 's <a href="' . admin_url('admin.php?page=wpgmp_manage_' . $this->entity) . '">here</a>.', WPGMP_TEXT_DOMAIN);
         }
         $_POST = array();
     }
     return $response;
 }
开发者ID:OpenDoorBrewCo,项目名称:odbc-wp-prod,代码行数:45,代码来源:class.controller.php

示例15: blogBlogContentAfterSave

 /**
  * blogBlogContentAfterSave
  * 
  * @param CakeEvent $event
  */
 public function blogBlogContentAfterSave(CakeEvent $event)
 {
     $Model = $event->subject();
     $created = $event->data[0];
     if ($created) {
         $contentId = $Model->getLastInsertId();
     } else {
         $contentId = $Model->data[$Model->alias]['id'];
     }
     $saveData = $this->_generateContentSaveData($Model, $contentId);
     if (isset($saveData['PetitBlogCustomFieldConfig']['id'])) {
         // ブログ設定編集保存時に設定情報を保存する
         $this->PetitBlogCustomFieldConfigModel->set($saveData);
     } else {
         // ブログ設定追加時に設定情報を保存する
         $this->PetitBlogCustomFieldConfigModel->create($saveData);
     }
     if (!$this->PetitBlogCustomFieldConfigModel->save()) {
         $this->log(sprintf('ID:%s のプチ・カスタムフィールド設定の保存に失敗しました。', $Model->data['PetitBlogCustomFieldConfig']['id']));
     }
 }
开发者ID:gondoh,项目名称:petit_blog_custom_field,代码行数:26,代码来源:PetitBlogCustomFieldModelEventListener.php


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