Model class- and member naming - Printable Version +- CodeIgniter Forums (https://forum.codeigniter.com) +-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20) +--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forumdisplay.php?fid=23) +--- Thread: Model class- and member naming (/showthread.php?tid=7728) |
Model class- and member naming - El Forum - 04-21-2008 [eluser]mark17[/eluser] L.S. The following fatal error is what i get in at least CodeIgniter 1.6.1, perhaps it's present in older versions but haven't tried it. Code: Fatal error: Cannot access private property Test::$test in /home/markus/public_html/brochureselectie.nl/trunk/sys/libraries/Model.php on line 69 This is produced when some model attempts to set a classvariable with the same name, like the snippet below. Code: <?php I'm unsure whether or not this is an existing and an already reported bug, although a search for model related issues did not result in any bug alike. Any thoughts on this one? It should not be a problem to have ambiguous naming within some class. This could also cause dynamically generated errors when some code using __set() methods to dynamically assign new variables to the scope. Code: <?php The last snippet will generate the following output, possibly because __set will catch not only my assignment of $this->test but a lot more internal stuff. Please try... Regards, Model class- and member naming - El Forum - 07-23-2008 [eluser]Dan Murfitt[/eluser] I'm also getting this problem with a model I've created containing a private $email field. I've only noticed the problem once I've started to use the email library (which I guess has a private $email field too?). Here's the message I'm getting: Code: Fatal error: Cannot access private property Usermodel::$email in C:\xampp\htdocs\pm4\system\libraries\Model.php on line 69 Are there reserved field names which can't be used in custom libraries and models? Thanks |