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


PHP Core_Model_Item_Abstract::save方法代码示例

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


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

示例1: addComment

 public function addComment(Core_Model_Item_Abstract $resource, Core_Model_Item_Abstract $poster, $body)
 {
     $table = $this->getCommentTable();
     $row = $table->createRow();
     if (isset($row->resource_type)) {
         $row->resource_type = $resource->getType();
     }
     $row->resource_id = $resource->getIdentity();
     if ($poster->getIdentity() > 0) {
         $row->poster_type = $poster->getType();
         $row->poster_id = $poster->getIdentity();
     } else {
         $row->poster_type = 'user';
         $row->poster_id = 0;
         $row->poster_name = $poster->displayname;
         $row->poster_email = $poster->email;
     }
     $row->creation_date = date('Y-m-d H:i:s');
     $row->body = $body;
     $row->save();
     if (isset($resource->comment_count)) {
         $resource->comment_count++;
         $resource->save();
     }
     return $row;
 }
开发者ID:hoalangoc,项目名称:ftf,代码行数:26,代码来源:Comments.php

示例2: editActivity

 public function editActivity(Core_Model_Item_Abstract $action, Core_Model_Item_Abstract $subject, Core_Model_Item_Abstract $object, $type, $body = null, array $params = null)
 {
     // Disabled or missing type
     $typeInfo = $this->getActionType($type);
     if (!$typeInfo || !$typeInfo->enabled) {
         return;
     }
     // User disabled publishing of this type
     $actionSettingsTable = Engine_Api::_()->getDbtable('actionSettings', 'activity');
     if (!$actionSettingsTable->checkEnabledAction($subject, $type)) {
         return;
     }
     // Edit action
     $action->body = $body;
     $action->params = $params;
     $action->save();
     // Remove all privacies
     $streamTable = Engine_Api::_()->getDbtable('stream', 'activity');
     $action_id = $action->getIdentity();
     $streamTable->delete("action_id = {$action_id}");
     // Add bindings
     $this->addActivityBindings($action, $type, $subject, $object);
     // We want to update the subject
     if (isset($subject->modified_date)) {
         $subject->modified_date = date('Y-m-d H:i:s');
         $subject->save();
     }
     return $action;
 }
开发者ID:hoalangoc,项目名称:ftf,代码行数:29,代码来源:Actions.php

示例3: remove

 public function remove(Core_Model_Item_Abstract $idea, Core_Model_Item_Abstract $poster)
 {
     $row = $this->getVote($idea->getIdentity(), $poster->getIdentity());
     if (null !== $row) {
         $row->delete();
         if (isset($idea->vote_count)) {
             $idea->vote_count--;
             $idea->save();
         }
     }
     return $this;
 }
开发者ID:hoalangoc,项目名称:ftf,代码行数:12,代码来源:Votes.php

示例4: clearStatus

 public function clearStatus(Core_Model_Item_Abstract $resource)
 {
     // Update resource if necessary
     $resourceModified = false;
     if (isset($resource->status)) {
         $resourceModified = true;
         $resource->status = '';
     }
     if (isset($resource->status_date)) {
         $resourceModified = true;
         $resource->status_date = '00-00-0000';
     }
     if ($resourceModified) {
         $resource->save();
     }
     return $this;
 }
开发者ID:robeendey,项目名称:ce,代码行数:17,代码来源:Status.php

示例5: removeAllMembers

 public function removeAllMembers(Core_Model_Item_Abstract $resource)
 {
     $this->getTable()->delete(array('resource_id = ?' => $resource->getIdentity()));
     if (isset($resource->member_count)) {
         $resource->member_count = 0;
         $resource->save();
     }
     return $this;
 }
开发者ID:HiLeo1610,项目名称:tumlumsach,代码行数:9,代码来源:Membership.php


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