1
|
|
|
<?php |
2
|
|
|
/*************************************************************************************/ |
3
|
|
|
/* This file is part of the Thelia package. */ |
4
|
|
|
/* */ |
5
|
|
|
/* Copyright (c) OpenStudio */ |
6
|
|
|
/* email : [email protected] */ |
7
|
|
|
/* web : http://www.thelia.net */ |
8
|
|
|
/* */ |
9
|
|
|
/* For the full copyright and license information, please view the LICENSE.txt */ |
10
|
|
|
/* file that was distributed with this source code. */ |
11
|
|
|
/*************************************************************************************/ |
12
|
|
|
/*************************************************************************************/ |
13
|
|
|
|
14
|
|
|
namespace Dealer\Form; |
15
|
|
|
|
16
|
|
|
use Dealer\Dealer; |
17
|
|
|
use Dealer\Model\Map\DealerContactInfoTableMap; |
18
|
|
|
use Symfony\Component\Validator\Constraints\NotBlank; |
19
|
|
|
use Thelia\Form\BaseForm; |
20
|
|
|
|
21
|
|
|
/** |
22
|
|
|
* Class ContactInfoForm |
23
|
|
|
* @package Dealer\Form |
24
|
|
|
*/ |
25
|
|
|
class ContactInfoForm extends BaseForm |
26
|
|
|
{ |
27
|
|
|
|
28
|
|
|
/** |
29
|
|
|
* |
30
|
|
|
* in this function you add all the fields you need for your Form. |
31
|
|
|
* Form this you have to call add method on $this->formBuilder attribute : |
32
|
|
|
* |
33
|
|
|
* $this->formBuilder->add("name", "text") |
34
|
|
|
* ->add("email", "email", array( |
35
|
|
|
* "attr" => array( |
36
|
|
|
* "class" => "field" |
37
|
|
|
* ), |
38
|
|
|
* "label" => "email", |
39
|
|
|
* "constraints" => array( |
40
|
|
|
* new \Symfony\Component\Validator\Constraints\NotBlank() |
41
|
|
|
* ) |
42
|
|
|
* ) |
43
|
|
|
* ) |
44
|
|
|
* ->add('age', 'integer'); |
45
|
|
|
* |
46
|
|
|
* @return null |
47
|
|
|
*/ |
48
|
|
|
protected function buildForm() |
49
|
|
|
{ |
50
|
|
|
$this->formBuilder |
51
|
|
|
->add("type", 'choice', array( |
52
|
|
|
"choices" => DealerContactInfoTableMap::getValueSet(DealerContactInfoTableMap::CONTACT_TYPE), |
53
|
|
|
"label" => $this->translator->trans("Contact Type", [], Dealer::MESSAGE_DOMAIN), |
54
|
|
|
"label_attr" => ["for" => "attr-dealer-contact-info-type"], |
55
|
|
|
"required" => true, |
56
|
|
|
"attr" => array() |
57
|
|
|
)) |
58
|
|
|
->add("value", "text", array( |
59
|
|
|
"label" => $this->translator->trans("Value", [], Dealer::MESSAGE_DOMAIN), |
60
|
|
|
"label_attr" => ["for" => "attr-dealer-contact-info-value"], |
61
|
|
|
"required" => true, |
62
|
|
|
"constraints" => array(new NotBlank(), ), |
63
|
|
|
"attr" => array() |
64
|
|
|
)) |
65
|
|
|
->add('contact_id', 'integer', array( |
66
|
|
|
"label" => $this->translator->trans("Contact", [], Dealer::MESSAGE_DOMAIN), |
67
|
|
|
"label_attr" => ["for" => "attr-dealer-contact-info-contact_id"], |
68
|
|
|
"required" => true, |
69
|
|
|
"constraints" => array(new NotBlank(), ), |
70
|
|
|
"attr" => array() |
71
|
|
|
)) |
72
|
|
|
->add("locale", "text", array( |
73
|
|
|
"constraints" => array( |
74
|
|
|
new NotBlank(), |
75
|
|
|
), |
76
|
|
|
"label_attr" => array("for" => "locale_create"), |
77
|
|
|
)) |
78
|
|
|
; |
79
|
|
|
} |
80
|
|
|
|
81
|
|
|
|
82
|
|
|
public function getName() |
83
|
|
|
{ |
84
|
|
|
return "contact_info__create"; |
85
|
|
|
} |
86
|
|
|
} |
87
|
|
|
|