1 | <?php |
||
19 | trait ActionErrors { |
||
20 | |||
21 | protected $actionErrors = array(); |
||
22 | protected $actionWarnings = array(); |
||
23 | |||
24 | /** |
||
25 | * Returns the number of action errors (those errors logged during predetermined actions such |
||
26 | * as saveAll() and deleteFull() |
||
27 | * |
||
28 | * @return integer number of errors |
||
29 | */ |
||
30 | public function hasActionErrors() |
||
34 | |||
35 | |||
36 | /** |
||
37 | * Returns the action errors (those errors logged during predetermined actions such |
||
38 | * as saveAll() and deleteFull() |
||
39 | * |
||
40 | * @return array array of action errors message and code |
||
41 | */ |
||
42 | public function getActionErrors() |
||
46 | |||
47 | |||
48 | /** |
||
49 | * Returns the action errors (those errors logged during predetermined actions such |
||
50 | * as saveAll() and deleteFull() as a simplifed message array |
||
51 | * |
||
52 | * @param boolean $noAttribute Exclude attribute name from error text |
||
53 | * @return array Action errors message and code |
||
54 | */ |
||
55 | public function getBasicActionErrors($noAttribute = false) |
||
67 | |||
68 | |||
69 | /** |
||
70 | * Returns the first action error |
||
71 | * |
||
72 | * @return array |
||
73 | * @see getActionErrors() |
||
74 | * @see addActionError() |
||
75 | */ |
||
76 | public function getFirstActionError() |
||
80 | |||
81 | /** |
||
82 | * Adds a new action error |
||
83 | * @param string $message new error message |
||
84 | * @param integer $code new error code |
||
85 | * @param string $attribute attribute to which the error applies |
||
86 | * @param string $modelName model to which the error applies |
||
87 | */ |
||
88 | public function addActionError($message, $code = 0, $attribute = '', $modelName = null) |
||
98 | |||
99 | |||
100 | /** |
||
101 | * Merge an existing array of action errors into the current models |
||
102 | * action errors |
||
103 | * @param array $errors array of action errors |
||
104 | */ |
||
105 | public function mergeActionErrors($errors) |
||
115 | |||
116 | |||
117 | /** |
||
118 | * Reset action errors, typically called ahead of predefined actions such as saveAll() and deleteFull() |
||
119 | */ |
||
120 | public function clearActionErrors() |
||
125 | |||
126 | /** |
||
127 | * Returns the number of action warnings (those warnings logged during predetermined actions such |
||
128 | * as saveAll() and deleteFull() |
||
129 | * |
||
130 | * @return integer number of warnings |
||
131 | */ |
||
132 | public function hasActionWarnings() |
||
136 | |||
137 | |||
138 | /** |
||
139 | * Returns the action warnings (those warnings logged during predetermined actions such |
||
140 | * as saveAll() and deleteFull() |
||
141 | * |
||
142 | * @return array array of action warnings message and code |
||
143 | */ |
||
144 | public function getActionWarnings() |
||
148 | |||
149 | |||
150 | /** |
||
151 | * Returns the action warnings (those warnings logged during predetermined actions such |
||
152 | * as saveAll() and deleteFull() as a simplifed message array |
||
153 | * |
||
154 | * @param boolean $noAttribute Exclude attribute name from error text |
||
155 | * @return array array of action warnings message and code |
||
156 | */ |
||
157 | public function getBasicActionWarnings($noAttribute = false) |
||
169 | |||
170 | |||
171 | /** |
||
172 | * Returns the first action warning |
||
173 | * |
||
174 | * @return array |
||
175 | * @see getActionWarnings() |
||
176 | * @see addActionWarning() |
||
177 | */ |
||
178 | public function getFirstActionWarning() |
||
182 | |||
183 | /** |
||
184 | * Adds a new action warning |
||
185 | * @param string $message new warning message |
||
186 | * @param integer $code new warning code |
||
187 | * @param string $attribute attribute to which the error applies |
||
188 | * @param string $modelName model to which the error applies |
||
189 | */ |
||
190 | public function addActionWarning($message, $code = 0, $attribute = '', $modelName = null) |
||
200 | |||
201 | |||
202 | /** |
||
203 | * Merge an existing array of action warnings into the current models |
||
204 | * action warnings |
||
205 | * @param array $warnings array of action warnings |
||
206 | */ |
||
207 | public function mergeActionWarnings($warnings) |
||
217 | |||
218 | } |
||
219 |