1 | <?php |
||
33 | class EntryType extends AbstractType |
||
|
|||
34 | { |
||
35 | protected $config; |
||
36 | |||
37 | 663 | public function __construct($config) |
|
41 | |||
42 | /** |
||
43 | * {@inheritdoc} |
||
44 | */ |
||
45 | 32 | public function buildForm(FormBuilderInterface $builder, array $options) |
|
46 | { |
||
47 | $builder |
||
48 | 32 | ->add('name', 'name', array( |
|
49 | 32 | 'required' => true, |
|
50 | )) |
||
51 | 32 | ->add('kana', 'kana', array( |
|
52 | 32 | 'required' => true, |
|
53 | )) |
||
54 | 32 | ->add('company_name', 'text', array( |
|
55 | 32 | 'required' => false, |
|
56 | 'constraints' => array( |
||
57 | 32 | new Assert\Length(array( |
|
58 | 32 | 'max' => $this->config['stext_len'], |
|
59 | )), |
||
60 | ), |
||
61 | )) |
||
62 | 32 | ->add('zip', 'zip') |
|
63 | 32 | ->add('address', 'address') |
|
64 | 32 | ->add('tel', 'tel', array( |
|
65 | 32 | 'required' => true, |
|
66 | )) |
||
67 | 32 | ->add('fax', 'tel', array( |
|
68 | 32 | 'required' => false, |
|
69 | )) |
||
70 | 32 | ->add('email', 'repeated_email') |
|
71 | 32 | ->add('password', 'repeated_password') |
|
72 | 32 | ->add('birth', 'birthday', array( |
|
73 | 32 | 'required' => false, |
|
74 | 32 | 'input' => 'datetime', |
|
75 | 32 | 'years' => range(date('Y'), date('Y') - $this->config['birth_max']), |
|
76 | 32 | 'widget' => 'choice', |
|
77 | 32 | 'format' => 'yyyy/MM/dd', |
|
78 | 'empty_value' => array('year' => '----', 'month' => '--', 'day' => '--'), |
||
79 | 'constraints' => array( |
||
80 | 32 | new Assert\LessThanOrEqual(array( |
|
81 | 32 | 'value' => date('Y-m-d'), |
|
82 | 32 | 'message' => 'form.type.select.selectisfuturedate', |
|
83 | )), |
||
84 | ), |
||
85 | )) |
||
86 | 32 | ->add('sex', 'sex', array( |
|
87 | 32 | 'required' => false, |
|
88 | )) |
||
89 | 32 | ->add('job', 'job', array( |
|
90 | 32 | 'required' => false, |
|
91 | )) |
||
92 | 32 | ->add('save', 'submit', array('label' => 'この内容で登録する')); |
|
93 | } |
||
94 | |||
95 | /** |
||
96 | * {@inheritdoc} |
||
97 | */ |
||
98 | 32 | public function setDefaultOptions(OptionsResolverInterface $resolver) |
|
104 | |||
105 | /** |
||
106 | * {@inheritdoc} |
||
107 | */ |
||
108 | 663 | public function getName() |
|
113 | } |
||
114 |