MODX3 - Unable to load processor for action again


I try to use a processor, but the path not found:

Unable to load processor for action "distributorresource\processors\remove", it does not exist as an autoloadable class that extends \MODX\Revolution\Processors\Processor, and also not as a file in "/www/audiomap-migrate/core/src/Revolution/Processors/distributorresource\processors\remove.class.php"

I have a bootstrap.php file in components folder:

try {
    $modx->addPackage('DistributorResource\Model', $namespace['path'] . 'src/', null, 'DistributorResource\\');
catch (\Exception $e) {
    $modx->log(xPDO::LOG_LEVEL_ERROR, $e->getMessage());

$modx->services->add('distributorresource', function($c) use ($modx) {
    return new DistributorResource\DistributorResource($modx);

May be I didn’t understood modx3 concept…
what do I have made wrong

in js i use the following:

      url: MODx.config.connector_url,
      params: {
        action: "DistributorResource\\processors\\remove",
        id: selectedId,

thank you very much


In your “src” folder, do you have a subfolder “processors” (all lower case letters) with a file “remove.php” (all lower case letters) that contains a class remove (in the correct namespace)?

yes, subfolder “processors” in lowercase and a processor file “remove.php”.
in the remove.php:

use MODX\Revolution\Processors\Model\RemoveProcessor;

class remove extends RemoveProcessor
    public $classKey = 'modResource';

    public function initialize() {
    	$primaryKey = $this->getProperty('id');

    	if (empty($primaryKey)) 
            return $this->modx->lexicon($this->objectType.'_err_ns');

    	$this->object = $this->modx->getObject($this->classKey, $primaryKey);

    	if (empty($this->object)) return $this->modx->lexicon($this->objectType.'_err_nfs',array($this->primaryKeyField => $primaryKey));
    	return parent::initialize();
    public function removeObject() {
    	$this->object->setTVValue('tv_distributor', '');


I still don’t understand the connections… :roll_eyes:

should the alias also in lowercase?
" ```

I believe your are missing the “namespace” at the top of your remove.php file:

namespace DistributorResource\processors;

The namespace must corresponds to the file structure, so that the autoloader works correctly.

omg. you are right.

Thank you so much… :pray:

1 Like