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 $message; |
15
|
|
|
|
16
|
|
|
public function form($value) |
17
|
|
|
{ |
18
|
|
|
$this->form = $value; |
19
|
|
|
|
20
|
|
|
return $this; |
21
|
|
|
} |
22
|
|
|
|
23
|
|
|
public function subject($value) |
24
|
|
|
{ |
25
|
|
|
$this->subject = $value; |
26
|
|
|
|
27
|
|
|
return $this; |
28
|
|
|
} |
29
|
|
|
|
30
|
|
|
public function fromName($value) |
31
|
|
|
{ |
32
|
|
|
$this->fromName = $value; |
33
|
|
|
|
34
|
|
|
return $this; |
35
|
|
|
} |
36
|
|
|
|
37
|
|
|
public function fromEmail($value) |
38
|
|
|
{ |
39
|
|
|
$this->fromEmail = $value; |
40
|
|
|
|
41
|
|
|
return $this; |
42
|
|
|
} |
43
|
|
|
|
44
|
|
|
public function message($value) |
45
|
|
|
{ |
46
|
|
|
$this->message = $value; |
47
|
|
|
|
48
|
|
|
return $this; |
49
|
|
|
} |
50
|
|
|
|
51
|
|
|
protected function beforePrepare(): bool |
52
|
|
|
{ |
53
|
|
|
// join in the products table |
54
|
|
|
$this->joinElementTable('contactform_submissions'); |
55
|
|
|
|
56
|
|
|
// select the columns |
57
|
|
|
$this->query->select([ |
|
|
|
|
58
|
|
|
'contactform_submissions.form', |
59
|
|
|
'contactform_submissions.subject', |
60
|
|
|
'contactform_submissions.fromName', |
61
|
|
|
'contactform_submissions.fromEmail', |
62
|
|
|
'contactform_submissions.message', |
63
|
|
|
]); |
64
|
|
|
|
65
|
|
|
if ($this->form) { |
66
|
|
|
$this->subQuery->andWhere(Db::parseParam('contactform_submissions.form', $this->form)); |
|
|
|
|
67
|
|
|
} |
68
|
|
|
|
69
|
|
|
if ($this->subject) { |
70
|
|
|
$this->subQuery->andWhere(Db::parseParam('contactform_submissions.subject', $this->subject)); |
71
|
|
|
} |
72
|
|
|
|
73
|
|
|
if ($this->fromName) { |
74
|
|
|
$this->subQuery->andWhere(Db::parseParam('contactform_submissions.fromName', $this->fromName)); |
75
|
|
|
} |
76
|
|
|
|
77
|
|
|
if ($this->fromEmail) { |
78
|
|
|
$this->subQuery->andWhere(Db::parseParam('contactform_submissions.fromEmail', $this->fromEmail)); |
79
|
|
|
} |
80
|
|
|
|
81
|
|
|
if ($this->message) { |
82
|
|
|
$this->subQuery->andWhere(Db::parseParam('contactform_submissions.message', $this->message)); |
83
|
|
|
} |
84
|
|
|
|
85
|
|
|
return parent::beforePrepare(); |
86
|
|
|
} |
87
|
|
|
} |
88
|
|
|
|
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.