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

Error when editing an asset with a rolfTag #357

Closed cedricbonhomme closed 3 years ago

cedricbonhomme commented 3 years ago

Describe the bug Error when editing an asset with a rolfTag.

Error returned

{"errors":[{"message":"Return value of Monarc\\Core\\Model\\Entity\\ObjectSuperClass::getRolfTag() must be an instance of Monarc\\Core\\Model\\Entity\\RolfTagSuperClass or null, int returned","error":"error-exception","exception":{"class":"TypeError","file":"\/home\/vagrant\/monarc\/vendor\/monarc\/core\/src\/Model\/Entity\/ObjectSuperClass.php","line":294,"message":"Return value of Monarc\\Core\\Model\\Entity\\ObjectSuperClass::getRolfTag() must be an instance of Monarc\\Core\\Model\\Entity\\RolfTagSuperClass or null, int returned","stacktrace":"#0 \/home\/vagrant\/monarc\/vendor\/monarc\/core\/src\/Service\/ObjectService.php(703): Monarc\\Core\\Model\\Entity\\ObjectSuperClass-\u003EgetRolfTag()\n#1 \/home\/vagrant\/monarc\/vendor\/monarc\/frontoffice\/src\/Controller\/ApiAnrObjectsController.php(117): Monarc\\Core\\Service\\ObjectService-\u003Eupdate()\n#2 \/home\/vagrant\/monarc\/vendor\/laminas\/laminas-mvc\/src\/Controller\/AbstractRestfulController.php(437): Monarc\\FrontOffice\\Controller\\ApiAnrObjectsController-\u003Eupdate()\n#3 \/home\/vagrant\/monarc\/vendor\/laminas\/laminas-eventmanager\/src\/EventManager.php(331): Laminas\\Mvc\\Controller\\AbstractRestfulController-\u003EonDispatch()\n#4 \/home\/vagrant\/monarc\/vendor\/laminas\/laminas-eventmanager\/src\/EventManager.php(188): Laminas\\EventManager\\EventManager-\u003EtriggerListeners()\n#5 \/home\/vagrant\/monarc\/vendor\/laminas\/laminas-mvc\/src\/Controller\/AbstractController.php(103): Laminas\\EventManager\\EventManager-\u003EtriggerEventUntil()\n#6 \/home\/vagrant\/monarc\/vendor\/laminas\/laminas-mvc\/src\/Controller\/AbstractRestfulController.php(312): Laminas\\Mvc\\Controller\\AbstractController-\u003Edispatch()\n#7 \/home\/vagrant\/monarc\/vendor\/laminas\/laminas-mvc\/src\/DispatchListener.php(138): Laminas\\Mvc\\Controller\\AbstractRestfulController-\u003Edispatch()\n#8 \/home\/vagrant\/monarc\/vendor\/laminas\/laminas-eventmanager\/src\/EventManager.php(331): Laminas\\Mvc\\DispatchListener-\u003EonDispatch()\n#9 \/home\/vagrant\/monarc\/vendor\/laminas\/laminas-eventmanager\/src\/EventManager.php(188): Laminas\\EventManager\\EventManager-\u003EtriggerListeners()\n#10 \/home\/vagrant\/monarc\/vendor\/laminas\/laminas-mvc\/src\/Application.php(331): Laminas\\EventManager\\EventManager-\u003EtriggerEventUntil()\n#11 \/home\/vagrant\/monarc\/public\/index.php(34): Laminas\\Mvc\\Application-\u003Erun()\n#12 {main}"}}]}

Screenshots Screenshot_20210609_152509

cedricbonhomme commented 3 years ago

not ideal fix, but seems so fix the issue. The problem is that at some point the value of $this->rolfTag is of type Int (i.e. the id of the rolfTag) as it can be seen in the screenshot.

ruslanbaidan commented 3 years ago

PRs: https://github.com/monarc-project/zm-client/pull/53 https://github.com/monarc-project/zm-core/pull/50

ruslanbaidan commented 3 years ago

The issues is deployed within the recent version of MONARC v2.10.3. The version is updated as well as the Virtual Machine