I have a series of properties set as protected in my class which I meant to have them accessed externally through __set and __get. Unfortunately, it seems that since the properties do exist, the magic methods don't get called, but then I get an error "Cannot access protected property xxxxx", which I didn't meant to access directly, that's what I put the __set and __get magic methods there.

There is no problem if the variable has another name than the external property, if I use $obj->something and the variable is declared protected $_something, the magic methods are called, but then I have different 'external' names than the 'internal' ones, something which I wanted to avoid.

Since I want to have them with the same name, I might declare the variables public, but I wanted to use the magic methods to validate the values assigned to these variables.

Any ideas?

Thanks

Satyam

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to