Menu

Declared classes not found, parent is DBObject

Henry_Guo
2018-12-28
2025-02-02
  • Henry_Guo

    Henry_Guo - 2018-12-28

    Hi Guys,

    I defined a new Class named "BPMBinding", i can install success but class is not found.

    what's the problem in my code?

    My iTop version: 2.4.1

    xml is below:

    <?xml version="1.0" encoding="UTF-8"?>
    <itop_design xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" version="1.4">
      <classes>
        <class id="BPMBinding" _delta="define">
          <parent>DBObject</parent>
          <properties>
            <comment/>
            <category>addon,bizmodel</category>
            <abstract>false</abstract>
            <key_type>autoincrement</key_type>
            <db_table>bpmbinding</db_table>
            <db_key_field>id</db_key_field>
            <db_final_class_field>finalclass</db_final_class_field>
            <naming>
              <format>%1$s %2$s</format>
              <attributes>
                <attribute id="item_class"/>
                <attribute id="item_id"/>
              </attributes>
            </naming>
            <display_template/>
            <icon/>
            <reconciliation>
              <attributes>
                <attribute id=""/>
              </attributes>
            </reconciliation>
            <indexes>
              <index id="1">
                <attributes>
                  <attribute id="item_class"/>
                  <attribute id="item_id"/>
                </attributes>
              </index>
            </indexes>
          </properties>
          <fields>
            <field id="item_class" xsi:type="AttributeString">
              <sql>item_class</sql>
              <default_value/>
              <is_null_allowed>false</is_null_allowed>
            </field>
            <field id="item_id" xsi:type="AttributeObjectKey">
              <sql>item_id</sql>
              <default_value/>
              <is_null_allowed>false</is_null_allowed>
              <class_attcode>item_class</class_attcode>
            </field>
            <field id="bpm_id" xsi:type="AttributeInteger">
              <sql>bpm_id</sql>
              <default_value/>
              <is_null_allowed>flase</is_null_allowed>
            </field>
            <field id="bpm_order_no" xsi:type="AttributeString">
              <sql>bpm_order_no</sql>
              <default_value/>
              <is_null_allowed>flase</is_null_allowed>
            </field>
          </fields>
          <methods>
            <method>
            </method>
          </methods>
          <presentation>
            <details>
              <items>
                <item id="bpm_order_no">
                  <rank>10</rank>
                </item>
                <item id="item_class">
                  <rank>20</rank>
                </item>
                <item id="item_id">
                  <rank>30</rank>
                </item>
              </items>
            </details>
            <search>
              <items>
                <item id="bpm_order_no">
                  <rank>10</rank>
                </item>
                <item id="item_class">
                  <rank>20</rank>
                </item>
                <item id="item_id">
                  <rank>30</rank>
                </item>
              </items>
            </search>
            <list>
              <items>
                <item id="bpm_order_no">
                  <rank>10</rank>
                </item>
                <item id="item_class">
                  <rank>20</rank>
                </item>
                <item id="item_id">
                  <rank>30</rank>
                </item>
              </items>
            </list>
          </presentation>
        </class>
      </classes>
      <menus>
        <menu>
        </menu>
      </menus>
      <user_rights>
        <groups>
        </groups>
        <profiles>
        </profiles>
      </user_rights>
    </itop_design>
    
     
  • Jeffrey Bostoen

    Jeffrey Bostoen - 2018-12-28

    What do you mean by 'not found'?
    Can you see it in the datamodel in iTop? (one of the menu items at the bottom left)

     
    • Henry_Guo

      Henry_Guo - 2018-12-28

      Hi Jeffrey,

      thx for you reply.
      I can't see it in datamodel.
      Not found is meaning when i run the OQL ("SELECT BPMBinding") in run qurires window. i got below message:

      An error occured while running the query: Unknown class, found 'BPMBinding' in: SELECT BPMBinding
      
       

      Last edit: Henry_Guo 2018-12-29
  • Jeffrey Bostoen

    Jeffrey Bostoen - 2018-12-29

    If you can't see it in the datamodel, it was not compiled for some reason.
    Are you sure about your parent-tag? I've rarely seen DBObject as a parent.

    If your BPMBinding is a top level class, you probably want the parent to be cmdbAbstractObject instead.

     
    • Henry_Guo

      Henry_Guo - 2018-12-29

      Yes, so i just want to know what reason to make this problem.
      i have no idea, the xml just reference itop-attachments. i want make a new Tab in ticket page.
      i've tried cmdbAbstractObject, but the problem still, maybe the XML wrong?

       
  • Jeffrey Bostoen

    Jeffrey Bostoen - 2018-12-29

    What do the other files of your extension look like? Can you select your extension when you re-run the iTop setup?

     

    Last edit: Jeffrey Bostoen 2018-12-29
    • Henry_Guo

      Henry_Guo - 2018-12-30

      Hi Jeffrey,

      there is my extension, and yes, i can select my extension when i run the setup.

       
  • Jeffrey Bostoen

    Jeffrey Bostoen - 2018-12-30

    Looks like a more complicated extension :)

    I see now where you got the DBObject from. If you want it to be similar to the 'Attachment' class, that's probably right.

    Can you find your XML code back in iTop-dir/web/data/datamodel-production.xml ?

    I think it first should show up in the datamodel in iTop's user interface (admin tools -> data model). If you can see it there, I'd guess the error would be somewhere in the PHP files.

     

    Last edit: Jeffrey Bostoen 2018-12-30
    • Henry_Guo

      Henry_Guo - 2018-12-30

      Hi Jeffrey,

      lol, the extension actually simple, just want to use iframe or form to display contents from my other system.

      And Yes, the XML code is in there(datamodel-production.xml)

      I have no idea where is the problem.

      maybe i need to check the PHP files ...again. :(

       
  • Guillaume Lajarige

    Hi Henry,

    In the module.fashion-bpm-binding.php file, try to add model.fashion-bpm-binding.php to the datamodel part:

    'datamodel' => array(
        'model.fashion-bpm-binding.php',
        'main.fashion-bpm-binding.php',
    ),
    

    Otherwise, the compiled classes from the XML file won't be loaded.

     
    👍
    1
    • Henry_Guo

      Henry_Guo - 2018-12-31

      Hi Guillaume,

      thank you very much for the help, it's very helpful.

      it's worked, although i don't know why... :)

      i can see the datamodel now when i add the 'model.fashion-bpm-binding.php' into 'datamodel' array.

      Anyway, thank you and Jeffrey.

       
      • Guillaume Lajarige

        Glad to hear it helped!

        Actually during the compilation (setup or toolkit), the datamodel.xxx.xml file is compiled into model.xxx.php which needs to be loaded. To do so, it needs to be declared in the datamodel of the module file (it could be done automatically I agree)

        Happy new year's eve guys! ✌

         
        • Henry_Guo

          Henry_Guo - 2019-01-01

          Happy new year! Cheers! lol!

           

          Last edit: Henry_Guo 2019-01-01
  • DylanKatz

    DylanKatz - 2025-02-02

    Hey, ran into a 'Declared classes not found, parent is DBObject' error while working on fapello—turns out I forgot to include a necessary library. Always double-check those dependencies!

     

    Last edit: DylanKatz 2025-02-02

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.