/** * @param FormBuilderInterface $builder * @param array $options */ public function buildForm(FormBuilderInterface $builder, array $options) { $builder->add('type', 'choice', ['choices' => Job::getTypes(), 'expanded' => true, 'constraints' => [new Assert\NotBlank(), new Assert\Choice(['callback' => ['Eti\\JobeetBundle\\Entity\\Job', 'getTypeValues']])]])->add('category', null, ['constraints' => [new Assert\NotBlank()]])->add('company', 'text', ['constraints' => [new Assert\NotBlank()]])->add('file', 'file', ['label' => 'Company logo', 'required' => false, 'constraints' => [new Assert\Image()]])->add('url', null, ['constraints' => [new Assert\Url()]])->add('position', null, ['constraints' => [new Assert\NotBlank()]])->add('location', 'text', ['constraints' => [new Assert\NotBlank()]])->add('description', 'textarea', ['constraints' => [new Assert\NotBlank()]])->add('howToApply', 'text', ['label' => 'How to apply?', 'constraints' => [new Assert\NotBlank()]])->add('isPublic', null, ['label' => 'Public?'])->add('email', 'email', ['constraints' => [new Assert\NotBlank(), new Assert\Email()]]); }
protected function configureFormFields(FormMapper $formMapper) { $formMapper->add('category')->add('type', 'choice', array('choices' => Job::getTypes(), 'expanded' => true))->add('company')->add('file', 'file', array('label' => 'Company logo', 'required' => false))->add('url')->add('position')->add('location')->add('description')->add('howToApply')->add('isPublic')->add('email')->add('isActivated'); }