sectionArray)){ $this->sectionArray = $this->sectionStore->setMerchant($this->merchant)->get(); } return array_merge(parent::configureFieldsBase(), [ 'section' => AssociationField::new('section') ->setTemplatePath('@LcCaracole/admin/section/field/section.html.twig') ->setFormTypeOption('choices', $this->sectionArray) ]); } public function addSectionToFieldArrayIfOutOfSection(?SectionInterface $sectionCurrent, array $fieldArray) { $asObject = true; if(is_string($fieldArray[array_key_first($fieldArray)])) { $asObject = false; } $fieldSectionArray = []; if($sectionCurrent == null) { if($asObject) { $allFieldArray = $this->getAllFields(); $fieldSectionArray = [$allFieldArray['section']]; } else { $fieldSectionArray = ['section']; } } return array_merge($fieldSectionArray, $fieldArray); } }