View Issue Details
ID | Project | Category | View Status | Date Submitted | Last Update |
---|---|---|---|---|---|
16391 | Bug reports | Plugins | public | 2020-06-16 21:45 | 2020-06-18 18:17 |
Reporter | gabrieljenik | Assigned To | |||
Priority | none | Severity | feature | ||
Status | new | Resolution | open | ||
Product Version | 3.22.20 | ||||
Summary | 16391: Allow beforeModelSave and Dynamic model events to do validations | ||||
Description | Currently, Although Yii does accept it by the As it, the objectve of the feature is to hook up the Yii isValid attribute from the modelEvent to the plugins. | ||||
Additional Information | Code SamplesPlease find below some code samples already developed as PoC.
Also please find below a sample plugin method implementation:
| ||||
Tags | No tags attached. | ||||
Bug heat | 6 | ||||
Complete LimeSurvey version number (& build) | 3.22.13 | ||||
I will donate to the project if issue is resolved | No | ||||
Browser | |||||
Database type & version | Mysql | ||||
Server OS (if known) | |||||
Webserver software & version (if known) | |||||
PHP Version | 7 | ||||
As per error messages, they could be added to the model. An alternative would be to add some kind of error message array to the LSActiveRecord, as to use for general errors output from the plugin events. |
|
Let me check if we can addError easily or if we need to allow update rules too … :) |
|
@gabrieljenik : not return TRUE finally : return parent ;) Else isValid by plugins can be only false , I like to have only : return |
|
You know what? |
|
You're right, https://www.yiiframework.com/doc/api/1.1/CActiveRecord#onBeforeSave-detail
I's an event … Only before validate return : https://github.com/LimeSurvey/LimeSurvey/blob/0d2e1df50ecd9bb2cbff8548837a29cc760b46ab/framework/base/CModel.php#L187 https://github.com/LimeSurvey/LimeSurvey/blob/master/framework/base/CModel.php#L152-L165 |
|
The name of the class cModelEvent doesn't help much. I guess part of all the confusion came from there. |
|
We don't have CModelevent ? Maybe it's totally impossible here to set isValid to false … |
|
Date Modified | Username | Field | Change |
---|---|---|---|
2020-06-16 21:45 | gabrieljenik | New Issue | |
2020-06-16 22:59 | gabrieljenik | Additional Information Updated | |
2020-06-16 23:00 | gabrieljenik | Note Added: 58320 | |
2020-06-16 23:04 | gabrieljenik | Note Edited: 58320 | |
2020-06-17 08:26 | DenisChenu | Note Added: 58321 | |
2020-06-18 08:44 | DenisChenu | Issue Monitored: DenisChenu | |
2020-06-18 08:47 | DenisChenu | Note Added: 58329 | |
2020-06-18 14:48 | gabrieljenik | Note Added: 58331 | |
2020-06-18 14:56 | DenisChenu | Note Added: 58332 | |
2020-06-18 17:42 | gabrieljenik | Note Added: 58338 | |
2020-06-18 18:17 | DenisChenu | Note Added: 58339 |