Skip to content

Instantly share code, notes, and snippets.

@docteurklein
Created July 29, 2015 08:59
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save docteurklein/6912d7482d9356699de7 to your computer and use it in GitHub Desktop.
Save docteurklein/6912d7482d9356699de7 to your computer and use it in GitHub Desktop.
how to make the selected offer checked?
$data = [
'offer' => new OfferForCustomer($ticket->getCustomer(), $ticket->getOffer(), 0, 0, 0),
];
$form = $this->createForm('season_ticket', $data, [
$builder
->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