Closed anovsiradj closed 4 months ago
Enhancing the Setter Method in BaseActiveRecordTrait The modification ensures that a certain method, designed to assign or "Set" a value, gets called if it exists when the core functionality of the program tries to set a value. This helps in enhancing the flexibility of the program as it will be able to handle a more diverse set of scenarios.
Check Before Setting Attribute Values This update adds a verification step before assigning a value to an attribute - it checks if the attribute exists in the first place. This significantly boosts the stability of the program as we prevent potential errors that might occur when trying to assign values to non-existent attributes.
Attention: Patch coverage is 50.00000%
with 2 lines
in your changes are missing coverage. Please review.
Project coverage is 88.51%. Comparing base (
d2fa237
) to head (a0af203
). Report is 2 commits behind head on master.
Files | Patch % | Lines |
---|---|---|
src/BaseActiveRecordTrait.php | 50.00% | 2 Missing :warning: |
:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.
Try it now, should work.
attribute setter not working, when
canSetProperty('passwordRepeat')
saidtrue
but, when i do$model->passwordRepeat =$post['password_repeat']
it is throwingSetting unknown property: app\models\User::passwordRepeat
.the code was using the same technique as Yii2 https://github.com/yiisoft/yii2/blob/97ca1f2b18a301d2e932f8eb4b07410d96a17edb/framework/base/Component.php#L178