I need to access a const like this:
dump (Accomodation::MAX_IMAGES);
but I only have the string class name but not the class itself. For example, I have this string 'AppBundle:Accomodation' but I don't have the class Accomodation to access its static properties.
Any idea for Symfony?
use AppBundle\Classes\Accomodation(or whatever place you've created the Accomodation class), and it's enough to write it as you already did:dump(Accomodation::MAX_IMAGES). That static property needs to be public accessible.usestatement. Here, this might help you.$class::C, or(new ReflectionClass($class))->getConstant($c)? Do you need it be called "a part of Symfony"? Or do you think Symfony can do it better?