|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
namespace rias\contactformextensions\elements\db; |
|
4
|
|
|
|
|
5
|
|
|
use craft\elements\db\ElementQuery; |
|
6
|
|
|
use craft\helpers\Db; |
|
7
|
|
|
|
|
8
|
|
|
class ContactFormSubmissionQuery extends ElementQuery |
|
9
|
|
|
{ |
|
10
|
|
|
public $form; |
|
11
|
|
|
public $subject; |
|
12
|
|
|
public $fromName; |
|
13
|
|
|
public $fromEmail; |
|
14
|
|
|
public $attachments; |
|
15
|
|
|
public $message; |
|
16
|
|
|
|
|
17
|
|
|
public function form($value) |
|
18
|
|
|
{ |
|
19
|
|
|
$this->form = $value; |
|
20
|
|
|
|
|
21
|
|
|
return $this; |
|
22
|
|
|
} |
|
23
|
|
|
|
|
24
|
|
|
public function subject($value) |
|
25
|
|
|
{ |
|
26
|
|
|
$this->subject = $value; |
|
27
|
|
|
|
|
28
|
|
|
return $this; |
|
29
|
|
|
} |
|
30
|
|
|
|
|
31
|
|
|
public function fromName($value) |
|
32
|
|
|
{ |
|
33
|
|
|
$this->fromName = $value; |
|
34
|
|
|
|
|
35
|
|
|
return $this; |
|
36
|
|
|
} |
|
37
|
|
|
|
|
38
|
|
|
public function fromEmail($value) |
|
39
|
|
|
{ |
|
40
|
|
|
$this->fromEmail = $value; |
|
41
|
|
|
|
|
42
|
|
|
return $this; |
|
43
|
|
|
} |
|
44
|
|
|
|
|
45
|
|
|
public function attachments($value) |
|
46
|
|
|
{ |
|
47
|
|
|
$this->attachments = $value; |
|
48
|
|
|
|
|
49
|
|
|
return $this; |
|
50
|
|
|
} |
|
51
|
|
|
|
|
52
|
|
|
public function message($value) |
|
53
|
|
|
{ |
|
54
|
|
|
$this->message = $value; |
|
55
|
|
|
|
|
56
|
|
|
return $this; |
|
57
|
|
|
} |
|
58
|
|
|
|
|
59
|
|
|
protected function beforePrepare(): bool |
|
60
|
|
|
{ |
|
61
|
|
|
// join in the products table |
|
62
|
|
|
$this->joinElementTable('contactform_submissions'); |
|
63
|
|
|
|
|
64
|
|
|
// select the columns |
|
65
|
|
|
$this->query->select([ |
|
|
|
|
|
|
66
|
|
|
'contactform_submissions.form', |
|
67
|
|
|
'contactform_submissions.subject', |
|
68
|
|
|
'contactform_submissions.fromName', |
|
69
|
|
|
'contactform_submissions.fromEmail', |
|
70
|
|
|
'contactform_submissions.attachments', |
|
71
|
|
|
'contactform_submissions.message', |
|
72
|
|
|
]); |
|
73
|
|
|
|
|
74
|
|
|
if ($this->form) { |
|
75
|
|
|
$this->subQuery->andWhere(Db::parseParam('contactform_submissions.form', $this->form)); |
|
|
|
|
|
|
76
|
|
|
} |
|
77
|
|
|
|
|
78
|
|
|
if ($this->subject) { |
|
79
|
|
|
$this->subQuery->andWhere(Db::parseParam('contactform_submissions.subject', $this->subject)); |
|
80
|
|
|
} |
|
81
|
|
|
|
|
82
|
|
|
if ($this->fromName) { |
|
83
|
|
|
$this->subQuery->andWhere(Db::parseParam('contactform_submissions.fromName', $this->fromName)); |
|
84
|
|
|
} |
|
85
|
|
|
|
|
86
|
|
|
if ($this->fromEmail) { |
|
87
|
|
|
$this->subQuery->andWhere(Db::parseParam('contactform_submissions.fromEmail', $this->fromEmail)); |
|
88
|
|
|
} |
|
89
|
|
|
|
|
90
|
|
|
if ($this->attachments) { |
|
91
|
|
|
$this->subQuery->andWhere(Db::parseParam('contactform_submissions.attachments', $this->attachments)); |
|
92
|
|
|
} |
|
93
|
|
|
|
|
94
|
|
|
if ($this->message) { |
|
95
|
|
|
$this->subQuery->andWhere(Db::parseParam('contactform_submissions.message', $this->message)); |
|
96
|
|
|
} |
|
97
|
|
|
|
|
98
|
|
|
return parent::beforePrepare(); |
|
99
|
|
|
} |
|
100
|
|
|
} |
|
101
|
|
|
|
This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.
This is most likely a typographical error or the method has been renamed.