Permalink
Browse files

fixed project category validation

  • Loading branch information...
1 parent 1b66334 commit af23c6b6f74bc06208dbbc8873c59cdb3b83121e @ubermuda ubermuda committed Jun 12, 2012
Showing with 12 additions and 12 deletions.
  1. +12 −12 src/Marketplace/Form/ProjectType.php
View
24 src/Marketplace/Form/ProjectType.php
@@ -29,18 +29,18 @@ public function setDefaultOptions(OptionsResolverInterface $resolver)
'categories' => function (Options $options, $value) {
return array_merge(array('none' => 'No category'), $value);
},
- 'validation_constraint' => new Assert\Collection(array(
- 'fields' => array(
- 'name' => new Assert\NotBlank(),
- 'description' => new Assert\NotBlank(),
- // 'category' => new Assert\Choice(array(
- // 'choices' => function (Options $options, $value) {
- // return array_keys($options['categories']);
- // }
- // ))
- ),
- 'allowExtraFields' => true,
- ))
+ 'validation_constraint' => function(Options $options, $value) {
+ return new Assert\Collection(array(
+ 'fields' => array(
+ 'name' => new Assert\NotBlank(),
+ 'description' => new Assert\NotBlank(),
+ 'category' => new Assert\Choice(array(
+ 'choices' => array_keys($options['categories'])
+ ))
+ ),
+ 'allowExtraFields' => true,
+ ));
+ }
));
}
}

0 comments on commit af23c6b

Please sign in to comment.