當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。