We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 3749
    • 24,544 Posts
    It seems that you can get a document with getObject(’modDocument’,$criteria) or getObject(’modResource’,$criteria).

    OTOH, you can get a chunk with getObject(’modChunk’,$criteria) but not with getObject(’modElement’,$criteria).

    Is that by design?
      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
      • 10487 MODX Staff
      • 1,535 Posts
      I think it is by design, although Shaun and Jason will probably clarify smiley

      As far as I see it (with my still-not-quite-enough experience with xPDO), modResource represents a single table within the database (the same table as modDocument) so it’s quite easy to use them interchangeably with respects to retrieving a modDocument object.

      However, modElement is representative of several database tables, i.e. chunks, snippets etc. - so the problem when using modElement then becomes which type of element is required, and when primary keys are involved that becomes messy tongue
        Garry Nutting
        Senior Developer
        MODX, LLC

        Email: [email protected]
        Twitter: @garryn
        Web: modx.com
        • 3749
        • 24,544 Posts
        That sounds right to me. I see all modResources are in the site_content table. I wonder if we’ll be moving to having all the elements in a site_elements table down the road?
          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