We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 42681
    • 64 Posts
    Creating a resource works like perfect by

    $response = $modx->runProcessor('resource/create', $fields);


    But running this code directly again with just changing the variables 'alias' and 'pagetitle' let the process stop. Does anybody have an idea what could be the reason for this?
    $response = $modx->runProcessor('resource/create', $fields);
    $fields['pagetitle'] = "Title-2";
    $fields['alias'] = "alias-2";
    $response = $modx->runProcessor('resource/create', $fields);


    Maybe it is not allowed to run 'runProcessor' again without resetting or closing something?
      • 3749
      • 24,544 Posts
      I can't think of any reason why that shouldn't work, though I think I did once file a bug about calling runProcessor() multiple times in a PhpUnit test. Have you tried this:

      if ($response->isError()) {
          $this->modx->log(modX::LOG_LEVEL_ERROR, $response->getMessage());
      }


      I remember also putting some debugging code in the runProcessor() call in the MODX class file and hacking file to solve the problem.
        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