ModuleComment

Package application.modules.comment
Inheritance class ModuleComment » Module » LsObject
Since 1.0
Source Code /application/classes/modules/comment/Comment.class.php
Модуль для работы с комментариями

Protected Properties

Hide inherited properties

PropertyTypeDescriptionDefined By
_aBehaviors Список поведений в виде готовых объектов, формируется автоматически LsObject
aBehaviors array Список поведений LsObject
bIsInit bool Указывает на то, была ли проведенна инициализация модуля Module
oMapper ModuleComment_MapperComment Объект маппера ModuleComment
oUserCurrent ModuleUser_EntityUser|null Объект текущего пользователя ModuleComment

Public Methods

Hide inherited methods

MethodDescriptionDefined By
AddBehaviorHook() Добавляет хук поведения LsObject
AddComment() Добавляет коммент ModuleComment
AddCommentOnline() Добавляет новый коммент в прямой эфир ModuleComment
AddFavouriteComment() Добавляет комментарий в избранное ModuleComment
AttachBehavior() Присоединяет поведение к объекту LsObject
DeleteCommentByTargetId() Удаляет комментарии из базы данных ModuleComment
DeleteCommentOnlineByArrayId() Удаляет коммент из прямого эфира по массиву переданных идентификаторов ModuleComment
DeleteCommentOnlineByTargetId() Удаляет коммент из прямого эфира ModuleComment
DeleteFavouriteComment() Удаляет комментарий из избранного ModuleComment
DeleteFavouriteCommentsByArrayId() Удаляет комментарии из избранного по списку ModuleComment
DetachBehavior() Отсоединяет поведение от объекта LsObject
GetBehavior() Возвращает объект поведения по его имени LsObject
GetBehaviors() Возвращает все объекты поведения LsObject
GetCommentById() Получить коммент по айдишнику ModuleComment
GetCommentItemsByArrayId() Алиас для корректной работы ORM ModuleComment
GetCommentUnique() Получает уникальный коммент, это помогает спастись от дублей комментов ModuleComment
GetCommentsAdditionalData() Получает дополнительные данные(объекты) для комментов по их ID ModuleComment
GetCommentsAll() Получить все комменты ModuleComment
GetCommentsByArrayId() Список комментов по ID ModuleComment
GetCommentsByArrayIdSolid() Получает список комментариев по ID используя единый кеш ModuleComment
GetCommentsByFilter() Получает список комментариев по фильтру ModuleComment
GetCommentsByTargetId() Получить комменты по владельцу ModuleComment
GetCommentsByUserId() Получить комменты по юзеру ModuleComment
GetCommentsFavouriteByUserId() Получает список комментариев из избранного пользователя ModuleComment
GetCommentsNewByTargetId() Получить новые комменты для владельца ModuleComment
GetCommentsOnline() Получить все комменты сгрупированные по типу(для вывода прямого эфира) ModuleComment
GetCommentsRatingByDate() Получить комменты по рейтингу и дате ModuleComment
GetCommentsTreeByTargetId() Получает комменты используя nested set ModuleComment
GetCountCommentsByUserId() Получает количество комментариев одного пользователя ModuleComment
GetCountCommentsFavouriteByUserId() Возвращает число комментариев в избранном ModuleComment
GetCountCommentsRootByTargetId() Возвращает количество дочерних комментариев у корневого коммента ModuleComment
GetFavouriteComment() Получает привязку комментария к ибранному(добавлен ли коммент в избранное у юзера) ModuleComment
GetFavouriteCommentsByArray() Получить список избранного по списку айдишников ModuleComment
GetFavouriteCommentsByArraySolid() Получить список избранного по списку айдишников, но используя единый кеш ModuleComment
GetPageCommentByTargetId() Возвращает номер страницы, на которой расположен комментарий ModuleComment
GetTemplateCommentByTarget() Возвращает шаблон комментария для рендеринга ModuleComment
Init() Инициализация ModuleComment
MoveTargetParent() Меняет target parent на новый ModuleComment
MoveTargetParentOnline() Меняет target parent на новый в прямом эфире ModuleComment
RecalculateFavourite() Пересчитывает счетчик избранных комментариев ModuleComment
RemoveBehaviorHook() Удаляет хук поведения LsObject
RestoreTree() Перестраивает дерево комментариев ModuleComment
RunBehaviorHook() Запускает хук поведения на выполнение LsObject
SetCommentsPublish() Устанавливает publish у коммента ModuleComment
SetInit() Помечает модуль как инициализированный Module
Shutdown() Метод срабатывает при завершении работы ядра Module
UpdateComment() Обновляет коммент ModuleComment
UpdateCommentRating() Обновляет рейтинг у коммента ModuleComment
UpdateCommentStatus() Обновляет статус у коммента - delete или publish ModuleComment
UpdateTargetParentByTargetId() Меняем target parent по массиву идентификаторов ModuleComment
UpdateTargetParentByTargetIdOnline() Меняем target parent по массиву идентификаторов в таблице комментариев online ModuleComment
__call() Ставим хук на вызов неизвестного метода и считаем что хотели вызвать метод какого либо модуля LsObject
__clone() Блокируем копирование/клонирование объекта Module
__construct() Конструктор, запускается автоматически при создании объекта LsObject
__get() Обработка доступа к объекты поведения LsObject
isInit() Возвращает значение флага инициализации модуля Module

Protected Methods

Hide inherited methods

MethodDescriptionDefined By
BuildCommentsRecursive() Строит дерево комментариев ModuleComment
PrepareBehaviors() Инициализация поведений LsObject

Property Details

oMapper property
protected ModuleComment_MapperComment $oMapper;

Объект маппера

oUserCurrent property
protected ModuleUser_EntityUser|null $oUserCurrent;

Объект текущего пользователя

Method Details

AddComment() method
public bool|ModuleComment_EntityComment AddComment(ModuleComment_EntityComment $oComment)
$oComment ModuleComment_EntityComment Объект комментария
{return} bool|ModuleComment_EntityComment
Source Code: /application/classes/modules/comment/Comment.class.php#545 (show)
public function AddComment(ModuleComment_EntityComment $oComment)
{
    if (
Config::Get('module.comment.use_nested')) {
        
$sId $this->oMapper->AddCommentTree($oComment);
        
$this->Cache_Clean(Zend_Cache::CLEANING_MODE_MATCHING_TAG, array("comment_update"));
    } else {
        
$sId $this->oMapper->AddComment($oComment);
    }
    if (
$sId) {
        if (
$oComment->getTargetType() == 'topic') {
            
$this->Topic_increaseTopicCountComment($oComment->getTargetId());
        }
        
//чистим зависимые кеши
        
$this->Cache_Clean(Zend_Cache::CLEANING_MODE_MATCHING_TAG, array(
                
"comment_new",
                
"comment_new_{$oComment->getTargetType()}",
                
"comment_new_user_{$oComment->getUserId()}_{$oComment->getTargetType()}",
                
"comment_new_{$oComment->getTargetType()}_{$oComment->getTargetId()}"
            
));
        
$oComment->setId($sId);
        return 
$oComment;
    }
    return 
false;
}

Добавляет коммент

AddCommentOnline() method
public bool|int AddCommentOnline(ModuleComment_EntityCommentOnline $oCommentOnline)
$oCommentOnline ModuleComment_EntityCommentOnline Объект онлайн комментария
{return} bool|int
Source Code: /application/classes/modules/comment/Comment.class.php#690 (show)
public function AddCommentOnline(ModuleComment_EntityCommentOnline $oCommentOnline)
{
    
$this->Cache_Clean(Zend_Cache::CLEANING_MODE_MATCHING_TAG,
        array(
"comment_online_update_{$oCommentOnline->getTargetType()}"));
    return 
$this->oMapper->AddCommentOnline($oCommentOnline);
}

Добавляет новый коммент в прямой эфир

AddFavouriteComment() method
public bool|ModuleFavourite_EntityFavourite AddFavouriteComment(ModuleFavourite_EntityFavourite $oFavourite)
$oFavourite ModuleFavourite_EntityFavourite Объект избранного
{return} bool|ModuleFavourite_EntityFavourite
Source Code: /application/classes/modules/comment/Comment.class.php#869 (show)
public function AddFavouriteComment(ModuleFavourite_EntityFavourite $oFavourite)
{
    if ((
$oFavourite->getTargetType() == 'comment')
        && (
$oComment $this->Comment_GetCommentById($oFavourite->getTargetId()))
        && 
in_array($oComment->getTargetType(), Config::get('module.comment.favourite_target_allow'))
    ) {
        return 
$this->Favourite_AddFavourite($oFavourite);
    }
    return 
false;
}

Добавляет комментарий в избранное

BuildCommentsRecursive() method
protected array('comments'=>array,'iMaxIdComment'=>int) BuildCommentsRecursive(array $aComments, bool $bBegin=true)
$aComments array Список комментариев
$bBegin bool Флаг начала построения дерева, для инициализации параметров внутри метода
{return} array('comments'=>array,'iMaxIdComment'=>int)
Source Code: /application/classes/modules/comment/Comment.class.php#763 (show)
protected function BuildCommentsRecursive($aComments$bBegin true)
{
    static 
$aResultCommnets;
    static 
$iLevel;
    static 
$iMaxIdComment;
    if (
$bBegin) {
        
$aResultCommnets = array();
        
$iLevel 0;
        
$iMaxIdComment 0;
    }
    foreach (
$aComments as $aComment) {
        
$aTemp $aComment;
        if (
$aComment['comment_id'] > $iMaxIdComment) {
            
$iMaxIdComment $aComment['comment_id'];
        }
        
$aTemp['level'] = $iLevel;
        unset(
$aTemp['childNodes']);
        
$aResultCommnets[$aTemp['comment_id']] = $aTemp['level'];
        if (isset(
$aComment['childNodes']) and count($aComment['childNodes']) > 0) {
            
$iLevel++;
            
$this->BuildCommentsRecursive($aComment['childNodes'], false);
        }
    }
    
$iLevel--;
    return array(
'comments' => $aResultCommnets'iMaxIdComment' => $iMaxIdComment);
}

Строит дерево комментариев

DeleteCommentByTargetId() method
public bool DeleteCommentByTargetId(array|int $aTargetId, string $sTargetType)
$aTargetId array|int Список ID владельцев
$sTargetType string Тип владельцев
{return} bool
Source Code: /application/classes/modules/comment/Comment.class.php#915 (show)
public function DeleteCommentByTargetId($aTargetId$sTargetType)
{
    if (!
is_array($aTargetId)) {
        
$aTargetId = array($aTargetId);
    }
    
/**
     * Получаем список идентификаторов удаляемых комментариев
     */
    
$aCommentsId = array();
    foreach (
$aTargetId as $sTargetId) {
        
$aComments $this->GetCommentsByTargetId($sTargetId$sTargetType);
        
$aCommentsId array_merge($aCommentsIdarray_keys($aComments['comments']));
    }
    
/**
     * Если ни одного комментария не найдено, выходим
     */
    
if (!count($aCommentsId)) {
        return 
true;
    }
    
/**
     * Чистим зависимые кеши
     */
    
if (Config::Get('sys.cache.solid')) {
        
$this->Cache_Clean(Zend_Cache::CLEANING_MODE_MATCHING_TAG,
            array(
"comment_update""comment_target_{$sTargetId}_{$sTargetType}"));
    } else {
        
$this->Cache_Clean(Zend_Cache::CLEANING_MODE_MATCHING_TAG,
            array(
"comment_target_{$sTargetId}_{$sTargetType}"));
        
/**
         * Удаляем кеш для каждого комментария
         */
        
foreach ($aCommentsId as $iCommentId) {
            
$this->Cache_Delete("comment_{$iCommentId}");
        }
    }
    if (
$this->oMapper->DeleteCommentByTargetId($aTargetId$sTargetType)) {
        
/**
         * Удаляем комментарии из избранного
         */
        
$this->DeleteFavouriteCommentsByArrayId($aCommentsId);
        
/**
         * Удаляем комментарии к топику из прямого эфира
         */
        
$this->DeleteCommentOnlineByArrayId($aCommentsId$sTargetType);
        
/**
         * Удаляем голосование за комментарии
         */
        
$this->Vote_DeleteVoteByTarget($aCommentsId'comment');
        return 
true;
    }
    return 
false;
}

Удаляет комментарии из базы данных

DeleteCommentOnlineByArrayId() method
public bool DeleteCommentOnlineByArrayId(array|int $aCommentId, string $sTargetType)
$aCommentId array|int
$sTargetType string Тип владельцев
{return} bool
Source Code: /application/classes/modules/comment/Comment.class.php#975 (show)
public function DeleteCommentOnlineByArrayId($aCommentId$sTargetType)
{
    if (!
is_array($aCommentId)) {
        
$aCommentId = array($aCommentId);
    }
    
/**
     * Чистим кеш
     */
    
$this->Cache_Clean(Zend_Cache::CLEANING_MODE_MATCHING_TAG, array("comment_online_update_{$sTargetType}"));
    return 
$this->oMapper->DeleteCommentOnlineByArrayId($aCommentId$sTargetType);
}

Удаляет коммент из прямого эфира по массиву переданных идентификаторов

DeleteCommentOnlineByTargetId() method
public bool DeleteCommentOnlineByTargetId(int $sTargetId, string $sTargetType)
$sTargetId int ID владельца коммента
$sTargetType string Тип владельца комментария
{return} bool
Source Code: /application/classes/modules/comment/Comment.class.php#678 (show)
public function DeleteCommentOnlineByTargetId($sTargetId$sTargetType)
{
    
$this->Cache_Clean(Zend_Cache::CLEANING_MODE_MATCHING_TAG, array("comment_online_update_{$sTargetType}"));
    return 
$this->oMapper->DeleteCommentOnlineByTargetId($sTargetId$sTargetType);
}

Удаляет коммент из прямого эфира

DeleteFavouriteComment() method
public bool DeleteFavouriteComment(ModuleFavourite_EntityFavourite $oFavourite)
$oFavourite ModuleFavourite_EntityFavourite Объект избранного
{return} bool
Source Code: /application/classes/modules/comment/Comment.class.php#886 (show)
public function DeleteFavouriteComment(ModuleFavourite_EntityFavourite $oFavourite)
{
    if ((
$oFavourite->getTargetType() == 'comment')
        && (
$oComment $this->Comment_GetCommentById($oFavourite->getTargetId()))
        && 
in_array($oComment->getTargetType(), Config::get('module.comment.favourite_target_allow'))
    ) {
        return 
$this->Favourite_DeleteFavourite($oFavourite);
    }
    return 
false;
}

Удаляет комментарий из избранного

DeleteFavouriteCommentsByArrayId() method
public bool DeleteFavouriteCommentsByArrayId(array $aCommentId)
$aCommentId array Список ID комментариев
{return} bool
Source Code: /application/classes/modules/comment/Comment.class.php#903 (show)
public function DeleteFavouriteCommentsByArrayId($aCommentId)
{
    return 
$this->Favourite_DeleteFavouriteByTargetId($aCommentId'comment');
}

Удаляет комментарии из избранного по списку

GetCommentById() method
public ModuleComment_EntityComment|null GetCommentById(int $sId)
$sId int ID комментария
{return} ModuleComment_EntityComment|null
Source Code: /application/classes/modules/comment/Comment.class.php#59 (show)
public function GetCommentById($sId)
{
    if (!
is_numeric($sId)) {
        return 
null;
    }
    
$aComments $this->GetCommentsAdditionalData($sId);
    if (isset(
$aComments[$sId])) {
        return 
$aComments[$sId];
    }
    return 
null;
}

Получить коммент по айдишнику

GetCommentItemsByArrayId() method
public array GetCommentItemsByArrayId(array $aCommentId)
$aCommentId array Список ID комментариев
{return} array
Source Code: /application/classes/modules/comment/Comment.class.php#1123 (show)
public function GetCommentItemsByArrayId($aCommentId)
{
    return 
$this->GetCommentsByArrayId($aCommentId);
}

Алиас для корректной работы ORM

GetCommentUnique() method
public ModuleComment_EntityComment|null GetCommentUnique(int $sTargetId, string $sTargetType, int $sUserId, int $sCommentPid, string $sHash)
$sTargetId int ID владельца комментария
$sTargetType string Тип владельца комментария
$sUserId int ID пользователя
$sCommentPid int ID родительского комментария
$sHash string Хеш строка текста комментария
{return} ModuleComment_EntityComment|null
Source Code: /application/classes/modules/comment/Comment.class.php#81 (show)
public function GetCommentUnique($sTargetId$sTargetType$sUserId$sCommentPid$sHash)
{
    
$sId $this->oMapper->GetCommentUnique($sTargetId$sTargetType$sUserId$sCommentPid$sHash);
    return 
$this->GetCommentById($sId);
}

Получает уникальный коммент, это помогает спастись от дублей комментов

GetCommentsAdditionalData() method
public array GetCommentsAdditionalData(array $aCommentId, array|null $aAllowData=NULL)
$aCommentId array Список ID комментов
$aAllowData array|null Список типов дополнительных данных, которые нужно получить для комментариев
{return} array
Source Code: /application/classes/modules/comment/Comment.class.php#126 (show)
public function GetCommentsAdditionalData($aCommentId$aAllowData null)
{
    if (
is_null($aAllowData)) {
        
$aAllowData = array('vote''target''favourite''user' => array());
    }
    
func_array_simpleflip($aAllowData);
    if (!
is_array($aCommentId)) {
        
$aCommentId = array($aCommentId);
    }
    
/**
     * Получаем комменты
     */
    
$aComments $this->GetCommentsByArrayId($aCommentId);
    
/**
     * Формируем ID дополнительных данных, которые нужно получить
     */
    
$aUserId = array();
    
$aTargetId = array('topic' => array(), 'talk' => array());
    foreach (
$aComments as $oComment) {
        if (isset(
$aAllowData['user'])) {
            
$aUserId[] = $oComment->getUserId();
        }
        if (isset(
$aAllowData['target'])) {
            
$aTargetId[$oComment->getTargetType()][] = $oComment->getTargetId();
        }
    }
    
/**
     * Получаем дополнительные данные
     */
    
$aUsers = isset($aAllowData['user']) && is_array($aAllowData['user']) ? $this->User_GetUsersAdditionalData($aUserId,
        
$aAllowData['user']) : $this->User_GetUsersAdditionalData($aUserId);
    
/**
     * В зависимости от типа target_type достаем данные
     */
    
$aTargets = array();
    
//$aTargets['topic']=isset($aAllowData['target']) && is_array($aAllowData['target']) ? $this->Topic_GetTopicsAdditionalData($aTargetId['topic'],$aAllowData['target']) : $this->Topic_GetTopicsAdditionalData($aTargetId['topic']);
    
$aTargets['topic'] = $this->Topic_GetTopicsAdditionalData($aTargetId['topic'],
        array(
'blog' => array('owner' => array()), 'user' => array()));
    
$aVote = array();
    if (isset(
$aAllowData['vote']) and $this->oUserCurrent) {
        
$aVote $this->Vote_GetVoteByArray($aCommentId'comment'$this->oUserCurrent->getId());
    }
    if (isset(
$aAllowData['favourite']) and $this->oUserCurrent) {
        
$aFavouriteComments $this->Favourite_GetFavouritesByArray($aCommentId'comment',
            
$this->oUserCurrent->getId());
    }
    
/**
     * Добавляем данные к результату
     */
    
foreach ($aComments as $oComment) {
        if (isset(
$aUsers[$oComment->getUserId()])) {
            
$oComment->setUser($aUsers[$oComment->getUserId()]);
        } else {
            
$oComment->setUser(null); // или $oComment->setUser(new ModuleUser_EntityUser());
        
}
        if (isset(
$aTargets[$oComment->getTargetType()][$oComment->getTargetId()])) {
            
$oComment->setTarget($aTargets[$oComment->getTargetType()][$oComment->getTargetId()]);
        } else {
            
$oComment->setTarget(null);
        }
        if (isset(
$aVote[$oComment->getId()])) {
            
$oComment->setVote($aVote[$oComment->getId()]);
        } else {
            
$oComment->setVote(null);
        }
        if (isset(
$aFavouriteComments[$oComment->getId()])) {
            
$oComment->setIsFavourite(true);
        } else {
            
$oComment->setIsFavourite(false);
        }
    }
    return 
$aComments;
}

Получает дополнительные данные(объекты) для комментов по их ID

GetCommentsAll() method
public array('collection'=>array,'count'=>int) GetCommentsAll(string $sTargetType, int $iPage, int $iPerPage, array $aExcludeTarget=array ( ), array $aExcludeParentTarget=array ( ))
$sTargetType string Тип владельца комментария
$iPage int Номер страницы
$iPerPage int Количество элементов на страницу
$aExcludeTarget array Список ID владельцев, которые необходимо исключить из выдачи
$aExcludeParentTarget array Список ID родителей владельцев, которые необходимо исключить из выдачи, например, исключить комментарии топиков к определенным блогам(закрытым)
{return} array('collection'=>array,'count'=>int)
Source Code: /application/classes/modules/comment/Comment.class.php#97 (show)
public function GetCommentsAll(
    
$sTargetType,
    
$iPage,
    
$iPerPage,
    
$aExcludeTarget = array(),
    
$aExcludeParentTarget = array()
) {
    
$s serialize($aExcludeTarget) . serialize($aExcludeParentTarget);
    if (
false === ($data $this->Cache_Get("comment_all_{$sTargetType}_{$iPage}_{$iPerPage}_{$s}"))) {
        
$data = array(
            
'collection' => $this->oMapper->GetCommentsAll($sTargetType$iCount$iPage$iPerPage,
                
$aExcludeTarget$aExcludeParentTarget),
            
'count'      => $iCount
        
);
        
$this->Cache_Set($data"comment_all_{$sTargetType}_{$iPage}_{$iPerPage}_{$s}",
            array(
"comment_new_{$sTargetType}""comment_update_status_{$sTargetType}"), 60 60 24 1);
    }
    
$data['collection'] = $this->GetCommentsAdditionalData($data['collection'],
        array(
'target''favourite''user' => array()));
    return 
$data;
}

Получить все комменты

GetCommentsByArrayId() method
public array GetCommentsByArrayId(array $aCommentId)
$aCommentId array Список ID комментариев
{return} array
Source Code: /application/classes/modules/comment/Comment.class.php#206 (show)
public function GetCommentsByArrayId($aCommentId)
{
    if (!
$aCommentId) {
        return array();
    }
    if (
Config::Get('sys.cache.solid')) {
        return 
$this->GetCommentsByArrayIdSolid($aCommentId);
    }
    if (!
is_array($aCommentId)) {
        
$aCommentId = array($aCommentId);
    }
    
$aCommentId array_unique($aCommentId);
    
$aComments = array();
    
$aCommentIdNotNeedQuery = array();
    
/**
     * Делаем мульти-запрос к кешу
     */
    
$aCacheKeys func_build_cache_keys($aCommentId'comment_');
    if (
false !== ($data $this->Cache_Get($aCacheKeys))) {
        
/**
         * Проверяем что досталось из кеша
         */
        
foreach ($aCacheKeys as $sValue => $sKey) {
            if (
array_key_exists($sKey$data)) {
                if (
$data[$sKey]) {
                    
$aComments[$data[$sKey]->getId()] = $data[$sKey];
                } else {
                    
$aCommentIdNotNeedQuery[] = $sValue;
                }
            }
        }
    }
    
/**
     * Смотрим каких комментов не было в кеше и делаем запрос в БД
     */
    
$aCommentIdNeedQuery array_diff($aCommentIdarray_keys($aComments));
    
$aCommentIdNeedQuery array_diff($aCommentIdNeedQuery$aCommentIdNotNeedQuery);
    
$aCommentIdNeedStore $aCommentIdNeedQuery;
    if (
$data $this->oMapper->GetCommentsByArrayId($aCommentIdNeedQuery)) {
        foreach (
$data as $oComment) {
            
/**
             * Добавляем к результату и сохраняем в кеш
             */
            
$aComments[$oComment->getId()] = $oComment;
            
$this->Cache_Set($oComment"comment_{$oComment->getId()}", array(), 60 60 24 4);
            
$aCommentIdNeedStore array_diff($aCommentIdNeedStore, array($oComment->getId()));
        }
    }
    
/**
     * Сохраняем в кеш запросы не вернувшие результата
     */
    
foreach ($aCommentIdNeedStore as $sId) {
        
$this->Cache_Set(null"comment_{$sId}", array(), 60 60 24 4);
    }
    
/**
     * Сортируем результат согласно входящему массиву
     */
    
$aComments func_array_sort_by_keys($aComments$aCommentId);
    return 
$aComments;
}

Список комментов по ID

GetCommentsByArrayIdSolid() method
public array GetCommentsByArrayIdSolid(array $aCommentId)
$aCommentId array Список ID комментариев
{return} array
Source Code: /application/classes/modules/comment/Comment.class.php#273 (show)
public function GetCommentsByArrayIdSolid($aCommentId)
{
    if (!
is_array($aCommentId)) {
        
$aCommentId = array($aCommentId);
    }
    
$aCommentId array_unique($aCommentId);
    
$aComments = array();
    
$s join(','$aCommentId);
    if (
false === ($data $this->Cache_Get("comment_id_{$s}"))) {
        
$data $this->oMapper->GetCommentsByArrayId($aCommentId);
        foreach (
$data as $oComment) {
            
$aComments[$oComment->getId()] = $oComment;
        }
        
$this->Cache_Set($aComments"comment_id_{$s}", array("comment_update"), 60 60 24 1);
        return 
$aComments;
    }
    return 
$data;
}

Получает список комментариев по ID используя единый кеш

GetCommentsByFilter() method
public array GetCommentsByFilter(array $aFilter, array $aOrder, int $iCurrPage, int $iPerPage, array $aAllowData=NULL)
$aFilter array Фильтр выборки
$aOrder array Сортировка
$iCurrPage int Номер текущей страницы
$iPerPage int Количество элементов на одну страницу
$aAllowData array Список типов данных, которые нужно подтянуть к списку комментов
{return} array
Source Code: /application/classes/modules/comment/Comment.class.php#1108 (show)
public function GetCommentsByFilter($aFilter$aOrder$iCurrPage$iPerPage$aAllowData null)
{
    if (
is_null($aAllowData)) {
        
$aAllowData = array('target''user' => array());
    }
    
$aCollection $this->oMapper->GetCommentsByFilter($aFilter$aOrder$iCount$iCurrPage$iPerPage);
    return array(
'collection' => $this->GetCommentsAdditionalData($aCollection$aAllowData), 'count' => $iCount);
}

Получает список комментариев по фильтру

GetCommentsByTargetId() method
public array('comments'=>array,'iMaxIdComment'=>int) GetCommentsByTargetId(int $sId, string $sTargetType, int $iPage=1, int $iPerPage=0)
$sId int ID владельца коммента
$sTargetType string Тип владельца комментария
$iPage int Номер страницы
$iPerPage int Количество элементов на страницу
{return} array('comments'=>array,'iMaxIdComment'=>int)
Source Code: /application/classes/modules/comment/Comment.class.php#419 (show)
public function GetCommentsByTargetId($sId$sTargetType$iPage 1$iPerPage 0)
{
    if (
Config::Get('module.comment.use_nested')) {
        return 
$this->GetCommentsTreeByTargetId($sId$sTargetType$iPage$iPerPage);
    }

    if (
false === ($aCommentsRec $this->Cache_Get("comment_target_{$sId}_{$sTargetType}"))) {
        
$aCommentsRow $this->oMapper->GetCommentsByTargetId($sId$sTargetType);
        if (
count($aCommentsRow)) {
            
$aCommentsRec $this->BuildCommentsRecursive($aCommentsRow);
        }
        
$this->Cache_Set($aCommentsRec"comment_target_{$sId}_{$sTargetType}",
            array(
"comment_new_{$sTargetType}_{$sId}"), 60 60 24 2);
    }
    if (!isset(
$aCommentsRec['comments'])) {
        return array(
'comments' => array(), 'iMaxIdComment' => 0);
    }
    
$aComments $aCommentsRec;
    
$aComments['comments'] = $this->GetCommentsAdditionalData(array_keys($aCommentsRec['comments']));
    foreach (
$aComments['comments'] as $oComment) {
        
$oComment->setLevel($aCommentsRec['comments'][$oComment->getId()]);
    }
    return 
$aComments;

}

Получить комменты по владельцу

GetCommentsByUserId() method
public array GetCommentsByUserId(int $sId, string $sTargetType, int $iPage, int $iPerPage)
$sId int ID пользователя
$sTargetType string Тип владельца комментария
$iPage int Номер страницы
$iPerPage int Количество элементов на страницу
{return} array
Source Code: /application/classes/modules/comment/Comment.class.php#328 (show)
public function GetCommentsByUserId($sId$sTargetType$iPage$iPerPage)
{
    
/**
     * Исключаем из выборки идентификаторы закрытых блогов
     */
    
$aCloseBlogs = ($this->oUserCurrent && $sId == $this->oUserCurrent->getId())
        ? array()
        : 
$this->Blog_GetInaccessibleBlogsByUser();
    
$s serialize($aCloseBlogs);

    if (
false === ($data $this->Cache_Get("comment_user_{$sId}_{$sTargetType}_{$iPage}_{$iPerPage}_{$s}"))) {
        
$data = array(
            
'collection' => $this->oMapper->GetCommentsByUserId($sId$sTargetType$iCount$iPage$iPerPage,
                array(), 
$aCloseBlogs),
            
'count'      => $iCount
        
);
        
$this->Cache_Set($data"comment_user_{$sId}_{$sTargetType}_{$iPage}_{$iPerPage}_{$s}",
            array(
"comment_new_user_{$sId}_{$sTargetType}""comment_update_status_{$sTargetType}"),
            
60 60 24 2);
    }
    
$data['collection'] = $this->GetCommentsAdditionalData($data['collection']);
    return 
$data;
}

Получить комменты по юзеру

GetCommentsFavouriteByUserId() method
public array GetCommentsFavouriteByUserId(int $sUserId, int $iCurrPage, int $iPerPage)
$sUserId int ID пользователя
$iCurrPage int Номер страницы
$iPerPage int Количество элементов на страницу
{return} array
Source Code: /application/classes/modules/comment/Comment.class.php#834 (show)
public function GetCommentsFavouriteByUserId($sUserId$iCurrPage$iPerPage)
{
    
$aCloseTopics = array();
    
/**
     * Получаем список идентификаторов избранных комментов
     */
    
$data = ($this->oUserCurrent && $sUserId == $this->oUserCurrent->getId())
        ? 
$this->Favourite_GetFavouritesByUserId($sUserId'comment'$iCurrPage$iPerPage$aCloseTopics)
        : 
$this->Favourite_GetFavouriteOpenCommentsByUserId($sUserId$iCurrPage$iPerPage);
    
/**
     * Получаем комменты по переданому массиву айдишников
     */
    
$data['collection'] = $this->GetCommentsAdditionalData($data['collection']);
    return 
$data;
}

Получает список комментариев из избранного пользователя

GetCommentsNewByTargetId() method
public array('comments'=>array,'iMaxIdComment'=>int) GetCommentsNewByTargetId(int $sId, string $sTargetType, int $sIdCommentLast)
$sId int ID владельца коммента
$sTargetType string Тип владельца комментария
$sIdCommentLast int ID последнего прочитанного комментария
{return} array('comments'=>array,'iMaxIdComment'=>int)
Source Code: /application/classes/modules/comment/Comment.class.php#705 (show)
public function GetCommentsNewByTargetId($sId$sTargetType$sIdCommentLast)
{
    if (
false === ($aComments $this->Cache_Get("comment_target_{$sId}_{$sTargetType}_{$sIdCommentLast}"))) {
        
$aComments $this->oMapper->GetCommentsNewByTargetId($sId$sTargetType$sIdCommentLast);
        
$this->Cache_Set($aComments"comment_target_{$sId}_{$sTargetType}_{$sIdCommentLast}",
            array(
"comment_new_{$sTargetType}_{$sId}"), 60 60 24 1);
    }
    if (
count($aComments) == 0) {
        return array(
'comments' => array(), 'iMaxIdComment' => 0);
    }

    
$iMaxIdComment max($aComments);
    
$aCmts $this->GetCommentsAdditionalData($aComments);
    
$oViewerLocal $this->Viewer_GetLocalViewer();
    
$oViewerLocal->Assign('oUserCurrent'$this->User_GetUserCurrent());
    
$oViewerLocal->Assign('bOneComment'true);
    if (
$sTargetType != 'topic') {
        
$oViewerLocal->Assign('bNoCommentFavourites'true);
    } elseif (
$sTargetType == 'topic') {
        
$oViewerLocal->Assign('bShowFavourite'truetrue);
        
$oViewerLocal->Assign('bShowVote'truetrue);
        
$oViewerLocal->Assign('bShowScroll'truetrue);
        
$oViewerLocal->Assign('bShowEdit'truetrue);
        
$oViewerLocal->Assign('sDateReadLast''1'true);
    }
    
$aCmt = array();
    foreach (
$aCmts as $oComment) {
        
$oViewerLocal->Assign('oComment'$oCommenttrue);
        
$oViewerLocal->Assign('bIsHidden'$oComment->getDelete(), true);
        
$sText $oViewerLocal->Fetch($this->GetTemplateCommentByTarget($sId$sTargetType));
        
$aCmt[] = array(
            
'html' => $sText,
            
'obj'  => $oComment,
        );
    }
    return array(
'comments' => $aCmt'iMaxIdComment' => $iMaxIdComment);
}

Получить новые комменты для владельца

GetCommentsOnline() method
public array GetCommentsOnline(string $sTargetType, int $iLimit)
$sTargetType string Тип владельца комментария
$iLimit int Количество элементов
{return} array
Source Code: /application/classes/modules/comment/Comment.class.php#299 (show)
public function GetCommentsOnline($sTargetType$iLimit)
{
    
/**
     * Исключаем из выборки идентификаторы закрытых блогов (target_parent_id)
     */
    
$aCloseBlogs = ($this->oUserCurrent)
        ? 
$this->Blog_GetInaccessibleBlogsByUser($this->oUserCurrent)
        : 
$this->Blog_GetInaccessibleBlogsByUser();

    
$s serialize($aCloseBlogs);

    if (
false === ($data $this->Cache_Get("comment_online_{$sTargetType}_{$s}_{$iLimit}"))) {
        
$data $this->oMapper->GetCommentsOnline($sTargetType$aCloseBlogs$iLimit);
        
$this->Cache_Set($data"comment_online_{$sTargetType}_{$s}_{$iLimit}",
            array(
"comment_online_update_{$sTargetType}"), 60 60 24 1);
    }
    
$data $this->GetCommentsAdditionalData($data);
    return 
$data;
}

Получить все комменты сгрупированные по типу(для вывода прямого эфира)

GetCommentsRatingByDate() method
public array GetCommentsRatingByDate(string $sDate, string $sTargetType, int $iLimit=20)
$sDate string Дата за которую выводить рейтинг, т.к. кеширование происходит по дате, то дату лучше передавать с точностью до часа (минуты и секунды как 00:00)
$sTargetType string Тип владельца комментария
$iLimit int Количество элементов
{return} array
Source Code: /application/classes/modules/comment/Comment.class.php#386 (show)
public function GetCommentsRatingByDate($sDate$sTargetType$iLimit 20)
{
    
/**
     * Выбираем топики, комметарии к которым являются недоступными для пользователя
     */
    
$aCloseBlogs = ($this->oUserCurrent)
        ? 
$this->Blog_GetInaccessibleBlogsByUser($this->oUserCurrent)
        : 
$this->Blog_GetInaccessibleBlogsByUser();
    
$s serialize($aCloseBlogs);
    
/**
     * Т.к. время передаётся с точностью 1 час то можно по нему замутить кеширование
     */
    
if (false === ($data $this->Cache_Get("comment_rating_{$sDate}_{$sTargetType}_{$iLimit}_{$s}"))) {
        
$data $this->oMapper->GetCommentsRatingByDate($sDate$sTargetType$iLimit, array(), $aCloseBlogs);
        
$this->Cache_Set($data"comment_rating_{$sDate}_{$sTargetType}_{$iLimit}_{$s}", array(
                
"comment_new_{$sTargetType}",
                
"comment_update_status_{$sTargetType}",
                
"comment_update_rating_{$sTargetType}"
            
), 60 60 24 2);
    }
    
$data $this->GetCommentsAdditionalData($data);
    return 
$data;
}

Получить комменты по рейтингу и дате

GetCommentsTreeByTargetId() method
public array('comments'=>array,'iMaxIdComment'=>int,'count'=>int) GetCommentsTreeByTargetId(int $sId, string $sTargetType, int $iPage=1, int $iPerPage=0)
$sId int ID владельца коммента
$sTargetType string Тип владельца комментария
$iPage int Номер страницы
$iPerPage int Количество элементов на страницу
{return} array('comments'=>array,'iMaxIdComment'=>int,'count'=>int)
Source Code: /application/classes/modules/comment/Comment.class.php#454 (show)
public function GetCommentsTreeByTargetId($sId$sTargetType$iPage 1$iPerPage 0)
{
    if (!
Config::Get('module.comment.nested_page_reverse') and $iPerPage and $iCountPage ceil($this->GetCountCommentsRootByTargetId($sId,
                
$sTargetType) / $iPerPage)
    ) {
        
$iPage $iCountPage $iPage 1;
    }
    
$iPage $iPage $iPage;
    if (
false === ($aReturn $this->Cache_Get("comment_tree_target_{$sId}_{$sTargetType}_{$iPage}_{$iPerPage}"))) {

        
/**
         * Нужно или нет использовать постраничное разбиение комментариев
         */
        
if ($iPerPage) {
            
$aComments $this->oMapper->GetCommentsTreePageByTargetId($sId$sTargetType$iCount$iPage,
                
$iPerPage);
        } else {
            
$aComments $this->oMapper->GetCommentsTreeByTargetId($sId$sTargetType);
            
$iCount count($aComments);
        }
        
$iMaxIdComment count($aComments) ? max($aComments) : 0;
        
$aReturn = array('comments' => $aComments'iMaxIdComment' => $iMaxIdComment'count' => $iCount);
        
$this->Cache_Set($aReturn"comment_tree_target_{$sId}_{$sTargetType}_{$iPage}_{$iPerPage}",
            array(
"comment_new_{$sTargetType}_{$sId}"), 60 60 24 2);
    }
    
$aReturn['comments'] = $this->GetCommentsAdditionalData($aReturn['comments']);
    return 
$aReturn;
}

Получает комменты используя nested set

GetCountCommentsByUserId() method
public int GetCountCommentsByUserId(id $sId, string $sTargetType)
$sId id ID пользователя
$sTargetType string Тип владельца комментария
{return} int
Source Code: /application/classes/modules/comment/Comment.class.php#359 (show)
public function GetCountCommentsByUserId($sId$sTargetType)
{
    
/**
     * Исключаем из выборки идентификаторы закрытых блогов
     */
    
$aCloseBlogs = ($this->oUserCurrent && $sId == $this->oUserCurrent->getId())
        ? array()
        : 
$this->Blog_GetInaccessibleBlogsByUser();
    
$s serialize($aCloseBlogs);

    if (
false === ($data $this->Cache_Get("comment_count_user_{$sId}_{$sTargetType}_{$s}"))) {
        
$data $this->oMapper->GetCountCommentsByUserId($sId$sTargetType, array(), $aCloseBlogs);
        
$this->Cache_Set($data"comment_count_user_{$sId}_{$sTargetType}_{$s}",
            array(
"comment_new_user_{$sId}_{$sTargetType}""comment_update_status_{$sTargetType}"),
            
60 60 24 2);
    }
    return 
$data;
}

Получает количество комментариев одного пользователя

GetCountCommentsFavouriteByUserId() method
public int GetCountCommentsFavouriteByUserId(int $sUserId)
$sUserId int ID пользователя
{return} int
Source Code: /application/classes/modules/comment/Comment.class.php#856 (show)
public function GetCountCommentsFavouriteByUserId($sUserId)
{
    return (
$this->oUserCurrent && $sUserId == $this->oUserCurrent->getId())
        ? 
$this->Favourite_GetCountFavouritesByUserId($sUserId'comment')
        : 
$this->Favourite_GetCountFavouriteOpenCommentsByUserId($sUserId);
}

Возвращает число комментариев в избранном

GetCountCommentsRootByTargetId() method
public int GetCountCommentsRootByTargetId(int $sId, string $sTargetType)
$sId int ID владельца коммента
$sTargetType string Тип владельца комментария
{return} int
Source Code: /application/classes/modules/comment/Comment.class.php#490 (show)
public function GetCountCommentsRootByTargetId($sId$sTargetType)
{
    return 
$this->oMapper->GetCountCommentsRootByTargetId($sId$sTargetType);
}

Возвращает количество дочерних комментариев у корневого коммента

GetFavouriteComment() method
public ModuleFavourite_EntityFavourite|null GetFavouriteComment(int $sCommentId, int $sUserId)
$sCommentId int ID комментария
$sUserId int ID пользователя
{return} ModuleFavourite_EntityFavourite|null
Source Code: /application/classes/modules/comment/Comment.class.php#797 (show)
public function GetFavouriteComment($sCommentId$sUserId)
{
    return 
$this->Favourite_GetFavourite($sCommentId'comment'$sUserId);
}

Получает привязку комментария к ибранному(добавлен ли коммент в избранное у юзера)

GetFavouriteCommentsByArray() method
public array GetFavouriteCommentsByArray(array $aCommentId, int $sUserId)
$aCommentId array Список ID комментов
$sUserId int ID пользователя
{return} array
Source Code: /application/classes/modules/comment/Comment.class.php#809 (show)
public function GetFavouriteCommentsByArray($aCommentId$sUserId)
{
    return 
$this->Favourite_GetFavouritesByArray($aCommentId'comment'$sUserId);
}

Получить список избранного по списку айдишников

GetFavouriteCommentsByArraySolid() method
public array GetFavouriteCommentsByArraySolid(array $aCommentId, int $sUserId)
$aCommentId array Список ID комментов
$sUserId int ID пользователя
{return} array
Source Code: /application/classes/modules/comment/Comment.class.php#821 (show)
public function GetFavouriteCommentsByArraySolid($aCommentId$sUserId)
{
    return 
$this->Favourite_GetFavouritesByArraySolid($aCommentId'comment'$sUserId);
}

Получить список избранного по списку айдишников, но используя единый кеш

GetPageCommentByTargetId() method
public bool|int GetPageCommentByTargetId(int $sId, string $sTargetType, ModuleComment_EntityComment $oComment)
$sId int ID владельца коммента
$sTargetType string Тип владельца комментария
$oComment ModuleComment_EntityComment Объект комментария
{return} bool|int
Source Code: /application/classes/modules/comment/Comment.class.php#503 (show)
public function GetPageCommentByTargetId($sId$sTargetType$oComment)
{
    if (!
Config::Get('module.comment.nested_per_page')) {
        return 
1;
    }
    if (
is_numeric($oComment)) {
        if (!(
$oComment $this->GetCommentById($oComment))) {
            return 
false;
        }
        if (
$oComment->getTargetId() != $sId or $oComment->getTargetType() != $sTargetType) {
            return 
false;
        }
    }
    
/**
     * Получаем корневого родителя
     */
    
if ($oComment->getPid()) {
        if (!(
$oCommentRoot $this->oMapper->GetCommentRootByTargetIdAndChildren($sId$sTargetType,
            
$oComment->getLeft()))
        ) {
            return 
false;
        }
    } else {
        
$oCommentRoot $oComment;
    }
    
$iCount ceil($this->oMapper->GetCountCommentsAfterByTargetId($sId$sTargetType,
            
$oCommentRoot->getLeft()) / Config::Get('module.comment.nested_per_page'));

    if (!
Config::Get('module.comment.nested_page_reverse') and $iCountPage ceil($this->GetCountCommentsRootByTargetId($sId,
                
$sTargetType) / Config::Get('module.comment.nested_per_page'))
    ) {
        
$iCount $iCountPage $iCount 1;
    }
    return 
$iCount $iCount 1;
}

Возвращает номер страницы, на которой расположен комментарий

GetTemplateCommentByTarget() method
public string GetTemplateCommentByTarget(int $iTargetId, string $sTargetType)
$iTargetId int ID объекта комментирования
$sTargetType string Типа объекта комментирования
{return} string
Source Code: /application/classes/modules/comment/Comment.class.php#751 (show)
public function GetTemplateCommentByTarget($iTargetId$sTargetType)
{
    return 
"components/comment/comment.tpl";
}

Возвращает шаблон комментария для рендеринга Плагин может переопределить данный метод и вернуть свой шаблон в зависимости от типа

Init() method
public void Init()
Source Code: /application/classes/modules/comment/Comment.class.php#47 (show)
public function Init()
{
    
$this->oMapper Engine::GetMapper(__CLASS__);
    
$this->oUserCurrent $this->User_GetUserCurrent();
}

Инициализация

MoveTargetParent() method
public bool MoveTargetParent(int $sParentId, string $sTargetType, int $sParentIdNew)
$sParentId int Прежний ID родителя владельца
$sTargetType string Тип владельца
$sParentIdNew int Новый ID родителя владельца
{return} bool
Source Code: /application/classes/modules/comment/Comment.class.php#1033 (show)
public function MoveTargetParent($sParentId$sTargetType$sParentIdNew)
{
    
$this->Cache_Clean(Zend_Cache::CLEANING_MODE_MATCHING_TAG, array("comment_new_{$sTargetType}"));
    return 
$this->oMapper->MoveTargetParent($sParentId$sTargetType$sParentIdNew);
}

Меняет target parent на новый

MoveTargetParentOnline() method
public bool MoveTargetParentOnline(int $sParentId, string $sTargetType, int $sParentIdNew)
$sParentId int Прежний ID родителя владельца
$sTargetType string Тип владельца
$sParentIdNew int Новый ID родителя владельца
{return} bool
Source Code: /application/classes/modules/comment/Comment.class.php#1047 (show)
public function MoveTargetParentOnline($sParentId$sTargetType$sParentIdNew)
{
    
$this->Cache_Clean(Zend_Cache::CLEANING_MODE_MATCHING_TAG, array("comment_online_update_{$sTargetType}"));
    return 
$this->oMapper->MoveTargetParentOnline($sParentId$sTargetType$sParentIdNew);
}

Меняет target parent на новый в прямом эфире

RecalculateFavourite() method
public bool RecalculateFavourite()
{return} bool
Source Code: /application/classes/modules/comment/Comment.class.php#1093 (show)
public function RecalculateFavourite()
{
    return 
$this->oMapper->RecalculateFavourite();
}

Пересчитывает счетчик избранных комментариев

RestoreTree() method
public void RestoreTree(int $aTargetId=NULL, string $sTargetType=NULL)
$aTargetId int Список ID владельцев
$sTargetType string Тип владельца
Source Code: /application/classes/modules/comment/Comment.class.php#1060 (show)
public function RestoreTree($aTargetId null$sTargetType null)
{
    
// обработать конкретную сущность
    
if (!is_null($aTargetId) and !is_null($sTargetType)) {
        
$this->oMapper->RestoreTree(null0, -1$aTargetId$sTargetType);
        return;
    }
    
$aType = array();
    
// обработать все сущности конкретного типа
    
if (!is_null($sTargetType)) {
        
$aType[] = $sTargetType;
    } else {
        
// обработать все сущности всех типов
        
$aType $this->oMapper->GetCommentTypes();
    }
    foreach (
$aType as $sTargetType) {
        
// для каждого типа получаем порциями ID сущностей
        
$iPage 1;
        
$iPerPage 50;
        while (
$aResult $this->oMapper->GetTargetIdByType($sTargetType$iPage$iPerPage)) {
            foreach (
$aResult as $Row) {
                
$this->oMapper->RestoreTree(null0, -1$Row['target_id'], $sTargetType);
            }
            
$iPage++;
        }
    }
}

Перестраивает дерево комментариев Восстанавливает значения left, right и level

SetCommentsPublish() method
public bool SetCommentsPublish(int $sTargetId, string $sTargetType, int $iPublish)
$sTargetId int ID владельца коммента
$sTargetType string Тип владельца комментария
$iPublish int Статус отображать комментарии или нет
{return} bool
Source Code: /application/classes/modules/comment/Comment.class.php#647 (show)
public function SetCommentsPublish($sTargetId$sTargetType$iPublish)
{
    if (!
$aComments $this->GetCommentsByTargetId($sTargetId$sTargetType)) {
        return 
false;
    }
    if (!isset(
$aComments['comments']) or count($aComments['comments']) == 0) {
        return;
    }

    
$this->Cache_Clean(Zend_Cache::CLEANING_MODE_MATCHING_TAG, array("comment_update_status_{$sTargetType}"));
    
/**
     * Если статус публикации успешно изменен, то меняем статус в отметке "избранное".
     * Если комментарии снимаются с публикации, удаляем их из прямого эфира.
     */
    
if ($this->oMapper->SetCommentsPublish($sTargetId$sTargetType$iPublish)) {
        
$this->Favourite_SetFavouriteTargetPublish(array_keys($aComments['comments']), 'comment'$iPublish);
        if (
$iPublish != 1) {
            
$this->DeleteCommentOnlineByTargetId($sTargetId$sTargetType);
        }
        return 
true;
    }
    return 
false;
}

Устанавливает publish у коммента

UpdateComment() method
public bool UpdateComment(ModuleComment_EntityComment $oComment)
$oComment ModuleComment_EntityComment Объект комментария
{return} bool
Source Code: /application/classes/modules/comment/Comment.class.php#576 (show)
public function UpdateComment(ModuleComment_EntityComment $oComment)
{
    if (
$this->oMapper->UpdateComment($oComment)) {
        
//чистим зависимые кеши
        
$this->Cache_Clean(Zend_Cache::CLEANING_MODE_MATCHING_TAG,
            array(
"comment_update""comment_update_{$oComment->getTargetType()}_{$oComment->getTargetId()}"));
        
$this->Cache_Delete("comment_{$oComment->getId()}");
        return 
true;
    }
    return 
false;
}

Обновляет коммент

UpdateCommentRating() method
public bool UpdateCommentRating(ModuleComment_EntityComment $oComment)
$oComment ModuleComment_EntityComment Объект комментария
{return} bool
Source Code: /application/classes/modules/comment/Comment.class.php#594 (show)
public function UpdateCommentRating(ModuleComment_EntityComment $oComment)
{
    if (
$this->oMapper->UpdateComment($oComment)) {
        
//чистим зависимые кеши
        
$this->Cache_Clean(Zend_Cache::CLEANING_MODE_MATCHING_TAG,
            array(
"comment_update_rating_{$oComment->getTargetType()}"));
        
$this->Cache_Delete("comment_{$oComment->getId()}");
        return 
true;
    }
    return 
false;
}

Обновляет рейтинг у коммента

UpdateCommentStatus() method
public bool UpdateCommentStatus(ModuleComment_EntityComment $oComment)
$oComment ModuleComment_EntityComment Объект комментария
{return} bool
Source Code: /application/classes/modules/comment/Comment.class.php#612 (show)
public function UpdateCommentStatus(ModuleComment_EntityComment $oComment)
{
    if (
$this->oMapper->UpdateComment($oComment)) {
        
/**
         * Если комментарий удаляется, удаляем его из прямого эфира
         */
        
if ($oComment->getDelete()) {
            
$this->DeleteCommentOnlineByArrayId($oComment->getId(), $oComment->getTargetType());
        }
        
/**
         * Обновляем избранное
         */
        
$this->Favourite_SetFavouriteTargetPublish($oComment->getId(), 'comment', !$oComment->getDelete());
        
/**
         * Чистим зависимые кеши
         */
        
if (Config::Get('sys.cache.solid')) {
            
$this->Cache_Clean(Zend_Cache::CLEANING_MODE_MATCHING_TAG, array("comment_update"));
        }
        
$this->Cache_Clean(Zend_Cache::CLEANING_MODE_MATCHING_TAG,
            array(
"comment_update_status_{$oComment->getTargetType()}"));
        
$this->Cache_Delete("comment_{$oComment->getId()}");
        return 
true;
    }
    return 
false;
}

Обновляет статус у коммента - delete или publish

UpdateTargetParentByTargetId() method
public bool UpdateTargetParentByTargetId(int $sParentId, string $sTargetType, array|int $aTargetId)
$sParentId int Новый ID родителя владельца
$sTargetType string Тип владельца
$aTargetId array|int Список ID владельцев
{return} bool
Source Code: /application/classes/modules/comment/Comment.class.php#995 (show)
public function UpdateTargetParentByTargetId($sParentId$sTargetType$aTargetId)
{
    if (!
is_array($aTargetId)) {
        
$aTargetId = array($aTargetId);
    }
    
// чистим зависимые кеши
    
$this->Cache_Clean(Zend_Cache::CLEANING_MODE_MATCHING_TAG, array("comment_new_{$sTargetType}"));

    return 
$this->oMapper->UpdateTargetParentByTargetId($sParentId$sTargetType$aTargetId);
}

Меняем target parent по массиву идентификаторов

UpdateTargetParentByTargetIdOnline() method
public bool UpdateTargetParentByTargetIdOnline(int $sParentId, string $sTargetType, array|int $aTargetId)
$sParentId int Новый ID родителя владельца
$sTargetType string Тип владельца
$aTargetId array|int Список ID владельцев
{return} bool
Source Code: /application/classes/modules/comment/Comment.class.php#1014 (show)
public function UpdateTargetParentByTargetIdOnline($sParentId$sTargetType$aTargetId)
{
    if (!
is_array($aTargetId)) {
        
$aTargetId = array($aTargetId);
    }
    
// чистим зависимые кеши
    
$this->Cache_Clean(Zend_Cache::CLEANING_MODE_MATCHING_TAG, array("comment_online_update_{$sTargetType}"));

    return 
$this->oMapper->UpdateTargetParentByTargetIdOnline($sParentId$sTargetType$aTargetId);
}

Меняем target parent по массиву идентификаторов в таблице комментариев online