public function deleteConverstionByUserId($userId) { $count = 1000; $first = 0; if (!empty($userId)) { $conversationList = array(); do { $conversationList = $this->conversationDao->getConversationListByUserId($userId, $first, $count); $conversationIdList = array(); foreach ($conversationList as $conversation) { $conversationIdList[$conversation['id']] = $conversation['id']; } if (!empty($conversationIdList)) { $this->conversationDao->deleteByIdList($conversationIdList); $this->deleteAttachmentsByConversationList($conversationIdList); } foreach ($conversationList as $conversation) { $conversationIdList[$conversation['id']] = $conversation['id']; $dto = new MAILBOX_BOL_Conversation(); $dto->id = $conversation['id']; $dto->initiatorId = $conversation['initiatorId']; $dto->interlocutorId = $conversation['interlocutorId']; $dto->subject = $conversation['subject']; $dto->read = $conversation['read']; $dto->deleted = $conversation['deleted']; $dto->createStamp = $conversation['createStamp']; $paramList = array('conversationDto' => $dto); $event = new OW_Event(self::EVENT_DELETE_CONVERSATION, $paramList); OW::getEventManager()->trigger($event); } $first += $count; } while (!empty($conversationList)); } }