Results 1 to 2 of 2
I am trying to use the method getStaticPropertyValue and it is failing claiming that the static property doesn't exist but it does.
Code:
// Fails
$strValue = $objReflect->getStaticPropertyValue('tableName');
// Shows ...
- 08-24-2008 #1
PHP5 - Reflection API getStaticPropertyValue()
I am trying to use the method getStaticPropertyValue and it is failing claiming that the static property doesn't exist but it does.
I know I can use an if in the loop to get at the value of the property I want and that is what I am going to do for now, but there must be some reason why getStaticPropertyValue() is failing. I would like to understand what (if anything) I am doing wrong.Code:// Fails $strValue = $objReflect->getStaticPropertyValue('tableName'); // Shows that tableName does indeed exist foreach ($objReflect->getStaticProperties() as $name => $value) { echo "$name = $value<br>"; }
In case it is important, the static property is defined in a sub-class of the class that is trying to access it.If we hit that bullseye, the rest of the dominoes will fall like a house of cards. Checkmate! (Zapp Brannigan)
My new blog. It's probably not as good as I think it is.
- 08-24-2008 #2
OK, I redesigned the classes to avoid the static method and used a class constant and the getConstant() method of the ReflectionClass class.
It works now
If we hit that bullseye, the rest of the dominoes will fall like a house of cards. Checkmate! (Zapp Brannigan)
My new blog. It's probably not as good as I think it is.


Reply With Quote