I've been going through the source so I can understand the XF architecture, in order to prep myself to start making some new add-ons.
I was looking through resolveDynamicClass() in order to understand how the autoloading and class proxy stuff works. I get it now, except for the following snippet:
Does this mean that if you create a bunch of classes that get loaded dynamically via listeners, then the LAST dynamic one is the one that gets returned out from this function, instead of the original?
For example, if the codebase is doing resolveDynamicClass(ControllerPublic_Thread), but I have a class called MyAddon_Controller_Thread that extends it, does that mean this routine will return my child class instead of the originally requested class?
What's the purpose? Is this to allow the system to return a dynamically created child class instead of the original base, to allow for overloads? What if there are multiple products that are attempting to overload a base class's routine, does that mean the last one loaded is the one who wins?
I was looking through resolveDynamicClass() in order to understand how the autoloading and class proxy stuff works. I get it now, except for the following snippet:
Code:
foreach ($extend AS $dynamicClass)
{
// XenForo Class Proxy, in case you're wondering
$proxyClass = 'XFCP_' . $dynamicClass;
eval('class ' . $proxyClass . ' extends ' . $createClass . ' {}');
XenForo_Application::autoload($dynamicClass);
$createClass = $dynamicClass;
}
Does this mean that if you create a bunch of classes that get loaded dynamically via listeners, then the LAST dynamic one is the one that gets returned out from this function, instead of the original?
For example, if the codebase is doing resolveDynamicClass(ControllerPublic_Thread), but I have a class called MyAddon_Controller_Thread that extends it, does that mean this routine will return my child class instead of the originally requested class?
What's the purpose? Is this to allow the system to return a dynamically created child class instead of the original base, to allow for overloads? What if there are multiple products that are attempting to overload a base class's routine, does that mean the last one loaded is the one who wins?