We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 40404
    • 21 Posts
    Followed the Creating a Resource Class tutorial; now trying to link a custom db table to my CRC by incorporate info from the Doodles tutorial and the Extend modUser tutorial.

    Right now I'm getting an error when saving my CRC that the table does not exist; guessing I have to call addPackage at some point, but can't determine where. Is there a particular method in the ResourceCreateManagerController class I need to extend?

    This question has been answered by BobRay. See the first response.

    • discuss.answer
      • 3749
      • 24,544 Posts
      See if the table actually exists. If not, you need to call createObjectContainer() (just once), not addPackage() -- or create the table manually.

      Have you looked at ClassExtender? It takes most of the work out of the process by doing it for you.
        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
        • 40404
        • 21 Posts
        I just tried ClassExtender, but it looks like it only adds fields to the existing "Document" class? I need to create several different CRCs, in addition to the base Document. Is ClassExtender capable of that?

        However, being able to look at your examples helped me find my error: in my schema I had a table defined for the object extending modResource. So thanks!
          • 40404
          • 21 Posts
          Just for completeness, the other thing I was missing was:
          "tablePrefix":"ext_"
          in my extension_packages System Setting.
            • 3749
            • 24,544 Posts
            Quote from: smaddock at Sep 11, 2014, 10:44 AM
            I just tried ClassExtender, but it looks like it only adds fields to the existing "Document" class? I need to create several different CRCs, in addition to the base Document. Is ClassExtender capable of that?

            ClassExtender has a fairly extensive set of properties -- some in the form and some you'll see if you look at the code. I think you might be able to do what you want by setting them but I've never tried it.
              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