Does Yii put somewhere the actual file of a CComponent-derived class, so I won’t have to go through the hassle of using ReflectionClass::getFileName()?
In my particular case, I’m having a BaseController which is the base class for all of my controllers across all the modules. I won’t go through explaining all this, but I need to know the path to the extended controller within BaseController itself.
Right now I’m using ReflectionClass($this)->getFileName(), as I said above, which works, but it would be overkill if Yii already keeps track of that information somewhere.
What I need this for? (in case there might be a better, more elegant solution)
Uhm in the base class I need to do some nasty “smart” decisions about where to look for the viewPath. It’s not complicated, but not easy either. Practically I’m injecting a controller of a module (to which it belongs to from the filesystem perspective) into another module (via controllerMap), but I want that controller (each BaseController-derived class) to look for views inside it’s logical parent module from the filesystem, not what CController::$module holds.
Please ask for clarification if something is not understandable. However try to re-read the explanations above first while not forgetting it’s not the “usual” use case of controllerMap. I’m trying to only halfly get the controller into a module, with one foot into to module it doesn’t belong to (which works great with controllerMap), while the other (the render() & co functions) foot still makes the controller look for views into the FS directory relative to the original file path, i.e:
Short said: I’m looking for something like basePath, but for CControllers (or better, CComponents).