getAccompanyingPeriodWork()->getPersons() as $person) { $choices[$person->getId()] = $person->getName(); } } $builder->add('members', ChoiceType::class, [ 'choices' => $choices, 'placeholder' => 'Choose a person', 'label' => 'Person to add' ]); return $builder; } /** * True of false which entity supports */ public function supports(string $entityClass): bool { return ($entityClass == AccompanyingPeriod::class) || ($entityClass == SocialAction::class); } /** * Get the data that will be injected to the generated document */ public function getData($entity): array { $datas = array( 'setValue' => array(), 'cloneRowAndSetValues' => array() ); // TODO CREER UNE CLASSE POUR CA if(get_class($entity) == AccompanyingPeriodWorkEvaluation::class) { $values = array(); foreach($entity->getAccompanyingPeriodWork()->getPersons() as $person) { $i = 1; $values[] = array( 'personRowId' => $i, 'personFirstName' => $person->getFirstName(), 'personLastName' => $person->getLastName(), ); } $datas['cloneRowAndSetValues'][] = array( 'personRowId', $values); } return $datas; } }