How can I merge choice label function results in Symfony formbuilder?

$options['choice_label'] = function ( $entity) use ($name) {
           return $entity->getId().$entity->getContent();
     };

The result of my choice label function in Symfony formbuilder is

123Fred
123Hoffman
576Marc
576Berger

Is there a possibility to merge same Ids? So that my result will be:

Fred Hoffman
Marc Berger

Source: Symfony Questions

Was this helpful?

0 / 0

Leave a Reply 0

Your email address will not be published. Required fields are marked *