Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
how to make the selected offer checked?
$data = [
'offer' => new OfferForCustomer($ticket->getCustomer(), $ticket->getOffer(), 0, 0, 0),
$form = $this->createForm('season_ticket', $data, [
->add('offer', 'choice', [
'data_class' => 'App\Domain\Model\OfferForCustomer', // i have to specify it or it will only accept scalar during setData
'constraints' => [new Assert\NotBlank],
'choices' => $this->offers->getAvailableOffers($options['customer'], $options['seller']), // array of VOs
'expanded' => true,
'choices_as_values' => true,
'choice_label' => 'name',
'choice_value' => 'id',
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment