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


PHP Entity::save方法代码示例

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


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

示例1: save

 public function save()
 {
     if (!$this->isSaved()) {
         $this->date = date('Y-m-d H:i:s');
     }
     parent::save();
 }
开发者ID:xdidx,项目名称:demago-webservices,代码行数:7,代码来源:Vote.php

示例2: testInitJoinTableSelfReferencingInsertingData

 public function testInitJoinTableSelfReferencingInsertingData()
 {
     $e = new Entity();
     $e->name = "Entity test";
     $this->assertTrue($e->Entity[0] instanceof Entity);
     $this->assertTrue($e->Entity[1] instanceof Entity);
     $this->assertEqual($e->Entity[0]->state(), Doctrine_Record::STATE_TCLEAN);
     $this->assertEqual($e->Entity[1]->state(), Doctrine_Record::STATE_TCLEAN);
     $e->Entity[0]->name = 'Friend 1';
     $e->Entity[1]->name = 'Friend 2';
     $e->Entity[0]->Entity[0]->name = 'Friend 1 1';
     $e->Entity[0]->Entity[1]->name = 'Friend 1 2';
     $e->Entity[1]->Entity[0]->name = 'Friend 2 1';
     $e->Entity[1]->Entity[1]->name = 'Friend 2 2';
     $this->assertEqual($e->Entity[0]->name, 'Friend 1');
     $this->assertEqual($e->Entity[1]->name, 'Friend 2');
     $this->assertEqual($e->Entity[0]->Entity[0]->name, 'Friend 1 1');
     $this->assertEqual($e->Entity[0]->Entity[1]->name, 'Friend 1 2');
     $this->assertEqual($e->Entity[1]->Entity[0]->name, 'Friend 2 1');
     $this->assertEqual($e->Entity[1]->Entity[1]->name, 'Friend 2 2');
     $this->assertEqual($e->Entity[0]->state(), Doctrine_Record::STATE_TDIRTY);
     $this->assertEqual($e->Entity[1]->state(), Doctrine_Record::STATE_TDIRTY);
     $count = count($this->conn);
     $e->save();
     $this->assertEqual($count + 13, $this->conn->count());
 }
开发者ID:dracony,项目名称:forked-php-orm-benchmark,代码行数:26,代码来源:NestTestCase.php

示例3: processRow

 public function processRow($row)
 {
     $arr = str_getcsv($row);
     $ticker = $arr[0];
     $name = $arr[1];
     $name = str_replace(''', "'", $name);
     if ($name == 'Name') {
         return false;
     }
     $cap = $arr[3];
     if ($cap < $this->min_market_cap) {
         $this->too_small_ct++;
         return false;
     } else {
         $corp = Doctrine::getTable('PublicCompany')->findOneByTicker($ticker);
         if ($corp) {
             $this->existing_ct++;
             return false;
         } else {
             $corp = new Entity();
             $corp->addExtension('Org');
             $corp->addExtension('Business');
             $corp->addExtension('PublicCompany');
             $corp->ticker = $ticker;
             $corp->name = $name;
             $corp->save();
             $this->printDebug("New company added: " . $name);
             $this->added_ct++;
         }
     }
 }
开发者ID:silky,项目名称:littlesis,代码行数:31,代码来源:TickerScraper.class.php

示例4: save

 public function save($query_conditions)
 {
     $query_conditions["creation"] = date("d/m/y");
     $query_conditions["creation_time"] = date("H:i:s");
     $query_conditions["owner"] = $_SESSION["user"]["username"];
     return parent::save($query_conditions);
 }
开发者ID:patriziopezzilli,项目名称:Fusion,代码行数:7,代码来源:entityNews.php

示例5: add

 public function add($data)
 {
     global $wpdb;
     $entity = new Entity();
     $option = new Option();
     $dataEntity = ['activate' => $data['activate'], 'sm_entity_id' => $data['sm_entity_id'], 'author_id' => wp_get_current_user()->ID, 'name' => $data['name'], 'last_published_message' => date('Y-m-d H:i:s')];
     $entityID = $entity->save($dataEntity);
     foreach ($data['category'] as $key => $value) {
         $dataOption = ['option_id' => 1, 'value' => $value];
         $option->save($dataOption, $entityID);
     }
     $dataOption = ['option_id' => 2, 'value' => $data['display_type']];
     $option->save($dataOption, $entityID);
     $dataOption = ['option_id' => 3, 'value' => $data['publish_type']];
     $option->save($dataOption, $entityID);
     $dataOption = ['option_id' => 4, 'value' => $data['link_canonical']];
     $option->save($dataOption, $entityID);
     $dataOption = ['option_id' => 5, 'value' => $data['image']];
     $option->save($dataOption, $entityID);
     $dataOption = ['option_id' => 6, 'value' => $data['readmore']];
     $option->save($dataOption, $entityID);
     $dataOption = ['option_id' => 7, 'value' => $data['noIndex']];
     $option->save($dataOption, $entityID);
     $dataOption = ['option_id' => 8, 'value' => $data['noFollow']];
     $option->save($dataOption, $entityID);
     $dataOption = ['option_id' => 9, 'value' => $data['morebalise']];
     $option->save($dataOption, $entityID);
 }
开发者ID:alhenaconseil,项目名称:wordpress-sociallymap,代码行数:28,代码来源:EntityCollection.php

示例6: testInit

 public function testInit()
 {
     $entity = new Entity();
     $entity->name = 'myname';
     $entity->loginname = 'test';
     $entity->save();
 }
开发者ID:dennybrandes,项目名称:doctrine1,代码行数:7,代码来源:576TestCase.php

示例7: prepareData

 public function prepareData()
 {
     parent::prepareData();
     //we create a test entity that is not a user and not a group
     $entity = new Entity();
     $entity->name='Other Entity';
     $entity->type = 2; 
     $entity->save();
     $this->otherEntity = $entity;
 }
开发者ID:prismhdd,项目名称:victorioussecret,代码行数:10,代码来源:ColumnAggregationInheritanceTestCase.php

示例8: testRelationSaving2

 public function testRelationSaving2()
 {
     $e = new Entity();
     $e->name = 'test';
     $e->save();
     $nr = new Phonenumber();
     $nr->phonenumber = '1234556';
     $nr->save();
     $nr->Entity = $e;
 }
开发者ID:dennybrandes,项目名称:doctrine1,代码行数:10,代码来源:OneToManyTestCase.php

示例9: testBug

 public function testBug()
 {
     $entity = new Entity();
     $entity->name = 'myname';
     $entity->save();
     // load our user and our collection of pages
     $user = Doctrine_Query::create()->select('id')->from('Entity')->fetchOne();
     $this->assertEqual($user->name, 'myname');
     // load our user and our collection of pages
     $user = Doctrine_Query::create()->select('*')->from('Entity')->fetchOne();
     $this->assertEqual($user->name, 'myname');
 }
开发者ID:swk,项目名称:bluebox,代码行数:12,代码来源:583TestCase.php

示例10: beforeSave

 /**
  * 注册entity
  */
 protected function beforeSave()
 {
     if (!$this->entityId) {
         $entity = new Entity();
         $entity->type = lcfirst(get_class($this));
         if ($entity->save()) {
             $this->entityId = $entity->getPrimaryKey();
             $this->_entity = $entity;
         }
     }
     return parent::beforeSave();
 }
开发者ID:stan5621,项目名称:jp_edu_online,代码行数:15,代码来源:EntityActiveRecord.php

示例11: save

 public function save()
 {
     $this->changed = time();
     if (empty($this->created)) {
         $this->created = time();
     }
     if (empty($this->uid)) {
         global $user;
         $this->uid = $user->uid;
     }
     return parent::save();
     // TODO: Change the autogenerated stub
 }
开发者ID:sosyuki,项目名称:wechat,代码行数:13,代码来源:WechatApp.php

示例12: store

 public function store()
 {
     $price = Input::get('price');
     $price = str_replace(",", ".", $price);
     $price = str_replace(".", "", $price);
     $price = substr($price, 0, -2);
     $entity = new Entity();
     $entity->location_id = Auth::user()->location_id;
     $entity->code = Input::get('code');
     $entity->name = Input::get('name');
     $entity->price = $price;
     $entity->feasible = Input::get('feasible');
     $entity->infeasible = Input::get('infeasible');
     $entity->last_opname = date('Y-m-d H:i:s');
     $entity->employee_id = Auth::user()->employee_id;
     $entity->save();
     Session::flash('message', 'Sukses menambahkan aset baru!');
 }
开发者ID:emanmks,项目名称:oneschool,代码行数:18,代码来源:EntitiesController.php

示例13: sendNotice

 /**
  * 发送Notice
  */
 private function sendNotice($courseId, $announcementId, $entityType = 'announcement_added')
 {
     $courseMember = new CourseMember();
     $members = $courseMember->findAllByAttributes(array('courseId' => $courseId));
     foreach ($members as $k => $v) {
         $entity = new Entity();
         $eData['type'] = 'announcement';
         $entity->attributes = $eData;
         $entity->save();
         $notice = new Notice();
         $nData['userId'] = $v->userId;
         $nData['type'] = $entityType;
         $nData['addTime'] = time();
         $nData['data'] = serialize(Announcement::model()->findByPk($announcementId)->id);
         $notice->attributes = $nData;
         $notice->save();
     }
 }
开发者ID:stan5621,项目名称:jp_edu_online,代码行数:21,代码来源:AnnouncementController.php

示例14: save

 public function save($values_condition)
 {
     if (Settings::getOperativeMode() == 'debug') {
         echo '<br /> save File to folder';
         var_dump($values_condition);
     }
     $values_condition["owner"] = $_SESSION["user"]["username"];
     if (isset($values_condition['file'])) {
         $values_condition['filetype'] = $values_condition['file']['type'];
         $values_condition['size'] = $values_condition['file']['size'];
         $values_condition['filename'] = 'upload/' . $values_condition['file']['name'];
         if (file_exists("upload/" . $values_condition["file"]["name"])) {
             echo Message::getInstance()->getMessage(MSG_ERROR_FILE_EXIST) . " (" . basename(__FILE__) . ":" . __LINE__ . ")";
         } else {
             move_uploaded_file($values_condition["file"]["tmp_name"], $values_condition["filename"]);
         }
     }
     unset($values_condition['file']);
     return parent::save($values_condition);
 }
开发者ID:patriziopezzilli,项目名称:Fusion,代码行数:20,代码来源:entityFileToFolder.php

示例15: import

 public function import($school)
 {
     if (EntityTable::getByExtensionQuery('Org')->addWhere('LOWER(org.name) LIKE ?', '%' . strtolower($school->instnm) . "%")->fetchOne()) {
         $this->printDebug("School exists in database: " . $school->instnm);
     } else {
         $address = new Address();
         $address->street1 = isset($school->addr) ? $school->addr : null;
         $address->street2 = isset($school->street2) ? $school->street2 : null;
         $address->city = $school->city;
         if ($state = AddressStateTable::retrieveByText($school->stabbr)) {
             $address->State = $state;
         }
         $address->postal = $school->zip;
         $aliases = explode("|", $school->ialias);
         $website = null;
         if (!preg_match('/^http\\:\\/\\//i', trim($school->webaddr))) {
             $website = "http://" . strtolower($school->webaddr);
         }
         $this->printDebug($website);
         $newschool = new Entity();
         $newschool->addExtension('Org');
         $newschool->addExtension('School');
         $newschool->name = $school->instnm;
         $newschool->website = $website;
         $newschool->addAddress($address);
         $newschool->save();
         foreach ($aliases as $alias) {
             try {
                 $newalias = new Alias();
                 $newalias->Entity = $newschool;
                 $newalias->name = $alias;
                 $newalias->save();
             } catch (Exception $e) {
                 $this->printDebug("An alias exception. No biggie. It's most likely that the name already exists. so we ignore it and move on: " . $e);
             }
         }
         $this->printDebug("Adding new school: " . $school->instnm);
     }
 }
开发者ID:silky,项目名称:littlesis,代码行数:39,代码来源:SchoolScraper.class.php


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