From 67e68ac149ceb51e3d3815fea9b6cdc1e217c4fa Mon Sep 17 00:00:00 2001 From: Julie Lenaerts Date: Fri, 10 Mar 2023 12:56:05 +0100 Subject: [PATCH] FIX [review] processing review, but stuck at transformation of json string to array --- .../AccompanyingCourseDocumentWorkflowHandler.php | 2 +- .../ChillMainBundle/Entity/Workflow/EntityWorkflow.php | 2 +- .../ChillMainBundle/Form/Type/PickUserDynamicType.php | 2 +- .../Resources/public/module/pick-entity/index.js | 8 +++++--- .../Resources/public/vuejs/PickEntity/PickEntity.vue | 5 +++-- .../ChillPersonBundle/Form/Type/PickPersonDynamicType.php | 2 +- ...panyingPeriodWorkEvaluationDocumentWorkflowHandler.php | 2 +- .../AccompanyingPeriodWorkEvaluationWorkflowHandler.php | 2 +- .../Workflow/AccompanyingPeriodWorkWorkflowHandler.php | 2 +- .../Form/Type/PickThirdpartyDynamicType.php | 2 +- 10 files changed, 16 insertions(+), 13 deletions(-) diff --git a/src/Bundle/ChillDocStoreBundle/Workflow/AccompanyingCourseDocumentWorkflowHandler.php b/src/Bundle/ChillDocStoreBundle/Workflow/AccompanyingCourseDocumentWorkflowHandler.php index ec714aa74..c538bd107 100644 --- a/src/Bundle/ChillDocStoreBundle/Workflow/AccompanyingCourseDocumentWorkflowHandler.php +++ b/src/Bundle/ChillDocStoreBundle/Workflow/AccompanyingCourseDocumentWorkflowHandler.php @@ -100,7 +100,7 @@ class AccompanyingCourseDocumentWorkflowHandler implements EntityWorkflowHandler $suggestedUsers = $entityWorkflow->getUsersInvolved(); $referrer = $this->getRelatedEntity($entityWorkflow)->getCourse()->getUser(); - $suggestedUsers[$referrer->getId()] = $referrer; + $suggestedUsers[spl_object_hash($referrer)] = $referrer; return $suggestedUsers; } diff --git a/src/Bundle/ChillMainBundle/Entity/Workflow/EntityWorkflow.php b/src/Bundle/ChillMainBundle/Entity/Workflow/EntityWorkflow.php index 62e6bac0f..99aba07fd 100644 --- a/src/Bundle/ChillMainBundle/Entity/Workflow/EntityWorkflow.php +++ b/src/Bundle/ChillMainBundle/Entity/Workflow/EntityWorkflow.php @@ -357,7 +357,7 @@ class EntityWorkflow implements TrackCreationInterface, TrackUpdateInterface foreach ($this->steps as $step) { foreach ($step->getDestUser() as $u) { - $usersInvolved[$u->getId()] = $u; + $usersInvolved[spl_object_hash($u)] = $u; } } diff --git a/src/Bundle/ChillMainBundle/Form/Type/PickUserDynamicType.php b/src/Bundle/ChillMainBundle/Form/Type/PickUserDynamicType.php index 9a2c1fbb4..6bfd95fe8 100644 --- a/src/Bundle/ChillMainBundle/Form/Type/PickUserDynamicType.php +++ b/src/Bundle/ChillMainBundle/Form/Type/PickUserDynamicType.php @@ -55,7 +55,7 @@ class PickUserDynamicType extends AbstractType ->setDefault('multiple', false) ->setAllowedTypes('multiple', ['bool']) ->setDefault('compound', false) - ->setDefault('suggested', null); + ->setDefault('suggested', []); } public function getBlockPrefix() diff --git a/src/Bundle/ChillMainBundle/Resources/public/module/pick-entity/index.js b/src/Bundle/ChillMainBundle/Resources/public/module/pick-entity/index.js index bb9cc744c..41330c186 100644 --- a/src/Bundle/ChillMainBundle/Resources/public/module/pick-entity/index.js +++ b/src/Bundle/ChillMainBundle/Resources/public/module/pick-entity/index.js @@ -23,10 +23,12 @@ function loadDynamicPicker(element) { (input.value === '[]' || input.value === '') ? null : [ JSON.parse(input.value) ] ) - suggested = null !== JSON.parse(el.dataset.suggested) ? JSON.parse(el.dataset.suggested) : null - ; + suggested = JSON.parse('[' + el.dataset.suggested + ']'); + // suggested = suggested[0]; - console.log('suggested', suggested) + console.log(typeof suggested) + // console.log(el.dataset.suggested) + console.log('suggested', typeof suggested[0]) if (!isMultiple) { if (input.value === '[]'){ diff --git a/src/Bundle/ChillMainBundle/Resources/public/vuejs/PickEntity/PickEntity.vue b/src/Bundle/ChillMainBundle/Resources/public/vuejs/PickEntity/PickEntity.vue index 02b53a6d3..23a904b14 100644 --- a/src/Bundle/ChillMainBundle/Resources/public/vuejs/PickEntity/PickEntity.vue +++ b/src/Bundle/ChillMainBundle/Resources/public/vuejs/PickEntity/PickEntity.vue @@ -17,7 +17,8 @@ -