samedi 28 mars 2020

how to get class from ReflectionProperty object?

I have a entity AdminEntity, and de code:

$reflect = new ReflectionClass(Project\Domain\Entity\AdminEntity);
$props   = $reflect->getProperties(
            ReflectionProperty::IS_PUBLIC | ReflectionProperty::IS_PROTECTED | 
            ReflectionProperty::IS_PRIVATE
           );

And with var_dump(prop[0]) I obtain:

object(ReflectionProperty)#28 (2) { ["name"]=> string(2) "id" ["class"]=> string(35) "Project\Domain\Entity\AdminEntity" }

Then, I can get name with: $prop[0]->getName() but do not exists getClass() method to get class of property.. is there any way to get the property class?

Thanks for advance.





Aucun commentaire:

Enregistrer un commentaire