XF 2.2 Extended class not being called, I don't have a clue why.

Cylon

Member
Dear Friends:
I want to extend the class XF\Api\Result\EntityResult, to add some custom magic to the method render of this class.
I followed the same process I used for other classes that I'm extending.
  • created php file for the extended class in my addon
  • added a class extension in the dashboard with the correct source and target namespaces
  • the extension_hint files and the other output files are generated correctly,
  • then I implement the class, extending XFCP_EntityResult, and override the method I want to extend.

But, the code that I added to the method, is never called, nor are the breakpoints hit in debug mode when I set them. When I debug step per step, and the method "render" is called somewhere, then instead jumping into my extended class, xf is jumping into the original class (also, the parent class).
I'm really without ideas. I checked all generated output files, and they seem all fine. The extension_hint seems fine. Intellij recognizes and finds the new extended class. I deleted and added the class extension many times, just in case that helps, without success. I'm without ideas and I find it very strange because this is working correctly for a lot of other classes that I'm extending in the same way.

Maybe somebody has an idea what is going on?

Thanks!
 
Thank you for your answer. Is there an easy way to recognize which classes can be extended and which not?
 
Thank you for your answer. Is there an easy way to recognize which classes can be extended and which not?
Yes, you need to look in the XenForo code to see how it is created. If it is created by calling the extendClass function from the \XF\App class, then it can be extended. If it is created with the normal new ClassName construct, then it cannot be extended using the XenForo class extension system.

1678186716694.png
1678186752572.png
 
Top Bottom