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
|
|
|
|
46
|
|
|
public function attachments($value) |
47
|
|
|
{ |
48
|
|
|
$this->attachments = $value; |
49
|
|
|
|
50
|
|
|
return $this; |
51
|
|
|
} |
52
|
|
|
|
53
|
|
|
public function message($value) |
54
|
|
|
{ |
55
|
|
|
$this->message = $value; |
56
|
|
|
|
57
|
|
|
return $this; |
58
|
|
|
} |
59
|
|
|
|
60
|
|
|
protected function beforePrepare(): bool |
61
|
|
|
{ |
62
|
|
|
// join in the products table |
63
|
|
|
$this->joinElementTable('contactform_submissions'); |
64
|
|
|
|
65
|
|
|
// select the columns |
66
|
|
|
$this->query->select([ |
|
|
|
|
67
|
|
|
'contactform_submissions.form', |
68
|
|
|
'contactform_submissions.subject', |
69
|
|
|
'contactform_submissions.fromName', |
70
|
|
|
'contactform_submissions.fromEmail', |
71
|
|
|
'contactform_submissions.attachments', |
72
|
|
|
'contactform_submissions.message', |
73
|
|
|
]); |
74
|
|
|
|
75
|
|
|
if ($this->form) { |
76
|
|
|
$this->subQuery->andWhere(Db::parseParam('contactform_submissions.form', $this->form)); |
|
|
|
|
77
|
|
|
} |
78
|
|
|
|
79
|
|
|
if ($this->subject) { |
80
|
|
|
$this->subQuery->andWhere(Db::parseParam('contactform_submissions.subject', $this->subject)); |
81
|
|
|
} |
82
|
|
|
|
83
|
|
|
if ($this->fromName) { |
84
|
|
|
$this->subQuery->andWhere(Db::parseParam('contactform_submissions.fromName', $this->fromName)); |
85
|
|
|
} |
86
|
|
|
|
87
|
|
|
if ($this->fromEmail) { |
88
|
|
|
$this->subQuery->andWhere(Db::parseParam('contactform_submissions.fromEmail', $this->fromEmail)); |
89
|
|
|
} |
90
|
|
|
|
91
|
|
|
if ($this->attachments) { |
92
|
|
|
$this->subQuery->andWhere(Db::parseParam('contactform_submissions.attachments', $this->attachments)); |
93
|
|
|
} |
94
|
|
|
|
95
|
|
|
if ($this->message) { |
96
|
|
|
$this->subQuery->andWhere(Db::parseParam('contactform_submissions.message', $this->message)); |
97
|
|
|
} |
98
|
|
|
|
99
|
|
|
return parent::beforePrepare(); |
100
|
|
|
} |
101
|
|
|
} |
102
|
|
|
|
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.