本文整理汇总了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;
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}