Welcome Guest, Not a member yet? Register   Sign In
how can I "jump" (request) from controller to controller???
#11

[eluser]johnwbaxter[/eluser]
Looking at the example of the original thread i felt that he didn't actually need what he was asking for, he needed a user library.
#12

[eluser]webthink[/eluser]
@wiredesizgnz
At the risk of taking this thread off topic (agree with audiopleb, OP is, I think, asking for library functionality and doesn't actually need controllers to interact with one another) what do you mean when you say "Using libraries for any type of interaction between MVC components is bad practice"? What sort of interaction are referring to?
#13

[eluser]Pygon[/eluser]
I disagree with webthink and audiopleb.

Viewing his original post, he should have a user object model which handles all user information and provides accessors to libraries using the stored information. Another advantage of this is that the user model could employ a storage procedure that stores specific information into a session variable so that the data doesn't need to be pulled from the database again (common user data).

A library really should not be instantiated or hold information for a specific user as it should be something common.

Atleast, that's my opinion.
#14

[eluser]webthink[/eluser]
OK the difference between using a model or library here is largely semantic. If there is common business logic that needs to be repeated in a number of controllers then a library is one solution (there are other solutions for modularity). If all that's needed is a way to interact with the db then a model is definitely what the OP is after. The OP doesn't go into that level detail. They state that they want a modular solution so it depends where they want the modularity... business logic or data layer.
#15

[eluser]johnwbaxter[/eluser]
@Pygon I am very much of the thinking that models should only hold db interaction and nothing else.

This:

$users->check();

should be part of a whole set of user related functions such as creating a user and forgotten passwords and stuff like that. Therefore you would be putting more into a model than just db calls.

However, i think we're all missing the point(and confusing the OP) in that you can do it how you want with CI and it is up to your preference. I really don't think there is a defacto way to do it.




Theme © iAndrew 2016 - Forum software by © MyBB