Welcome Guest, Not a member yet? Register   Sign In
Documentation problem: Naming of Controllers & Models
#5

[eluser]orokusaki[/eluser]
The Answer:

Didn't read every bit of this post, but to answer the first question.

I too, was confused about this issue based on the docs - The answer is:

If you have a controller named blog, and you want create a model for it to abstract some of the db logic out of it, you should name the controller blog_model.

You cannot name the model blog also. CI will try to instantiate objects from two versions of the same class which is impossible. A fatal error will occur.

That's the reason for using the extra _model at the end, so you can maintain a similar naming convention without having any problems.

Similarly, if you intend of having a DB model class for overall db abstraction or to provide ORM-like functions to multiple controllers, you may want to name it something like Entries, or other based on the table name or whatever remains within your naming conventions.


Messages In This Thread
Documentation problem: Naming of Controllers & Models - by El Forum - 02-06-2008, 05:21 PM
Documentation problem: Naming of Controllers & Models - by El Forum - 02-06-2008, 05:30 PM
Documentation problem: Naming of Controllers & Models - by El Forum - 02-06-2008, 05:44 PM
Documentation problem: Naming of Controllers & Models - by El Forum - 02-18-2008, 03:23 PM
Documentation problem: Naming of Controllers & Models - by El Forum - 10-26-2008, 11:49 PM
Documentation problem: Naming of Controllers & Models - by El Forum - 10-27-2008, 02:56 AM
Documentation problem: Naming of Controllers & Models - by El Forum - 10-27-2008, 08:25 AM



Theme © iAndrew 2016 - Forum software by © MyBB