Skip to content

Instantly share code, notes, and snippets.

@ornj
Created November 20, 2012 19:59
Show Gist options
  • Save ornj/4120640 to your computer and use it in GitHub Desktop.
Save ornj/4120640 to your computer and use it in GitHub Desktop.
non-working constraint
public function buildForm(FormBuilderInterface $builder, array $options) {
$subscriber = new AddDateFieldSubscriber($builder->getFormFactory());
$builder->addEventSubscriber($subscriber);
$builder
->add('images', 'collection', array(
'type' => new UploadType(),
'required' => true,
'allow_add' => true,
'allow_delete' => true,
'by_reference' => false,
'prototype' => true,
'widget_add_btn' => array(
'icon' => 'plus-sign',
'label' => 'add',
),
'widget_type' => 'inline',
'options' => array(
'label_render' => false,
'widget_control_group' => false,
'widget_remove_btn' => array(
'icon' => 'minus-sign',
'label' => 'remove',
)
),
'constraints' => array(
new Collection(array(
'fields' => array(
'file' => new Image()
),
'allowMissingFields' => true,
)),
),
));
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment