Welcome Guest, Not a member yet? Register   Sign In
Collisions with library and variables?
#1

[eluser]doors[/eluser]
What if I load a library name category in a controler. This will be accessible with $this->category;

What if I have a class variable within that controller with the same name category, what would happen?
#2

[eluser]Seppo[/eluser]
Quote:What if I load a library name category in a controler. This will be accessible with $this->category;
YEs

Quote:What if I have a class variable within that controller with the same name category, what would happen?
When you load the library, it will overwrite the variable value... probably not a good idea.
I've done it once with a model named address and another model named user with an address attribute...
#3

[eluser]m4rw3r[/eluser]
The value of the variable will be overwritten, and it also works the other way around.
So i suggest that you call your class properties something not so likey to be a model, library etc, or put a prefix on the property.

EDIT: Sorry, didn't see your post




Theme © iAndrew 2016 - Forum software by © MyBB