|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
declare(strict_types=1); |
|
4
|
|
|
|
|
5
|
|
|
namespace Stu\Component\Admin\Reset\Communication; |
|
6
|
|
|
|
|
7
|
|
|
use Doctrine\ORM\EntityManagerInterface; |
|
8
|
|
|
use Stu\Orm\Repository\ContactRepositoryInterface; |
|
9
|
|
|
use Stu\Orm\Repository\PrivateMessageFolderRepositoryInterface; |
|
10
|
|
|
use Stu\Orm\Repository\PrivateMessageRepositoryInterface; |
|
11
|
|
|
|
|
12
|
|
|
final class PmReset implements PmResetInterface |
|
13
|
|
|
{ |
|
14
|
|
|
private PrivateMessageFolderRepositoryInterface $privateMessageFolderRepository; |
|
15
|
|
|
|
|
16
|
|
|
private PrivateMessageRepositoryInterface $privateMessageRepository; |
|
17
|
|
|
|
|
18
|
|
|
private ContactRepositoryInterface $contactRepository; |
|
19
|
|
|
|
|
20
|
|
|
private EntityManagerInterface $entityManager; |
|
21
|
|
|
|
|
22
|
|
|
public function __construct( |
|
23
|
|
|
PrivateMessageFolderRepositoryInterface $privateMessageFolderRepository, |
|
24
|
|
|
PrivateMessageRepositoryInterface $privateMessageRepository, |
|
25
|
|
|
ContactRepositoryInterface $contactRepository, |
|
26
|
|
|
EntityManagerInterface $entityManager |
|
27
|
|
|
) { |
|
28
|
|
|
$this->privateMessageFolderRepository = $privateMessageFolderRepository; |
|
29
|
|
|
$this->privateMessageRepository = $privateMessageRepository; |
|
30
|
|
|
$this->contactRepository = $contactRepository; |
|
31
|
|
|
$this->entityManager = $entityManager; |
|
32
|
|
|
} |
|
33
|
|
|
|
|
34
|
|
|
public function unsetAllInboxReferences(): void |
|
35
|
|
|
{ |
|
36
|
|
|
echo " - unset all inbox references\n"; |
|
37
|
|
|
|
|
38
|
|
|
$this->privateMessageRepository->unsetAllInboxReferences(); |
|
39
|
|
|
|
|
40
|
|
|
$this->entityManager->flush(); |
|
41
|
|
|
} |
|
42
|
|
|
|
|
43
|
|
|
public function resetAllNonNpcPmFolders(): void |
|
44
|
|
|
{ |
|
45
|
|
|
echo " - deleting all non npc pm folders\n"; |
|
46
|
|
|
|
|
47
|
|
|
$this->privateMessageFolderRepository->truncateAllNonNpcFolders(); |
|
48
|
|
|
|
|
49
|
|
|
$this->entityManager->flush(); |
|
50
|
|
|
} |
|
51
|
|
|
|
|
52
|
|
|
public function resetPms(): void |
|
53
|
|
|
{ |
|
54
|
|
|
echo " - deleting all pms\n"; |
|
55
|
|
|
|
|
56
|
|
|
$this->privateMessageRepository->truncateAllPrivateMessages(); |
|
57
|
|
|
|
|
58
|
|
|
$this->entityManager->flush(); |
|
59
|
|
|
} |
|
60
|
|
|
|
|
61
|
|
|
public function deleteAllContacts(): void |
|
62
|
|
|
{ |
|
63
|
|
|
echo " - deleting all contacts\n"; |
|
64
|
|
|
|
|
65
|
|
|
$this->contactRepository->truncateAllContacts(); |
|
66
|
|
|
|
|
67
|
|
|
$this->entityManager->flush(); |
|
68
|
|
|
} |
|
69
|
|
|
} |
|
70
|
|
|
|