We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 37031
    • 93 Posts
    Wow this is forum GOLD smiley ! Dunnock, Bruno, and Bob, thank you so much for taking the time to provide awesome responses. There's more than enough information here to keep me inspired and exploring, especially regarding my third question. I'm still very much a noob at this and learning from experts in the community has always been my biggest resource. Thanks again!!!
      • 3749
      • 24,544 Posts
      Quote from: Bruno17 at May 20, 2013, 04:34 AM
      As soon as you use any of this xPDO-methods : newQuery, newObject, getObject, getCollection and some others and you have used addPackage before doing so, 'loadClass' is called internally either in the xPDO-method direcly or inside of the xpdoobject - class

      OK, so is it fair to say that using addPackage() only makes sense if the package has objects (with schemas) that you want to instantiate or search for?
        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
        • 42602
        • 81 Posts
        Quote from: BobRay at May 20, 2013, 06:56 PM
        OK, so is it fair to say that using addPackage() only makes sense if the package has objects (with schemas) that you want to instantiate or search for?

        Pretty much. When reading addPackage()'s source code; key points that catch my eyes are adding the package path, table prefix (if set) and loading meta map. And like Bruno17 pointed out, the loadClass is run internally all the time within the xPDO classes/objects.

        These functions start to blow me head, as loadClass has more obviously wink it can be used to load transient classes and getService does it that way actually. But would guess that these could be updated to documentation, the examples are quite short most of the time.
          • 3749
          • 24,544 Posts
          That's because the docs were mostly written by people (myself included) who didn't fully understand those methods. wink
            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