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 Symfony\Component\Validator\Constraints\NotBlank; |
18
|
|
|
|
19
|
|
|
/** |
20
|
|
|
* Class SchedulesUpdateForm |
21
|
|
|
* @package Dealer\Form |
22
|
|
|
*/ |
23
|
|
|
class SchedulesUpdateForm extends SchedulesForm |
24
|
|
|
{ |
25
|
|
|
|
26
|
|
|
/** |
27
|
|
|
* |
28
|
|
|
* in this function you add all the fields you need for your Form. |
29
|
|
|
* Form this you have to call add method on $this->formBuilder attribute : |
30
|
|
|
* |
31
|
|
|
* $this->formBuilder->add("name", "text") |
32
|
|
|
* ->add("email", "email", array( |
33
|
|
|
* "attr" => array( |
34
|
|
|
* "class" => "field" |
35
|
|
|
* ), |
36
|
|
|
* "label" => "email", |
37
|
|
|
* "constraints" => array( |
38
|
|
|
* new \Symfony\Component\Validator\Constraints\NotBlank() |
39
|
|
|
* ) |
40
|
|
|
* ) |
41
|
|
|
* ) |
42
|
|
|
* ->add('age', 'integer'); |
43
|
|
|
* |
44
|
|
|
* @return null |
45
|
|
|
*/ |
46
|
|
|
protected function buildForm() |
47
|
|
|
{ |
48
|
|
|
parent::buildForm(); |
49
|
|
|
|
50
|
|
|
$this->formBuilder |
51
|
|
|
->add('id', 'integer', array( |
52
|
|
|
"label" => $this->translator->trans("Id", [], Dealer::MESSAGE_DOMAIN), |
53
|
|
|
"label_attr" => ["for" => "attr-dealer-schedules-id"], |
54
|
|
|
"required" => true, |
55
|
|
|
"constraints" => array(new NotBlank(), ), |
56
|
|
|
"attr" => array() |
57
|
|
|
)) |
58
|
|
|
->remove("beginPM") |
59
|
|
|
->remove("endPM") |
60
|
|
|
->remove("beginAM") |
61
|
|
|
->remove("endAM") |
62
|
|
|
->remove("day") |
63
|
|
|
->add("day", "choice", [ |
64
|
|
|
"choices" => $this->getDay(), |
65
|
|
|
"label" => $this->translator->trans("Day", [], Dealer::MESSAGE_DOMAIN), |
66
|
|
|
"label_attr" => ["for" => "attr-dealer-schedules-day"], |
67
|
|
|
"required" => true, |
68
|
|
|
"attr" => array() |
69
|
|
|
]) |
70
|
|
|
->add("begin", "time", [ |
71
|
|
|
"label" => $this->translator->trans("Begin", [], Dealer::MESSAGE_DOMAIN), |
72
|
|
|
"label_attr" => ["for" => "attr-dealer-schedules-begin"], |
73
|
|
|
"input" => "string", |
74
|
|
|
"widget" => "single_text", |
75
|
|
|
"required" => false, |
76
|
|
|
"attr" => array() |
77
|
|
|
]) |
78
|
|
|
->add("end", "time", [ |
79
|
|
|
"label" => $this->translator->trans("End", [], Dealer::MESSAGE_DOMAIN), |
80
|
|
|
"label_attr" => ["for" => "attr-dealer-schedules-end"], |
81
|
|
|
"input" => "string", |
82
|
|
|
"widget" => "single_text", |
83
|
|
|
"required" => false, |
84
|
|
|
"attr" => array() |
85
|
|
|
]) |
86
|
|
|
; |
87
|
|
|
} |
88
|
|
|
|
89
|
|
|
public function getName() |
90
|
|
|
{ |
91
|
|
|
return "schedules_update"; |
92
|
|
|
} |
93
|
|
|
} |
94
|
|
|
|