access controller variables in a model |
[eluser]Unknown[/eluser]
Stumbled on this while we were investigating a similar situation. Took us a while to figure it out: the base CI_Model class contains this magic method: Code: function __get($key) This means that accessing any Model property that does not exist will fall back to accessing the same named property from the controller. So the code: Code: class Model { Here's more on the PHP magic methods: http://etutorials.org/Server+Administrat...l+Methods/ It probably is buried somewhere in the CI documentation or their changelog that they are doing this but couldn't find the place. Hope this helps! Vlad |
Messages In This Thread |
access controller variables in a model - by El Forum - 02-07-2012, 08:33 AM
access controller variables in a model - by El Forum - 02-07-2012, 01:38 PM
access controller variables in a model - by El Forum - 02-08-2012, 08:42 AM
access controller variables in a model - by El Forum - 08-21-2012, 12:57 PM
access controller variables in a model - by El Forum - 08-21-2012, 02:54 PM
|