-
-
Notifications
You must be signed in to change notification settings - Fork 39
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[2.1|3.0] proposal ActiveRecords class without validation first #14
Comments
In general entity should validate data that is set into it. If you don't need it for some reason, you can pass |
There are not technical issue, it's more about architecture. A lot of controversy about where to make the validation. I think this should be discussed. (I`ve troubles with access to facebook discussion) |
Usually entity validates itself and there could be more validation added in the layers wrapping it. These layers have an ability to disable entity validation. It all depends on the use case. |
it makes sense to disentangle ActiveRecord from Model. It shortens the inheritance tree and separates responsibilities |
Out of scope of this package. |
In some simple cases internal model validation not bad, but in more complex cases when validation is in separate classes and save/update operations wrapped into services/repositories, validation-scenario functional seems like overhead and thereare reasons for prohibit direct usage of
$model->load($data) && $model->validate()
and internal rules configuration;So my proposal - extract validation feature in trait and add something like SelfValidationInterface, instead of
BaseActiveRecord extends Model
The text was updated successfully, but these errors were encountered: