Cannot pass variables from Controller to Model |
05-29-2016, 09:24 AM
(This post was last modified: 05-29-2016, 09:33 AM by PaulD. Edit Reason: Added PS )
Hi,
I thought that models and controllers were all part of the same context. A site I am building right now, I decided to set user_id as in the controller construct so I can access it in any called models and controller methods without having to fetch it all the time from the user_model nor pass it every model call. It is working fine, but are you saying that this is a bad idea? Or that is should not be working? I do not use it to send any other info like messages or other variables, but user_id I am referring to in every database call and every method, so I thought it was a handy approach that I had not used before. Paul. PS Or is it because the OP was not extending the CI_controller that it was a problem? |
Messages In This Thread |
Cannot pass variables from Controller to Model - by allenlee - 05-29-2016, 06:54 AM
RE: Cannot pass variables from Controller to Model - by Tpojka - 05-29-2016, 08:30 AM
RE: Cannot pass variables from Controller to Model - by skunkbad - 05-29-2016, 08:42 AM
RE: Cannot pass variables from Controller to Model - by ciadmin - 05-29-2016, 08:48 AM
RE: Cannot pass variables from Controller to Model - by PaulD - 05-29-2016, 09:24 AM
RE: Cannot pass variables from Controller to Model - by allenlee - 05-29-2016, 10:55 AM
RE: Cannot pass variables from Controller to Model - by albertleao - 05-29-2016, 10:57 AM
RE: Cannot pass variables from Controller to Model - by ivantcholakov - 05-29-2016, 12:25 PM
RE: Cannot pass variables from Controller to Model - by Narf - 05-30-2016, 04:34 AM
RE: Cannot pass variables from Controller to Model - by spjonez - 06-01-2016, 05:55 AM
|