Prevent deleting a list if attached to a form

[MAILPOET-3661]
This commit is contained in:
Brezo Cordero
2021-07-28 23:45:54 -05:00
committed by Veljko V
parent 6dc0c62640
commit d9186e4230
4 changed files with 107 additions and 4 deletions

View File

@@ -27,6 +27,20 @@ class FormsRepository extends Repository {
->getResult();
}
public function getNamesOfFormsForSegments(): array {
$allNonDeletedForms = $this->findAllNotDeleted();
$nameMap = [];
foreach ($allNonDeletedForms as $form) {
$blockSegmentsIds = $form->getSettingsSegmentIds();
foreach ($blockSegmentsIds as $blockSegmentId) {
$nameMap[(string)$blockSegmentId][] = $form->getName();
}
}
return $nameMap;
}
public function count(): int {
return (int)$this->doctrineRepository
->createQueryBuilder('f')