Types in data models |
Hello
It would be nice to have automatic parsing of base types for data model operations For example i have this table: Code: CREATE TABLE `setting` ( Code: { "id: 1, "name": "Alex", "extraData": {"someData": "someValue"}} It might be convinient to have optional protected Code: $types Code: CodeIgniter\Model PHP Code: $types = [ afterFind afte
Use Entity class with cast functions. Apply $returnType in models SomeEntity::class
For return all properties typed use method toArray() https://codeigniter4.github.io/userguide...tity-usage (12-25-2022, 05:49 AM)ozornick Wrote: Use Entity class with cast functions. Apply $returnType in models SomeEntity::class I don't need and don't want to use `Entity` class That's much of extra code and overcomplication for a simple natural feature cl Code: class User extends Entity (12-25-2022, 10:11 AM)luckmoshy Wrote: it is a good idea and of cause @ruslan even i certain days stuck on the same issue but unfortunately, CI has no this way unless you PR to it I do want to PR to it Just asking for the opinion of the main CI developers on this and checking if there is something already created for this that i might be missing.
I'm trying to implement like this feature.
https://github.com/codeigniter4/CodeIgniter4/pull/8230 and the upcoming next PR.
This PR is ready to review: https://github.com/codeigniter4/CodeIgniter4/pull/8243
If you have interest, try and/or review.
I think this PR is ready to merge.
https://github.com/codeigniter4/CodeIgniter4/pull/8243 If you have interest, try it. |
Welcome Guest, Not a member yet? Register Sign In |