Skip to content
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

BaseActiveRecordTrait allow attribute setter #298

Closed
wants to merge 1 commit into from

Conversation

anovsiradj
Copy link

Q A
Is bugfix? ✔️
New feature?
Breaks BC? ✔️❌ (maybe)
Fixed issues comma-separated list of tickets # fixed by the PR, if any

attribute setter not working, when canSetProperty('passwordRepeat') said true but,
when i do $model->passwordRepeat =$post['password_repeat'] it is throwing
Setting 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

Copy link

what-the-diff bot commented Mar 30, 2024

PR Summary

  • 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.

Copy link

codecov bot commented Mar 30, 2024

Codecov Report

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 ⚠️
Additional details and impacted files
@@             Coverage Diff              @@
##             master     #298      +/-   ##
============================================
- Coverage     88.63%   88.51%   -0.12%     
- Complexity      575      576       +1     
============================================
  Files             7        7              
  Lines          1302     1306       +4     
============================================
+ Hits           1154     1156       +2     
- Misses          148      150       +2     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@Tigrov
Copy link
Member

Tigrov commented May 23, 2024

Try it now, should work.

@Tigrov Tigrov closed this May 23, 2024
@anovsiradj anovsiradj deleted the patch-1 branch May 23, 2024 06:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants