From 2af4b8e04e1796479b1f9ea5e25ab5ff63088920 Mon Sep 17 00:00:00 2001 From: Ryan Prather Date: Tue, 21 Jan 2025 14:09:21 -0500 Subject: [PATCH] fix: CaseController migrate documents to MemberController add link to new case message --- src/Controller/CaseController.php | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/src/Controller/CaseController.php b/src/Controller/CaseController.php index b6808cf..0b77adf 100644 --- a/src/Controller/CaseController.php +++ b/src/Controller/CaseController.php @@ -101,8 +101,10 @@ class CaseController extends AbstractController } $case = $this->entityManager->getRepository(MemberCase::class)->find($caseId); - $caseDocs = $this->entityManager->getRepository(CaseDocument::class)->getDocumentsByCase($case); - $compDocs = $this->entityManager->getRepository(CompanyDocument::class)->findBy(['company' => $user->getCompany()]); + + /** @todo validate user has access to case, check for admin, case manager of case worker */ + //$uc = $this->entityManager->getRepository(UserCase::class) + $sources = $this->entityManager->getRepository(ReferralSource::class)->findAll(); return $this->render( @@ -111,8 +113,6 @@ class CaseController extends AbstractController $this->navLinks, [ 'case' => $case, - 'caseDocs' => $caseDocs, - 'compDocs' => $compDocs, 'sources' => $sources, 'breadcrumbs' => [ new Breadcrumb($this->generateUrl('app_list_cases'), 'List Cases'), @@ -129,9 +129,8 @@ class CaseController extends AbstractController { $this->denyAccessUnlessGranted('ROLE_ADMIN'); - $companyDocs = $this->entityManager->getRepository(CompanyDocument::class)->findBy(['company' => $admin->getCompany()]); $case = new MemberCase(); - $form = $this->createForm(MemberCaseFormType::class, $case, ['docs' => $companyDocs]); + $form = $this->createForm(MemberCaseFormType::class); $form->handleRequest($request); @@ -159,7 +158,6 @@ class CaseController extends AbstractController 'notifications' => Libs::getMessages($admin, $this->entityManager), 'form' => $form, 'sources' => $this->entityManager->getRepository(ReferralSource::class)->retrieveOrderedList(), - 'docs' => $companyDocs, ] ) ); @@ -227,7 +225,11 @@ class CaseController extends AbstractController $this->entityManager->flush(); } - $msg = MessageFactory::createNewCase($admin, $user); + $msg = MessageFactory::createNewCase( + $admin, + $user, + $this->generateUrl('app_view_case', ['caseId' => $case->getId()->toString()]) + ); $this->entityManager->persist($uc); $this->entityManager->persist($msg);