-
Notifications
You must be signed in to change notification settings - Fork 1.9k
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
Model Class To Array Does Not Use Get Magic Method Or Allowed Fields Property #427
Comments
I am generally good with this, and will help get the Entity classes actually working correctly, as was discussed on the forums. I'd like to know a tad more about how you plan to implement things:
|
@lonnieezell I'll try to get an example of what I'm currently doing, it's a little messy and could probably use improving, but I think it's a good starting point. Entities can be a very powerful part of CodeIgniter I would imagine. |
@lonnieezell How would be best to show you an example of what I'm currently doing? I could upload it and provide you with a link. |
@EpicKris You could do that, or provide a GIST, or, if it's short enough, put it here in a code block. |
Here is a GIST of my entities and data mappers: https://gist.github.com/EpicKris/619903892899843fe6596561ba2d7b70 |
Looks a little more involved than I would want to put into core at this moment. I've written and erased 3 different replies so far. :) The more I think about this, though, the more I think the best solution might be to implement a new Here's my thinking, let me know your thoughts:
|
On the surface, entities and data mappers seem like a simple task, but the more you play with them, the more complex they seem to become. While I agree with your thoughts, I did notice that there's an |
Because the
Model->classToArray()
method use reflection, it does not get values use the__get()
magic method and could produce incorrect data, also I believe if theModel->allowedFields
property is set then it should attempt to get those properties from the class too.If this is something that's agreed I can implement this and create a pull request.
The text was updated successfully, but these errors were encountered: