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
|
|
|
namespace Thelia\Core\Event\Contact; |
14
|
|
|
|
15
|
|
|
use Symfony\Component\Form\Form; |
16
|
|
|
use Thelia\Core\Event\ActionEvent; |
17
|
|
|
|
18
|
|
|
/** |
19
|
|
|
* Class ContactController |
20
|
|
|
* @package Thelia\Controller\Front |
21
|
|
|
* @author Vincent Lopes-Vicente <[email protected]> |
22
|
|
|
* @since 2.4 |
23
|
|
|
*/ |
24
|
|
|
class ContactEvent extends ActionEvent |
25
|
|
|
{ |
26
|
|
|
/** @var Form */ |
27
|
|
|
protected $form; |
28
|
|
|
|
29
|
|
|
/** @var string */ |
30
|
|
|
protected $subject; |
31
|
|
|
|
32
|
|
|
/** @var string */ |
33
|
|
|
protected $message; |
34
|
|
|
|
35
|
|
|
/** @var string */ |
36
|
|
|
protected $email; |
37
|
|
|
|
38
|
|
|
/** @var string */ |
39
|
|
|
protected $name; |
40
|
|
|
|
41
|
|
|
public function __construct(Form $form) |
42
|
|
|
{ |
43
|
|
|
$this->form = $form; |
44
|
|
|
|
45
|
|
|
$this->subject = $form->get('subject')->getData(); |
46
|
|
|
$this->message = $form->get('message')->getData(); |
47
|
|
|
$this->email = $form->get('email')->getData(); |
48
|
|
|
$this->name = $form->get('name')->getData(); |
49
|
|
|
} |
50
|
|
|
|
51
|
|
|
/** |
52
|
|
|
* @return string |
53
|
|
|
*/ |
54
|
|
|
public function getSubject() |
55
|
|
|
{ |
56
|
|
|
return $this->subject; |
57
|
|
|
} |
58
|
|
|
|
59
|
|
|
/** |
60
|
|
|
* @param string $subject |
61
|
|
|
* @return ContactEvent |
62
|
|
|
*/ |
63
|
|
|
public function setSubject($subject) |
64
|
|
|
{ |
65
|
|
|
$this->subject = $subject; |
66
|
|
|
return $this; |
67
|
|
|
} |
68
|
|
|
|
69
|
|
|
/** |
70
|
|
|
* @return string |
71
|
|
|
*/ |
72
|
|
|
public function getMessage() |
73
|
|
|
{ |
74
|
|
|
return $this->message; |
75
|
|
|
} |
76
|
|
|
|
77
|
|
|
/** |
78
|
|
|
* @param string $message |
79
|
|
|
* @return ContactEvent |
80
|
|
|
*/ |
81
|
|
|
public function setMessage($message) |
82
|
|
|
{ |
83
|
|
|
$this->message = $message; |
84
|
|
|
return $this; |
85
|
|
|
} |
86
|
|
|
|
87
|
|
|
/** |
88
|
|
|
* @return string |
89
|
|
|
*/ |
90
|
|
|
public function getEmail() |
91
|
|
|
{ |
92
|
|
|
return $this->email; |
93
|
|
|
} |
94
|
|
|
|
95
|
|
|
/** |
96
|
|
|
* @param string $email |
97
|
|
|
* @return ContactEvent |
98
|
|
|
*/ |
99
|
|
|
public function setEmail($email) |
100
|
|
|
{ |
101
|
|
|
$this->email = $email; |
102
|
|
|
return $this; |
103
|
|
|
} |
104
|
|
|
|
105
|
|
|
/** |
106
|
|
|
* @return string |
107
|
|
|
*/ |
108
|
|
|
public function getName() |
109
|
|
|
{ |
110
|
|
|
return $this->name; |
111
|
|
|
} |
112
|
|
|
|
113
|
|
|
/** |
114
|
|
|
* @param string $name |
115
|
|
|
* @return ContactEvent |
116
|
|
|
*/ |
117
|
|
|
public function setName($name) |
118
|
|
|
{ |
119
|
|
|
$this->name = $name; |
120
|
|
|
return $this; |
121
|
|
|
} |
122
|
|
|
|
123
|
|
|
} |