Could not load class | MIGX + MODX 3

Hi,

I’m desperately trying to create a MIGX record in MODX 3, but I don’t know what to do…

When saving the record, I get the following error messages:

[2023-05-31 16:31:53] (ERROR @ /var/www/html/core/vendor/xpdo/xpdo/src/xPDO/Om/xPDOObject.php : 227) Error 42000 executing statement: 
Array
(
    [0] => 42000
    [1] => 1055
    [2] => Expression #1 of SELECT list is not in GROUP BY clause and contains nonaggregated column 'modx.migxConfig.id' which is not functionally dependent on columns in GROUP BY clause; this is incompatible with sql_mode=only_full_group_by
)

[2023-05-31 16:31:54] (ERROR @ /var/www/html/core/vendor/xpdo/xpdo/src/xPDO/Om/xPDOObject.php : 227) Error 42000 executing statement: 
Array
(
    [0] => 42000
    [1] => 1055
    [2] => Expression #1 of SELECT list is not in GROUP BY clause and contains nonaggregated column 'modx.migxConfig.id' which is not functionally dependent on columns in GROUP BY clause; this is incompatible with sql_mode=only_full_group_by
)

[2023-05-31 16:31:54] (ERROR @ /var/www/html/core/vendor/xpdo/xpdo/src/xPDO/Om/xPDOObject.php : 227) Error 42000 executing statement: 
Array
(
    [0] => 42000
    [1] => 1055
    [2] => Expression #1 of SELECT list is not in GROUP BY clause and contains nonaggregated column 'modx.migxConfig.id' which is not functionally dependent on columns in GROUP BY clause; this is incompatible with sql_mode=only_full_group_by
)

If I try to create an entry, I get the following error messages:

[2023-05-31 16:32:07] (ERROR @ /var/www/html/core/vendor/xpdo/xpdo/src/xPDO/xPDO.php : 666) Could not load class: Skl\Model\sklOffice from mysql.skl\model\skloffice
[2023-05-31 16:32:07] (ERROR @ /var/www/html/core/vendor/xpdo/xpdo/src/xPDO/xPDO.php : 1642) Could not load class Skl\Model\sklOffice
[2023-05-31 16:32:07] (ERROR @ /var/www/html/core/vendor/xpdo/xpdo/src/xPDO/xPDO.php : 666) Could not load class: Skl\Model\sklOffice from mysql.skl\model\skloffice
[2023-05-31 16:32:07] (ERROR @ /var/www/html/core/vendor/xpdo/xpdo/src/xPDO/xPDO.php : 666) Could not load class: Skl\Model\sklOffice from mysql.skl\model\skloffice
[2023-05-31 16:32:07] (ERROR @ /var/www/html/core/vendor/xpdo/xpdo/src/xPDO/xPDO.php : 786) Skl\Model\sklOffice::getSelectColumns() is not a valid static method.
[2023-05-31 16:32:08] (ERROR @ /var/www/html/core/vendor/xpdo/xpdo/src/xPDO/xPDO.php : 666) Could not load class: Skl\Model\sklOffice from mysql.skl\model\skloffice
[2023-05-31 16:32:10] (ERROR @ /var/www/html/core/vendor/xpdo/xpdo/src/xPDO/xPDO.php : 666) Could not load class: Skl\Model\sklOffice from mysql.skl\model\skloffice

Anyone have any idea what this could be? Do “Package” and “Classname” have to be called differently?

In the “MIGXdb-Settings”-Tab i set this values:
Package: Skl\Model
Classname: Skl\Model\sklOffice

The schema is:

<?xml version="1.0" encoding="UTF-8"?>

<model package="Skl\Model\" baseClass="xPDO\Om\xPDOObject" platform="mysql" defaultEngine="InnoDB" phpdoc-package="" phpdoc-subpackage="" version="3.0">

    <object class="sklOffice" table="skl_offices" extends="xPDO\Om\xPDOSimpleObject">
        <field key="name" dbtype="text" phptype="string" null="false" default="" />
        <field key="doctors" dbtype="text" phptype="string" null="false" default="" />
        <field key="address" dbtype="text" phptype="string" null="false" default="" />
        <field key="phone" dbtype="text" phptype="string" null="false" default="" />
        <field key="fax" dbtype="text" phptype="string" null="false" default="" />
        <field key="mail" dbtype="text" phptype="string" null="false" default="" />
        <field key="openings_1" dbtype="text" phptype="string" null="false" default="" />
        <field key="openings_2" dbtype="text" phptype="string" null="false" default="" />
        <field key="openings_3" dbtype="text" phptype="string" null="false" default="" />
        <field key="pos" dbtype="int" precision="10" phptype="integer" null="false" default="0" index="index" />

        <field key="createdby" dbtype="int" precision="10" phptype="integer" null="false" default="0" />
        <field key="createdon" dbtype="datetime" phptype="datetime" null="true" />
        <field key="editedby" dbtype="int" precision="10" phptype="integer" null="false" default="0" />
        <field key="editedon" dbtype="datetime" phptype="datetime" null="true" />
        <field key="deleted" dbtype="tinyint" precision="1" attributes="unsigned" phptype="integer" null="false" default="0" />
        <field key="deletedon" dbtype="datetime" phptype="datetime" null="true" />
        <field key="deletedby" dbtype="int" precision="10" phptype="integer" null="false" default="0" />
        <field key="published" dbtype="tinyint" precision="1" attributes="unsigned" phptype="integer" null="false" default="0" />
        <field key="publishedon" dbtype="datetime" phptype="datetime" null="true" />
        <field key="publishedby" dbtype="int" precision="10" phptype="integer" null="false" default="0" />

        <composite alias="Offices" class="Skl\Model\sklEmployees" local="id" foreign="office_id" cardinality="many" owner="local" />

        <index alias="pos" name="pos" primary="false" unique="false" type="BTREE">
            <column key="pos" length="" collation="A" null="false" />
        </index>
    </object>

    <object class="sklEmployees" table="skl_employees" extends="xPDO\Om\xPDOSimpleObject">
        <field key="forename" dbtype="varchar" phptype="string" precision="100" null="false" default="" />
        <field key="surname" dbtype="varchar" phptype="string" precision="100" null="false" default="" />
        <field key="position" dbtype="varchar" phptype="string" precision="100" null="false" default="" />
        <field key="icon" dbtype="int" precision="10" phptype="integer" null="false" default="0" index="index" />
        <field key="pos" dbtype="int" precision="10" phptype="integer" null="false" default="0" index="index" />

        <field key="office_id" dbtype="int" precision="10" phptype="integer" null="false" default="0" index="index" />

        <aggregate alias="Team" class="Skl\Model\sklOffice" local="office_id" foreign="id" cardinality="one" owner="foreign" />
    </object>

</model>

Does anyone have an idea and could help me? :see_no_evil:

Thank you

Best regards
Daniel

maybe, that helps:
Error 42000 / sql_mode=only_full_group_by · Issue #380 · Bruno17/MIGX (github.com)

1 Like

The first error messages are fixed. Thank you, @bruno17 !

Now it only remains open what exactly has to be entered in “Package” and “Classname”. So far I have not found the right entries.

When loading the page (/manager/?a=index&namespace=migx&configs=Praxis) I already get the following error messages…

[2023-06-01 06:37:14] (ERROR @ /var/www/html/core/vendor/xpdo/xpdo/src/xPDO/xPDO.php : 666) Could not load class: Skl\Model\sklOffice from mysql.skl\model\skloffice
[2023-06-01 06:37:14] (ERROR @ /var/www/html/core/vendor/xpdo/xpdo/src/xPDO/xPDO.php : 1642) Could not load class Skl\Model\sklOffice
[2023-06-01 06:37:14] (ERROR @ /var/www/html/core/vendor/xpdo/xpdo/src/xPDO/xPDO.php : 666) Could not load class: Skl\Model\sklOffice from mysql.skl\model\skloffice
[2023-06-01 06:37:14] (ERROR @ /var/www/html/core/vendor/xpdo/xpdo/src/xPDO/xPDO.php : 666) Could not load class: Skl\Model\sklOffice from mysql.skl\model\skloffice
[2023-06-01 06:37:14] (ERROR @ /var/www/html/core/vendor/xpdo/xpdo/src/xPDO/xPDO.php : 786) Skl\Model\sklOffice::getSelectColumns() is not a valid static method.

which MIGX Version are you using and how/where did you create your schema and class files?

MIGX 3.0.1-beta1

I have created the scheme as you can see in the first post.

I created the Package, saved the schema, parsed schema and created the tables.

in Package, you put the name of your core/components directory, which should be the lowercase name of your package, without the Model - part.
In your case, this should be: skl

1 Like

Thank you.

But what is the Classname?
This doenst work:

  • skl\Model\sklOffice
  • Skl\Model\sklOffice
  • sklOffice

Skl\Model\sklOffice should work.

did you use skl or skl/Model as packagename, when creating and parsing the package?

It should be just skl

what is your generated file-structure, now?
where is your bootstrap.php located now and what is the generated code of that file?

I have created a package and tested your schema. That has worked for me.

1 Like

i used “skl” as packagename.

This is my file structure.
image

I don’t know why, but I deleted everything again completely and regenerated and now it works…
It’s not like I’ve done this several times :smiley:

Sorry and thanks for your help!

3 Likes