MODX3: CMP Requested processor not found

Hello,

searched for hours… don’t find the mistake…

I the javascript I have the processor call:

    baseParams: {
        action: 'customer\\Processors\\Customers\\GetList'
    },

the physical path of the file is:

core\components\customer\src\Processors\Customers\GetList.php

I tested with several variations, but I got always

Requested processor not found

the code of processor GetList.php:


<?php

namespace customer\Processors\Customers;

use MODX\Revolution\Processors\Model\GetListProcessor;
use customer\Model\Customers;

class GetList extends GetListProcessor
{
    public $classKey = Customers::class;
    public $defaultSortField = 'lastname';
    public $defaultSortDirection = 'ASC';
    public $objectType = 'customer.customers'
}

in error log:

Unable to load processor for action "customer\src\Processors\Customers\GetList", it does not exist as an autoloadable class that extends \MODX\Revolution\Processors\Processor, and also not as a file in "/www/xxx/core/src/Revolution/Processors/customer\src\Processors\Customers\GetList.class.php"

what am I doing wrong?

thank you for feedback.

Bye
Chris

Do you use a custom connector-file or MODx.config.connector_url?
Do you have a bootstrap.php file to add the package? What’s the content?

I use MODx.config.connector_url

I have bootstrap.php


<?php

/**
 * @var \MODX\Revolution\modX $modx
 * @var array $namespace
 */

use customer\customers;
use xPDO\xPDO;

// Add the service
try {
    // Add the package and model classes
    $modx->addPackage('customer\Model', $namespace['path'] . 'src/', null, 'customers\\');

    if (class_exists('customer\\customers')) {
        $modx->services->add('customer', function($c) use ($modx) {
            return new customer($modx);
        });
    }
}
catch (\Exception $e) {
    $modx->log(xPDO::LOG_LEVEL_ERROR, $e->getMessage())

followed your youtubes:

thank you.

Maybe try changing the last parameter in this line to customer\\ (without the s).

$modx->addPackage('customer\Model', $namespace['path'] . 'src/', null, 'customers\\');

you mean so?

$modx->addPackage('customer\Model', $namespace['path'] . 'src/', null, 'customer//');

without success…

No I mean like this (with backslashes instead of normal slashes):

$modx->addPackage('customer\Model', $namespace['path'] . 'src/', null, 'customer\\');

sorry, yes.

but without success. everytime the same error messages in error log


<?php

/**
 * @var \MODX\Revolution\modX $modx
 * @var array $namespace
 */

use customer\customer;
use xPDO\xPDO;

// Add the service
try {
    // Add the package and model classes
    $modx->addPackage('customer\Model', $namespace['path'] . 'src/', null, 'customer\\');
}
catch (\Exception $e) {
    $modx->log(xPDO::LOG_LEVEL_ERROR, $e->getMessage());
}

@halftrainedharry Does $modx->addPackage also add an autoloader to the directory? Usually I have a composer.json to define my namespace/path and a require __DIR__ . '/vendor/autoload.php'; in the bootstrap.php which makes it available in-memory…

…but I’ve not yet seen that YouTube video (thanks for sharing!) and haven’t made any 3.0-only extras yet so I’m not sure if that’ll work on its own, too.

no, there is no composer.json in component directory.

@markh The example relies on the bootstrap.php file created by the extra ExtraBuilder and should work.

@fritzkola Can you share your schema?

<?xml version="1.0" encoding="UTF-8"?>
<model package="customer\Model" baseClass="xPDO\Om\xPDOObject" platform="mysql" defaultEngine="InnoDB" phpdoc-package="" version="3.0">
  <object class="Customers" table="customers" extends="xPDO\Om\PDOObject">
    <field key="id" dbtype="int" precision="11" phptype="integer" null="false" default=""/>
    <field key="presspass_user_eid" dbtype="int" precision="11" phptype="integer" null="false" default="0"/>
    <field key="title" dbtype="varchar" precision="100" phptype="string" null="false" default="m"/>
    <field key="firstname" dbtype="varchar" precision="100" phptype="string" null="false" default=""/>
    <field key="lastname" dbtype="varchar" precision="100" phptype="string" null="false" default=""/>
    <field key="street" dbtype="varchar" precision="100" phptype="string" null="false" default=""/>
    <field key="postcode" dbtype="varchar" precision="100" phptype="string" null="false" default=""/>
    <field key="city" dbtype="varchar" precision="100" phptype="string" null="false" default=""/>
    <field key="country" dbtype="varchar" precision="100" phptype="string" null="false" default=""/>
    <field key="country_sign" dbtype="varchar" precision="100" phptype="string" null="false" default=""/>
    <field key="phone" dbtype="varchar" precision="100" phptype="string" null="false" default=""/>
    <field key="email" dbtype="varchar" precision="100" phptype="string" null="false" default=""/>
    <field key="emailtype" dbtype="enum" precision="0" phptype="string" null="false" default="html"/>
    <field key="birthday" dbtype="date" precision="0" phptype="date" null="true" default=""/>
    <field key="place_of_birth" dbtype="varchar" precision="100" phptype="string" null="false" default=""/>
    <field key="body_size" dbtype="float" precision="0" phptype="float" null="false" default="0"/>
    <field key="nationality" dbtype="varchar" precision="100" phptype="string" null="false" default=""/>
    <field key="pass_runtime" dbtype="varchar" precision="100" phptype="string" null="false" default=""/>
    <field key="express" dbtype="enum" precision="0" phptype="string" null="false" default="true"/>
    <field key="payed" dbtype="enum" precision="0" phptype="string" null="false" default="true"/>
    <field key="creation_date" dbtype="datetime" phptype="datetime" null="true"/>
    <field key="language" dbtype="varchar" precision="100" phptype="string" null="false" default=""/>
    <field key="active" dbtype="enum" precision="0" phptype="string" null="false" default="true"/>
    <field key="accept_date" dbtype="date" precision="0" phptype="date" null="true" default=""/>
    <field key="deleted" dbtype="enum" precision="0" phptype="string" null="false" default="true"/>
    <field key="activation_passwd" dbtype="varchar" precision="100" phptype="string" null="false" default=""/>
    <field key="activation_date" dbtype="datetime" phptype="datetime" null="true"/>
    <field key="comment" dbtype="text" phptype="string" null="true" default=""/>
    <index alias="PRIMARY" name="PRIMARY" primary="true" unique="true" type="BTREE">
      <column key="id" length="" collation="A" null="false"/>
    </index>
  </object>
</model>

I tested it and couldn’t reproduce the error.


I found these errors but they shouldn’t produce this error message:

In your schema it should be xPDOObject instead of PDOObject in this line

<object class="Customers" table="customers" extends="xPDO\Om\PDOObject">

and your GetList processor is missing a semicolon at the end in this line

public $objectType = 'customer.customers'

Also make sure that you use the same upper-case/lower-case letters in the action as in the file name. I get the same error message, if I for example change the name of the processor-file to Getlist.php (with a lower-case "l").

thank you very much.
in schema, thats right, it was an old version I pasted here.

here in my installation I dont runs. I dont understand this. I followed instructions from your videos.
Also the sample.php processor dont run with the same error.

How could I debug the problem? :thinking:

I think the problem should be in one of these sections:

bootstrap.php
processor itself
javascript call.

at the moment with all changes the error message always the same:

Unable to load processor for action "customer\src\processors\customers\getlist", it does not exist as an autoloadable class that extends \MODX\Revolution\Processors\Processor,

What is your service class called?

return new customer($modx);

^^ this may not be right. (in the bootstrap file)

If your service class is called Customer for example (and located at customer/src/Customer.php), it might need to be:

return new customer\Customer($modx);

I think I dont have a service class… :thinking:

I followed instructions from @halftrainedharry youtube videos

I have a class Customers.php in src/Model which is generated from extrabuilder.

Ah ok, no worries I just had a quick look, but will have to watch them properly later. (They look great @halftrainedharry!)

Perhaps you could have a look at the MODX3 version of Articles (or Collections) too, as that shows a working structure. You might find a clue:

thank you very much.

now it runs.

the problem was the action call

action: 'customer\\processors\\customers\\getlist'

Oh, because it’s all lower case. Yeah it’d need to match the capitalization of the namespace and class.

Well done! :tada:

thank you very much. :pray: :pray:

This topic was automatically closed 2 days after discussion ended and a solution was marked. New replies are no longer allowed. You can open a new topic by clicking the link icon below the original post or solution and selecting “+ New Topic”.