From beb326000aad839706c59d69c0b85289e1d4fb03 Mon Sep 17 00:00:00 2001 From: Ruud Denivel Date: Thu, 17 Jul 2014 16:32:11 +0200 Subject: [PATCH] fix multiple choice on export + fix insert database --- Entity/FormSubmissionFieldTypes/ChoiceFormSubmissionField.php | 2 +- Entity/PageParts/ChoicePagePart.php | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/Entity/FormSubmissionFieldTypes/ChoiceFormSubmissionField.php b/Entity/FormSubmissionFieldTypes/ChoiceFormSubmissionField.php index aa50815..09b553b 100644 --- a/Entity/FormSubmissionFieldTypes/ChoiceFormSubmissionField.php +++ b/Entity/FormSubmissionFieldTypes/ChoiceFormSubmissionField.php @@ -77,7 +77,7 @@ public function __toString() if (is_array($values) && sizeof($values) > 0) { $result = array(); foreach ($values as $value) { - $result[] = array_key_exists($value, $choices) ? $choices[$value] : $value; + $result[] = array_key_exists($value, $choices) ? trim($choices[$value]) : $value; } return implode(", ", $result); } else { diff --git a/Entity/PageParts/ChoicePagePart.php b/Entity/PageParts/ChoicePagePart.php index 16d3f17..65de238 100755 --- a/Entity/PageParts/ChoicePagePart.php +++ b/Entity/PageParts/ChoicePagePart.php @@ -89,6 +89,7 @@ public function getDefaultView() public function adaptForm(FormBuilderInterface $formBuilder, ArrayObject $fields) { $choices = explode("\n", $this->getChoices()); + $choices = array_map('trim', $choices); $cfsf = new ChoiceFormSubmissionField(); $cfsf->setFieldName("field_" . $this->getUniqueId());