We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 577
    • 132 Posts
    aesmith - enminc Reply #1, 11 years ago
    When table is created and/or updated through the "Extend modUser" resource the existing `userdata_id` index as well as any additional indexes created are not actually created on the table. The userdata.map.inc.php file properly reflects the indexes but are not actually created in mysql
      "One of these days I will get around to my own website... Its only been about 12 years... maybe tomorrow smiley"
      • 3749
      • 24,544 Posts
      CE just calls $manager->createObjectContainer($object) where object is the name of the class being extended minus the 'mod' (e.g., User or Resource), plus 'Data'. I don't think the schema is actually used at that point. I think it uses the parent class's class and map files, which wouldn't contain your indexes.

      I don't think that was the intention, but it was a while ago and I can't remember for sure.

      The relevant code in the ClassExtender class file (core\components\classextender\model\classextender\classextender.class.php) is:

      (from line 81)

      $this->ce_package_name = isset($_POST['ce_package'])
                  ? $_POST['ce_package']
                  : $this->modx->getOption('package', $this->props, 'extendeduser');
      
              $this->packageLower = strtolower($this->ce_package_name);
      
              $this->ce_parent_object = isset($_POST['ce_parent_object'])
                  ? $_POST['ce_parent_object']
                  : $this->modx->getOption('parentObject', $this->props, 'modUser');
      
              $this->ce_class = isset($_POST['ce_class'])
                  ? $_POST['ce_class']
                  :$this->modx->getOption('class',
                      $this->props, $this->ce_parent_object);
      
              /* Strip off 'mod' to produce 'User' or 'Resource' */
      
              $this->objectPrefix = substr($this->ce_parent_object, 3);
              $this->objectPrefixLower = strtolower($this->objectPrefix);
      


      and these lines at line 245:

          $object = $this->objectPrefixLower . 'Data';
          $success = $manager->createObjectContainer($object);


      I think this comes from a previous version where CE actually extended modUser and modResource, so their indexes were relevant. I don't have time to work on it right now, but you might try changing that last line to:

      $success = $manager->createObjectContainer($this->ce_class);


      and see what that gets you. It might create the table properly and, with luck, it might not break the snippet, though I wouldn't put a lot of money on it. wink

      [ed. note: BobRay last edited this post 11 years ago.]
        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
        • 577
        • 132 Posts
        aesmith - enminc Reply #3, 11 years ago
        Latest 2.4
          "One of these days I will get around to my own website... Its only been about 12 years... maybe tomorrow smiley"