monarc-project / MonarcAppFO

MONARC - Method for an Optimised aNAlysis of Risks by @NC3-LU
https://www.monarc.lu
GNU Affero General Public License v3.0
101 stars 39 forks source link

Export of the Statement of applicability (docx) is failing when there are controls without categories in the analysis #283

Closed cedricbonhomme closed 4 years ago

cedricbonhomme commented 4 years ago

Describe the bug Export of the Statement of applicability (docx) is failing when there are controls without categories in the analysis.

To Reproduce Steps to reproduce the behavior:

  1. Go to knowledge base, in the security referential tab delete some categorie from a security referential used in the statement of applicatbility
  2. Go to the statement of applicability
  3. Export it to docx
  4. See error

The error

Request URL:http://127.0.0.1:5001/api/client-anr/3/deliverable Request Method:POST Remote Address:127.0.0.1:5001 Status Code: 500

Response content

[{"errors":[{"message":"Call to a member function get() on null","error":"error-exception","exception":{"class":"Error","file":"/home/vagrant/monarc/vendor/monarc/frontoffice/src/Service/DeliverableGenerationService.php","line":2874,"message":"Call to a member function get() on null","stacktrace":"#0 /home/vagrant/monarc/vendor/monarc/frontoffice/src/Service/DeliverableGenerationService.php(908): Monarc\\FrontOffice\\Service\\DeliverableGenerationService->generateTableStatementOfApplicability(Object(DoctrineORMModule\\Proxy\\__CG__\\Monarc\\FrontOffice\\Model\\Entity\\Anr), '98ca84fb-db87-1...')\n#1 /home/vagrant/monarc/vendor/monarc/frontoffice/src/Service/DeliverableGenerationService.php(405): Monarc\\FrontOffice\\Service\\DeliverableGenerationService->buildStatementOfAppplicabilityValues(Object(DoctrineORMModule\\Proxy\\__CG__\\Monarc\\FrontOffice\\Model\\Entity\\Anr), '98ca84fb-db87-1...', false)\n#2 /home/vagrant/monarc/vendor/monarc/frontoffice/src/Service/DeliverableGenerationService.php(251): Monarc\\FrontOffice\\Service\\DeliverableGenerationService->buildValues(Object(DoctrineORMModule\\Proxy\\__CG__\\Monarc\\FrontOffice\\Model\\Entity\\Anr), 5, '98ca84fb-db87-1...', NULL, false)\n#3 /home/vagrant/monarc/vendor/monarc/frontoffice/src/Controller/ApiAnrDeliverableController.php(59): Monarc\\FrontOffice\\Service\\DeliverableGenerationService->generateDeliverableWithValues(3, 5, Array, Array)\n#4 /home/vagrant/monarc/vendor/laminas/laminas-mvc/src/Controller/AbstractRestfulController.php(467): Monarc\\FrontOffice\\Controller\\ApiAnrDeliverableController->create(Array)\n#5 /home/vagrant/monarc/vendor/laminas/laminas-mvc/src/Controller/AbstractRestfulController.php(428): Laminas\\Mvc\\Controller\\AbstractRestfulController->processPostData(Object(Laminas\\Http\\PhpEnvironment\\Request))\n#6 /home/vagrant/monarc/vendor/laminas/laminas-eventmanager/src/EventManager.php(321): Laminas\\Mvc\\Controller\\AbstractRestfulController->onDispatch(Object(Laminas\\Mvc\\MvcEvent))\n#7 /home/vagrant/monarc/vendor/laminas/laminas-eventmanager/src/EventManager.php(178): Laminas\\EventManager\\EventManager->triggerListeners(Object(Laminas\\Mvc\\MvcEvent), Object(Closure))\n#8 /home/vagrant/monarc/vendor/laminas/laminas-mvc/src/Controller/AbstractController.php(105): Laminas\\EventManager\\EventManager->triggerEventUntil(Object(Closure), Object(Laminas\\Mvc\\MvcEvent))\n#9 /home/vagrant/monarc/vendor/laminas/laminas-mvc/src/Controller/AbstractRestfulController.php(312): Laminas\\Mvc\\Controller\\AbstractController->dispatch(Object(Laminas\\Http\\PhpEnvironment\\Request), Object(Laminas\\Http\\PhpEnvironment\\Response))\n#10 /home/vagrant/monarc/vendor/laminas/laminas-mvc/src/DispatchListener.php(139): Laminas\\Mvc\\Controller\\AbstractRestfulController->dispatch(Object(Laminas\\Http\\PhpEnvironment\\Request), Object(Laminas\\Http\\PhpEnvironment\\Response))\n#11 /home/vagrant/monarc/vendor/laminas/laminas-eventmanager/src/EventManager.php(321): Laminas\\Mvc\\DispatchListener->onDispatch(Object(Laminas\\Mvc\\MvcEvent))\n#12 /home/vagrant/monarc/vendor/laminas/laminas-eventmanager/src/EventManager.php(178): Laminas\\EventManager\\EventManager->triggerListeners(Object(Laminas\\Mvc\\MvcEvent), Object(Closure))\n#13 /home/vagrant/monarc/vendor/laminas/laminas-mvc/src/Application.php(331): Laminas\\EventManager\\EventManager->triggerEventUntil(Object(Closure), Object(Laminas\\Mvc\\MvcEvent))\n#14 /home/vagrant/monarc/public/index.php(34): Laminas\\Mvc\\Application->run()\n#15 {main}"}}]}]

cedricbonhomme commented 4 years ago

282