Welcome Guest, Not a member yet? Register   Sign In
Poll: Entity models?
You do not have permission to vote in this poll.
yes
43.18%
19 43.18%
no
18.18%
8 18.18%
maybe
38.64%
17 38.64%
Total 44 vote(s) 100%
* You voted for this item. [Show Results]

Entity models?
#9

I think the main problem is that, in the last few years, almost anything related to the Model in PHP MVC frameworks has been slapped with the label ORM, even when the main focus of the code in question has little to do with implementing any object-relational mapping patterns.

Further, CI is built with such a focus around the Controller that many of the models commonly used in CI do little to encapsulate the underlying data source. This, combined with the relatively thin nature of CI's DB class, tends to result in the view of CI's model as "collection-centric", though there's nothing in the model itself that makes it so.

Given the relative simplicity of CI's model, it might make more sense to create a class which represents a collection of models. In this way, the model itself remains untouched, but someone who wants to use the higher-level separation between the collection and the model would be inclined to structure the model to represent an individual record returned by the collection. Then the collection itself could be loaded by the controller and would return an instance of the model instead of a stdClass or an array.
Reply


Messages In This Thread
Entity models? - by jlp - 04-11-2015, 08:41 AM
RE: Entity models? - by albert.freeman - 04-13-2015, 03:40 PM
RE: Entity models? - by RWCH - 04-14-2015, 05:17 AM
RE: Entity models? - by gadelat - 04-14-2015, 05:52 AM
RE: Entity models? - by dmyers - 04-14-2015, 05:56 AM
RE: Entity models? - by sv3tli0 - 04-14-2015, 06:23 AM
RE: Entity models? - by kilishan - 04-16-2015, 09:48 PM
RE: Entity models? - by jlp - 04-16-2015, 11:31 PM
RE: Entity models? - by RWCH - 06-12-2015, 07:36 AM
RE: Entity models? - by mwhitney - 06-15-2015, 08:41 AM
RE: Entity models? - by mwhitney - 04-17-2015, 08:53 AM
RE: Entity models? - by Razican - 04-19-2015, 02:59 PM
RE: Entity models? - by PaulD - 04-20-2015, 07:27 AM
RE: Entity models? - by kilishan - 06-09-2015, 12:04 PM



Theme © iAndrew 2016 - Forum software by © MyBB