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

Make entity values _raw for before passing to DB. #1647

Closed
wants to merge 1 commit into from

Conversation

nowackipawel
Copy link
Contributor

related to issue 1646

@lonnieezell
Copy link
Member

Yeah, not a fan of adding yet another argument to that method. As mentioned in #1646 I think a better solution would be a new method, toRawArray().

@nowackipawel
Copy link
Contributor Author

There was already argument called $cast. I've renamed it cuz it doesn't mean just cast anymore.

Pls lemme know what your final decision is. Should I write method what you mentioned above ?

Btw: what about mine concerns about validation rules in this particular case? Should we pass $data converted by getMyVariable methods to validation and raw data to database (in insert/update)? Won't it look weird ?
In my opinion to make it fully work we need one type of behavior for raw - database, second with using getMyVariable - validation, and third with getMyVariable and casting for normal work with entities. :/

@lonnieezell
Copy link
Member

Validation should get the raw value, also. The getX methods are intended to provide ways to change how the data is represented outside of the class, like when used in views, etc, NOT to actually change the data itself. Validation should be done on the data itself.

I'll implement a toRawArray() method.

@lonnieezell lonnieezell closed this Feb 6, 2019
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.

2 participants