We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 577
    • 132 Posts
    Is there any possible way, bug or no bug that a resourceObject->save(); can in anyway create 2 resources. This is not global and I am creating hundreds of resource files through modx api externally with no issue. However at least 1 resources (that I have found) duplicates every single time with 2 resources in sequence with one another.

    I have gone as far as $resource->save();die; and I still get both resources.

    Note: This batch script ran previously with no issue on past versions. Currently on 2.1.1rc4 (yes I hope to get a window to update soon) but I can’t imagine that is the issue.

    This is the code that is running

    $resource = $modx->newObject('modResource');
            $resource->fromArray(array(
            'type'         => 'document',
            'contentType'  => 'text/html',
            'content_type' => 7,
            'template'     => $tpls['PMM_PCFG'],
            'parent'       => $settings['profiles_config'],
            'richtext'     => 0,
            'hidemenu'     => 1,
            'published'    => 1,
            'context_key'  => $PMM->st,
            'alias'        => $alias,
            'pagetitle'    => ($doDefault) ? $alias . ' (Main)' : $alias,
            'uri_override' => 1,
            'uri'          => 'profile-config/' . $alias
            ), '', true);
    
            $resource->save();echo 1;die;
    
      "One of these days I will get around to my own website... Its only been about 12 years... maybe tomorrow smiley"
      • 577
      • 132 Posts
      Ok for watever reason upgrading from rc4 to 2.1.1pl resolved the issue
        "One of these days I will get around to my own website... Its only been about 12 years... maybe tomorrow smiley"