Menu

altering a class

schirrms
2024-05-03
2024-05-06
  • schirrms

    schirrms - 2024-05-03

    Hi,

    I must be totally blind today, but, following (more or less) this tutorial :
    https://www.itophub.io/wiki/page?id=2_7_0:customization:cascade-update

    I try to add a field in the 'VirtualMachine' class, and to activate a calculation on this field. I wrote my php function in my main.{my-extension}.php file, but the function (OnUpdate) doesn't overide the 'standard' OnUpdate function. If I try to call my embedding class 'VirtualMachine' the setup hangs because this class already exists, and I don't see a way to 'extends' VirtualMachine on VirtualMachine. This is probably just my poor PHP understanding ?

    Any help very welcome 😊

    TIA,

    Pascal

     
  • Jeffrey Bostoen

    Jeffrey Bostoen - 2024-05-03

    You'd need to do it using XML; and then override the method in one of the XML nodes ;)

     
    • schirrms

      schirrms - 2024-05-06

      Hi Jeffrey,

      Thanks for your answer, I had also that feeling. So, in that case, if I redefine 'UnUpdate' for VirtualMachine, and another extension does the same, one of us will loose…

      That's probably at least one of the reasons behind the 'CRUD events' who starts with iTop 3.1: https://www.itophub.io/wiki/page?id=3_1_0:customization:extensions_api
      But, at the moment, I'm stuck with iTop 2.7

      Well, it should do the job…

      Thanks again,

      Pascal

       

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.