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
    Is there a limit on how deeply you can nest the attributes array?

    This code works, but there’s an error installing the plugin events.

    <?php
    /* create category vehicle */
    $attr = array(
        xPDOTransport::UNIQUE_KEY => 'category',
        xPDOTransport::PRESERVE_KEYS => false,
        xPDOTransport::UPDATE_OBJECT => true,
        xPDOTransport::RELATED_OBJECTS => true,
        xPDOTransport::RELATED_OBJECT_ATTRIBUTES => array (
            'Snippets' => array(
                xPDOTransport::PRESERVE_KEYS => false,
                xPDOTransport::UPDATE_OBJECT => true,
                xPDOTransport::UNIQUE_KEY => 'name',
            ),
            'Chunks' => array(
                xPDOTransport::PRESERVE_KEYS => false,
                xPDOTransport::UPDATE_OBJECT => true,
                xPDOTransport::UNIQUE_KEY => 'name',
            ),
            'Plugins' => array(
                xPDOTransport::PRESERVE_KEYS => false,
                xPDOTransport::UPDATE_OBJECT => true,
                xPDOTransport::UNIQUE_KEY => 'name',
                xPDOTransport::RELATED_OBJECT_ATTRIBUTES => array (
                    'PluginEvents' => array(
                    xPDOTransport::PRESERVE_KEYS => true,
                    xPDOTransport::UPDATE_OBJECT => false,
                    xPDOTransport::UNIQUE_KEY => array('pluginid','event'),
                    ),
                ),
            ),
    
            'Templates' => array(
                xPDOTransport::PRESERVE_KEYS => false,
                xPDOTransport::UPDATE_OBJECT => true,
                xPDOTransport::UNIQUE_KEY => 'templatename',
            ),
            'TemplateVars' => array(
                xPDOTransport::PRESERVE_KEYS => false,
                xPDOTransport::UPDATE_OBJECT => true,
                xPDOTransport::UNIQUE_KEY => 'name',
            ),
        )
    );
      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
      • 28215
      • 4,149 Posts
      I have found issues when trying to do related objects of related objects. I usually try to avoid going over 1 level deep.
        shaun mccormick | bigcommerce mgr of software engineering, former modx co-architect | github | splittingred.com
        • 3749
        • 24,544 Posts
        Quote from: splittingred at Jan 19, 2011, 07:46 AM

        I have found issues when trying to do related objects of related objects. I usually try to avoid going over 1 level deep.

        So I guess the same would go for templates with related TVs.

        It’s too bad. It would be nice to get those elements into a category without having to do extra work in a resolver.

        Do you think the issue is in package builder or xPDO?
          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
          • 28215
          • 4,149 Posts
          Quote from: BobRay at Jan 19, 2011, 10:53 AM

          So I guess the same would go for templates with related TVs.
          It’s too bad. It would be nice to get those elements into a category without having to do extra work in a resolver.
          Do you think the issue is in package builder or xPDO?

          xPDO. Seems to break when dealing with related objects of related objects; something about the foreign key of the 2nd level objects not getting set correctly.
            shaun mccormick | bigcommerce mgr of software engineering, former modx co-architect | github | splittingred.com