We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 18174
    • 116 Posts
    I'm building a CMP for managing extended User Group data.
    I created my own tables/schema/model classes which I have access to.
    Now I try to extend modUserGroup to link my tables to it, but no success. I simplified the schema with
    <?xml version="1.0" encoding="UTF-8"?>
    <model package="WPCalc" baseClass="xPDOObject" platform="mysql" defaultEngine="MyISAM" version="1.1">
      <object class="extModUserGroup" extends="modUserGroup">
      </object>....
    just to achieve the extModUserGroup class extention. But I get no data, no error, just nothing. When I use modUserGroup directly everything works fine. I built the extmodusergroup model classes, but didn't touch metadata.mysql.php. Is this the reason? Is there a way to debug xPDO results?
    regards manu

    Edit: If I load the package in a snippet, a $modx->getCollection call fails with "Fatal error: Class 'modUserGroup' not found in core/components/WPCalc/model/WPCalc/extmodusergroup.class.php" Do I have to load the core model myself if I extend a certain class?

    [ed. note: manu37 last edited this post 13 years, 7 months ago.]
      • 3749
      • 24,544 Posts
      Did you regenerate the class and map files whenever the schema changed?

        Did I help you? Buy me a beer
        Get my Book: MODX:The Official Guide
        MODX info for everyone: http://bobsguides.com/modx.html
        My MODX Extras
        Bob's Guides is now hosted at A2 MODX Hosting
        • 18174
        • 116 Posts
        Hi Bob, thanks for the patience.
        Yes, I did. I have installed the CMPGenerator and reran the component after modifying the schema with build schema=no and build package=yes. The errormsg remains the same. My test snipped looks like this:
        $modx->addPackage('WPCalc', MODX_CORE_PATH . 'components/WPCalc/model/','modx_');
        $user = $modx->getCollection('extModUserGroup'); 
        var_dump(count($user));
        return;
        The same snippet with 'modUserGroup' or one of my added tables works.
        regards
        manu

        PS: the extmodusergroup.class.php looks like this:
        <?php
        class extModUserGroup extends modUserGroup {}
          • 3749
          • 24,544 Posts
          Check the return value of $modx->addPackage(). It returns false on failure.
            Did I help you? Buy me a beer
            Get my Book: MODX:The Official Guide
            MODX info for everyone: http://bobsguides.com/modx.html
            My MODX Extras
            Bob's Guides is now hosted at A2 MODX Hosting
            • 22303 MODX Staff
            • 10,725 Posts
            There is not currently a way to extend modUserGroup in the core like there is modUser. It would make a great feature request in the tracker though...
              • 18174
              • 116 Posts
              @BobRay: addPackage is successfull since I have access to my own tables/xPDO Objects.

              @opengeek:Is this true? My goal is just a simple SELECT LEFT JOIN query over two tables in my modObjectGetListProcessor extension. I'm far away of diminish your efforts, but where are the Expanding Possibilities gone?

              So what's the way to manage my extended usergroup data? Set up a CMP with the userGroup Grid which provides the userGroup id of the selected row, which is handed over to a next component where I search my extended data that matches to that userGroup ID?