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


PHP Record::save方法代码示例

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


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

示例1: testSaveNewRecord

 function testSaveNewRecord()
 {
     $record = new Record($this->getPdo(), 'whatilearned_knowledgebit');
     $record->setField('title', 'value');
     $record->save();
     $this->assertEquals(3, $this->getConnection()->getRowCount('whatilearned_knowledgebit'));
 }
开发者ID:nkammah,项目名称:what-i-learned,代码行数:7,代码来源:RecordTest.php

示例2: actionOperation

 public function actionOperation()
 {
     $post = file_get_contents("php://input");
     $postData = CJSON::decode($post, true);
     $this->_device->ifaces[$postData['iface_id']]->saveAttributes(array('lastactivity' => $postData['start']));
     $operation = new Operation();
     $postData['alarm'] = $postData['alarm'] ? 1 : 0;
     $operation->attributes = $postData;
     $transaction = Yii::app()->db->beginTransaction();
     try {
         $operation->save();
         $operation_id = $operation->id;
         foreach ($postData['records'] as $record) {
             $record['operation_id'] = $operation_id;
             $recordModel = new Record();
             $recordModel->attributes = $record;
             $recordModel->save();
         }
         $transaction->commit();
         $this->_sendResponse(200);
     } catch (Exception $e) {
         $transaction->rollBack();
         $this->_sendResponse(400);
     }
 }
开发者ID:dailos,项目名称:heimdal,代码行数:25,代码来源:ApiController.php

示例3: createRecord

 public static function createRecord($input)
 {
     $answer = [];
     $rules = ['municipality_id' => 'required|integer', 'number_starting' => 'required', 'folio' => 'required', 'file' => 'required', 'date' => 'required', 'interested_m' => 'required', 'interested_f' => 'required', 'starting' => 'required'];
     $validation = Validator::make($input, $rules);
     if ($validation->fails()) {
         $answer['message'] = $validation;
         $answer['error'] = true;
     } else {
         $record = new Record();
         $record->municipality_id = $input['municipality_id'];
         $record->number_starting = $input['number_starting'];
         $record->folio = $input['folio'];
         $record->file = $input['file'];
         $record->date = $input['date'];
         $record->interested_m = $input['interested_m'];
         $record->interested_f = $input['interested_f'];
         $record->starting = $input['starting'];
         $record->description = $input['description'];
         $record->status = 1;
         if ($record->save()) {
             $answer['message'] = 'Creado con exito!';
             $answer['error'] = false;
         } else {
             $answer['message'] = 'RECORD CREATE error, team noob!';
             $answer['error'] = false;
         }
     }
     return $answer;
 }
开发者ID:hectorz11,项目名称:laravel_sistema_art,代码行数:30,代码来源:Record.php

示例4: actionIndex

 public function actionIndex()
 {
     $ips = array('95.110.192.200', '95.110.193.249', '95.110.204.16', '95.110.204.20', '69.175.126.90', '69.175.126.94', '46.4.96.70', '46.4.96.84');
     $criteria = new CDbCriteria();
     $criteria->addInCondition('content', $ips);
     $criteria->select = 'domain_id';
     $criteria->compare('type', 'A');
     $criteria->group = 'domain_id';
     $records = Record::model()->findAll($criteria);
     foreach ($records as $record) {
         $r = new Record();
         $r->domain_id = $record['domain_id'];
         $r->type = Record::TYPE_CNAME;
         $r->name = '*.' . $record->domain->name;
         $r->content = $record->domain->name;
         $r->ttl = '86400';
         if (!$r->save()) {
             echo "\nCannot save duplicate record to domain " . $r->domain->name;
         } else {
             echo "\nRecord * added to domain " . $r->domain->name;
             $record->domain->updateSOA();
         }
     }
     echo "\n";
 }
开发者ID:simonefalcini,项目名称:poweradmin-api,代码行数:25,代码来源:ToolCommand.php

示例5: storeRecord

 public function storeRecord(Record $item, $lifetime = null)
 {
     if (!$item->id) {
         $item->save();
     }
     $class = $item->getQualifiedClassname();
     $key = $this->_buildItemKey($class, $item->id);
     $this->_cacher->writeData($key, $item->toArray(), $lifetime);
 }
开发者ID:Ekhvalov,项目名称:recordsman,代码行数:9,代码来源:WPCacheAdapter.php

示例6: saveAndLoad

 public function saveAndLoad(Record $record)
 {
     $record->save();
     $loadedRecord = Record::load($record->getTableName(), $record->getId(), get_class($record));
     foreach ($record->getAttributes() as $key => $value) {
         $this->assertEquals($value, $loadedRecord->{$key});
     }
     $record->delete();
 }
开发者ID:Acidburn0zzz,项目名称:xframe-legacy,代码行数:9,代码来源:RecordTest.php

示例7: create

 public function create($data)
 {
     $record = new Record($this->schema, $this->td);
     foreach ($data as $col => $val) {
         $record->{$col} = $val;
     }
     $record->save();
     return $record;
 }
开发者ID:Altreus,项目名称:phpdbic,代码行数:9,代码来源:resultset.class.php

示例8: actionCreate

 /**
  * Creates a new model.
  * If creation is successful, the browser will be redirected to the 'view' page.
  */
 public function actionCreate()
 {
     $model = new Record();
     // Uncomment the following line if AJAX validation is needed
     // $this->performAjaxValidation($model);
     if (isset($_POST['Record'])) {
         $model->attributes = $_POST['Record'];
         if ($model->save()) {
             $this->redirect(array('view', 'id' => $model->id));
         }
     }
     $this->render('create', array('model' => $model));
 }
开发者ID:alexbit2015,项目名称:yiiphonebook,代码行数:17,代码来源:RecordController.php

示例9: borrowBook

 public function borrowBook()
 {
     $b_id = Input::get('book_id');
     $res = Book::whereRaw('id', $b_id)->get();
     foreach ($res as $book) {
         if ($book->states != 0) {
             return '暂时不能借';
         }
     }
     $record = new Record();
     $record->u_id = Auth::user()->id;
     $record->b_id = $b_id;
     $record->save();
     return '借书成功';
 }
开发者ID:macinchang,项目名称:library,代码行数:15,代码来源:BookController.php

示例10: run

 public function run()
 {
     $faker = Faker::create();
     for ($i = 0; $i < 10; $i++) {
         $record = new Record();
         $record->municipality_id = $faker->randomElement($array = array('1', '2', '3', '4', '5'));
         $record->number_starting = $faker->randomNumber($nbDigits = 4);
         $record->folio = $faker->randomNumber($nbDigits = 3);
         $record->file = $faker->randomNumber($nbDigits = 3);
         $record->date = $faker->date($format = 'Y-m-d', $max = 'now');
         $record->interested_m = $faker->firstNameMale . ' ' . $faker->lastName;
         $record->interested_f = $faker->firstNameFemale . ' ' . $faker->lastName;
         $record->starting = $faker->word;
         $record->description = $faker->sentence($nbWords = 6);
         $record->status = 1;
         $record->save();
     }
 }
开发者ID:hectorz11,项目名称:laravel_sistema_art,代码行数:18,代码来源:RecordTableSeeder.php

示例11: actionCreate

 /**
  * Creates a new model.
  * If creation is successful, the browser will be redirected to the 'view' page.
  */
 public function actionCreate($domain)
 {
     $model = new Record();
     $model->domain_id = $domain;
     $domain = Domain::model()->findByPK($domain);
     $model->domain = $domain;
     // Uncomment the following line if AJAX validation is needed
     // $this->performAjaxValidation($model);
     if (isset($_POST['Record'])) {
         $model->attributes = $_POST['Record'];
         if ($model->save()) {
             Yii::app()->audit->log('Created record: ' . $model->id);
             $this->redirect(array('domain/update', 'id' => $domain->id));
         }
     }
     $userId = Yii::app()->user->getId();
     $user = User::model()->findByPK($userId);
     $this->render('create', array('model' => $model, 'user' => $user));
 }
开发者ID:vitaliy7711,项目名称:pdnsops,代码行数:23,代码来源:RecordController.php

示例12: uploadLog

 public function uploadLog($site_id, $switch, $status, $rfid, $created_at)
 {
     $page = 'log';
     $entry = new Record();
     $entry->site_id = $site_id;
     $entry->site_name = 'test';
     $entry->switch = $switch;
     if ($status) {
         $status_string = 'on';
         $command = 1;
     } else {
         $status_string = 'off';
         $command = 0;
     }
     $entry->status = $status_string;
     $entry->command = $command;
     $entry->rfid = $rfid;
     $entry->created_at = $created_at;
     $entry->save();
     $records = Record::all();
 }
开发者ID:atefth,项目名称:remote_access_system,代码行数:21,代码来源:RecordController.php

示例13: addSOA

 private function addSOA()
 {
     $domain = $this;
     // check if SOA already exists
     if (Record::model()->countByAttributes(array('domain_id' => $domain->id, 'type' => Record::TYPE_SOA)) == 0) {
         $recordSoa = new Record();
         $recordSoa->name = $domain->name;
         $recordSoa->type = Record::TYPE_SOA;
         $recordSoa->domain_id = $domain->id;
         $recordSoa->content = Domain::soaArrayToContent(array('name_server' => Yii::app()->params['soa_defaults']['name_server'], 'email_address' => Yii::app()->params['soa_defaults']['email_address'], 'serial_number' => '1', 'refresh_time' => Yii::app()->params['soa_defaults']['refresh_time'], 'retry_time' => Yii::app()->params['soa_defaults']['retry_time'], 'expiry_time' => Yii::app()->params['soa_defaults']['expiry_time'], 'nx_time' => Yii::app()->params['soa_defaults']['nx_time']));
         $recordSoa->ttl = Yii::app()->params['soa_defaults']['expiry_time'];
         $recordSoa->prio = 0;
         if (!$recordSoa->save()) {
             Yii::log('Cannot add SOA: ' . print_r($recordSoa->getErrors(), true), CLogger::LEVEL_ERROR);
             return false;
         }
     } else {
         Yii::log('SOA record already existing', CLogger::LEVEL_ERROR);
         return false;
     }
     return true;
 }
开发者ID:simonefalcini,项目名称:poweradmin-api,代码行数:22,代码来源:Domain.php

示例14: testInsertDefault

 public function testInsertDefault()
 {
     $record = new Record($this->dataHash, $this->dao);
     $record->save();
     return $this->assertCallCount($this->dao, 'insert', 1, array(), 'Per default Records should not exist in database.');
 }
开发者ID:enyo,项目名称:rincewind,代码行数:6,代码来源:Record.stest.php

示例15: executeEdit

 /**
  * Edit
  */
 public function executeEdit()
 {
     if ($this->isGET()) {
         return $this->renderJson(array("success" => false, "info" => "POST only."));
     } else {
         $ids = array();
         foreach ($this->getRequestParameter('record') as $data) {
             if (!($record = RecordPeer::retrieveByPK($data['id']))) {
                 $record = new Record();
                 $record->setDomainId($this->domain->getId());
             }
             $record->setName($data['name']);
             $record->setType($data['type']);
             $record->setContent($data['content']);
             $record->setTtl($data['ttl']);
             if ($data['type'] == 'MX' || $data['type'] == 'SRV') {
                 $record->setPrio($data['prio']);
             }
             $record->save();
             $ids[] = $record->getId();
         }
         $c = new Criteria();
         $c->add(RecordPeer::DOMAIN_ID, $this->domain->getId());
         $c->add(RecordPeer::ID, $ids, Criteria::NOT_IN);
         foreach (RecordPeer::doSelect($c) as $record) {
             $record->delete();
         }
         return $this->renderJson(array("success" => true, "info" => "Domain updated."));
     }
 }
开发者ID:royalterra,项目名称:pdns-gui,代码行数:33,代码来源:actions.class.php


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