We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 50191
    • 1 Posts
    Hello there,

    I'm new to ModX and have been tasked to develop some functionality for a client which essentially has the following features:

    1. Connects to an API to get a list of people
    2. Allows for admins to enter and store answers to a particular question for those people
    3. Allows users to search for a list of those people relevant to them through that API
    4. Displays those answers for each of those people to the end user

    I've followed the Doodles tutorial and am still pretty daunted and confused. I understand the basics, but haven't been able to find a more comprehensive tutorial which includes having multiple models, tables, relationships, and adding functionality to query an API.

    Is there a more comprehensive tutorial out there for ModX Revolution that includes, at the very least, having multiple models and relationships?

    At the moment I'm not even sure how you would structure the extra to include such things!

    Any help you could provide would be greatly appreciated, thanks!
      • 3749
      • 24,544 Posts
      You might take a look at the MessageManager extra. It's somewhat similar to what you're doing, though it has no custom DB tables.

      If you end up rolling your own extra, I think ClassExtender might be a good place to start. If I'm understanding you, much of what you want could be accomplished by extending the modUser object (since all your data appears to be user-specific), and ClassExtender makes that fairly easy. It's also possible that any non-user-specific data you need to store could be handled by extending the modResource object, which ClassExtender also does.

      As far as a comprehensive tutorial, I don't know of anything beyond the notorious Doodles tutorial. There's an overview of the API for interacting with MODX objects here: http://bobsguides.com/revolution-objects.html.

      If you're developing a complex extra, you'll want to look at MyComponent, especially if you will be making a transport package from it.

      You might also look at MIGX to see if it would meet your needs.
        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
        • 44195
        • 293 Posts
        Hi I'm actually working on a some follow up tutorials to the doodles one at the moment based on what I've learned over the last couple of years. Could be a few weeks until the first in the series is out but it does work with multiple custom tables and their relationships although it's not focusing on foreign apis..

        Relationships are specified in your xpdo schema (a very basic one is shown in the doodles tutorial) but there are more complex examples in the documentation I believe.

        What problem are you having with implementing the api?
          I'm lead developer at Digital Penguin Creative Studio in Hong Kong. https://www.digitalpenguin.hk
          Check out the MODX tutorial series on my blog at https://www.hkwebdeveloper.com
          • 28042 ☆ A M B ☆
          • 24,524 Posts
          Yes, I would be inclined to go with one of BobRay's suggestions, either extend the user class or use MIGX. But then I'm lazy, and much prefer to use something that somebody else has already done most of the work on wink

          It all depends on what, exactly, #2 involves. If it's one question/answer per user, then ClassExtender would be my choice, as it would be the easiest to manage as well as the fastest to use for #3 and #4.
            Studying MODX in the desert - http://sottwell.com
            Tips and Tricks from the MODX Forums and Slack Channels - http://modxcookbook.com
            Join the Slack Community - http://modx.org