Completed
Push — master ( ef76c8...b7db51 )
by Antony
03:55
created

SchedulesCloneForm::buildForm()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 18
Code Lines 14

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 1
Metric Value
c 1
b 0
f 1
dl 0
loc 18
rs 9.4285
cc 1
eloc 14
nc 1
nop 0
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
use Thelia\Form\BaseForm;
19
20
/**
21
 * Class SchedulesCloneForm
22
 * @package Dealer\Form
23
 */
24
class SchedulesCloneForm extends BaseForm
25
{
26
27
    /**
28
     * @inheritDoc
29
     */
30
    protected function buildForm()
31
    {
32
        $this->formBuilder
33
            ->add('id', 'integer', array(
34
                "label" => $this->translator->trans("Id", [], Dealer::MESSAGE_DOMAIN),
35
                "label_attr" => ["for" => "attr-dealer-schedules-clone-id"],
36
                "required" => true,
37
                "constraints" => array(new NotBlank(),),
38
                "attr" => array()
39
            ))
40
            ->add("day", "choice", [
41
                "choices" => $this->getDay(),
42
                "label" => $this->translator->trans("Day", [], Dealer::MESSAGE_DOMAIN),
43
                "label_attr" => ["for" => "attr-dealer-schedules-clone-day"],
44
                "required" => true,
45
                "attr" => array()
46
            ]);
47
    }
48
49
    protected function getDay()
50
    {
51
        return [
52
            $this->translator->trans("Monday", [], Dealer::MESSAGE_DOMAIN),
53
            $this->translator->trans("Tuesday", [], Dealer::MESSAGE_DOMAIN),
54
            $this->translator->trans("Wednesday", [], Dealer::MESSAGE_DOMAIN),
55
            $this->translator->trans("Thursday", [], Dealer::MESSAGE_DOMAIN),
56
            $this->translator->trans("Friday", [], Dealer::MESSAGE_DOMAIN),
57
            $this->translator->trans("Saturday", [], Dealer::MESSAGE_DOMAIN),
58
            $this->translator->trans("Sunday", [], Dealer::MESSAGE_DOMAIN)
59
        ];
60
    }
61
62
    public function getName()
63
    {
64
        return "schedules_clone";
65
    }
66
}