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


PHP Conversation::insert方法代码示例

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


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

示例1: create

 /**
  * Factory method for creating a new conversation.
  *
  * Use this for locally initiated conversations. Remote notices should
  * preferrably supply their own conversation URIs in the OStatus feed.
  *
  * @return Conversation the new conversation DO
  */
 static function create(Notice $notice, $uri = null)
 {
     if (empty($notice->id)) {
         throw new ServerException(_('Tried to create conversation for not yet inserted notice'));
     }
     $conv = new Conversation();
     $conv->created = common_sql_now();
     $conv->id = $notice->id;
     $conv->uri = $uri ?: sprintf('%s%s=%d:%s=%s:%s=%x', TagURI::mint(), 'noticeId', $notice->id, 'objectType', 'thread', 'crc32', crc32($notice->content));
     $result = $conv->insert();
     if ($result === false) {
         common_log_db_error($conv, 'INSERT', __FILE__);
         throw new ServerException(_('Failed to create conversation for notice'));
     }
     return $conv;
 }
开发者ID:phpsource,项目名称:gnu-social,代码行数:24,代码来源:Conversation.php

示例2: create

 /**
  * Factory method for creating a new conversation
  *
  * @return Conversation the new conversation DO
  */
 static function create()
 {
     $conv = new Conversation();
     $conv->created = common_sql_now();
     $id = $conv->insert();
     if (empty($id)) {
         common_log_db_error($conv, 'INSERT', __FILE__);
         return null;
     }
     $orig = clone $conv;
     $orig->uri = common_local_url('conversation', array('id' => $id), null, null, false);
     $result = $orig->update($conv);
     if (empty($result)) {
         common_log_db_error($conv, 'UPDATE', __FILE__);
         return null;
     }
     return $conv;
 }
开发者ID:himmelex,项目名称:NTW,代码行数:23,代码来源:Conversation.php

示例3: create

 /**
  * Factory method for creating a new conversation.
  *
  * Use this for locally initiated conversations. Remote notices should
  * preferrably supply their own conversation URIs in the OStatus feed.
  *
  * @return Conversation the new conversation DO
  */
 static function create($uri = null, $created = null)
 {
     // Be aware that the Notice does not have an id yet since it's not inserted!
     $conv = new Conversation();
     $conv->created = $created ?: common_sql_now();
     $conv->uri = $uri ?: sprintf('%s%s=%s:%s=%s', TagURI::mint(), 'objectType', 'thread', 'nonce', common_random_hexstr(8));
     // This insert throws exceptions on failure
     $conv->insert();
     return $conv;
 }
开发者ID:bashrc,项目名称:gnusocial-debian,代码行数:18,代码来源:Conversation.php


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