I created a Package using MIGX Package Manager along with a Custom Manager Page by following the guides linked below.
I have done something wrong though as accessing the CMP outputs Undefined on the Tab and the Description bar, and the Grid is empty stating No items found.
At this point it may be relevant that I had this working as a single table but I’d prefer to join tbl.catalog_products to tbl.catalog_options.
The MODX Error Log shows errors in xpdo.class.php No class specified for loadClass, Could not load class, ::getSelectColumns() is not a valid static method (detailed error below).
There are no errors in the php_error.log.
Outline of steps taken
-
created an empty package with name ‘catalog’ using Create Package’ in MIGX Package Manager
-
pasted the content of my schema.xml file on the Xml Schema tab and selecting ‘Save Schema’
-
selecting Parse Schema creates a new directory at ‘/components/model/catalog/’ with what look like the correct mysql and schema files.
-
selecting ‘create Tables’ creates the database tables successfully
-
select ‘Add Item’ on the MIGX tab and enter Name = product, unique MIGX ID = product on Settings tab, enter Classname = product on the MIGXdb-Settings tab as per ysanmiguel’s post at
Connect custom Table with MigXdb - #7 by ysanmiguel -
edit the new Item ‘product’ and add ‘Formtabs’ fieldname = ‘name’, caption = ‘name’
Actually, I don’t think it matters what else I added if the MODX Error is Could not load class.
Can anyone point me in the right direction please?
Thanks
Environment
-
MODX 2.8.3
-
MIGX 3.0.0-alpha5
-
pdoTools 2.13.2-pl
-
PHP 7.4.29
-
MySQL MariaDB 10.5.15
My schema.xml file
<?xml version="1.0" encoding="UTF-8"?>
<model package="catalog" baseClass="xPDOObject" platform="mysql" defaultEngine="INNODB" version="1.1">
<!-- define object
- prefix tables with package name to group and separate them from modx core tables or tables created by other packages
-->
<object class="product" table="catalog_products" extends="xPDOSimpleObject" >
<!-- available fields
- category
- name
- colour
- description
- image
-->
<field key="category" dbtype="varchar" precision="255" phptype="string" null="false" default="" index="index" />
<field key="name" dbtype="varchar" precision="255" phptype="string" null="false" default="" />
<field key="colour" dbtype="varchar" precision="255" phptype="string" null="false" default="" />
<field key="description" dbtype="text" phptype="string" index="fulltext" />
<field key="image" dbtype="varchar" precision="255" phptype="string" null="false" default="" />
<!-- used by MIGX -->
<field key="deleted" dbtype="tinyint" precision="1" attributes="unsigned" phptype="integer" null="false" default="0" />
<field key="published" dbtype="tinyint" precision="1" attributes="unsigned" phptype="integer" null="false" default="0" />
<!-- good practice for tracking -->
<field key="createdon" dbtype="datetime" phptype="datetime" null="true"/>
<field key="createdby" dbtype="int" precision="10" attributes="unsigned" phptype="integer" null="false" default="0" />
<field key="editedon" dbtype="datetime" phptype="datetime" null="true"/>
<field key="editedby" dbtype="int" precision="10" attributes="unsigned" phptype="integer" null="false" default="0" />
<!-- link related tables
- base table (catalog_products) to subordinate table (catalog_options)
- note 'id' is created automatically
-->
<composite alias="option" class="option" local="id" foreign="rel_product_id" cardinality="many" owner="local" />
<aggregate alias="CreatedBy" class="modUser" local="createdby" foreign="id" cardinality="one" owner="foreign"/>
<aggregate alias="EditedBy" class="modUser" local="editedby" foreign="id" cardinality="one" owner="foreign"/>
</object>
<!-- define object
- prefix tables with package name to group and separate them from MODX core tables or tables created by other packages
-->
<object class="option" table="catalog_options" extends="xPDOSimpleObject">
<!-- available fields
- rel_product (catalog_products.id)
- name (dimensions)
- price
-->
<!-- related core table id -->
<field key="rel_product_id" dbtype="int" precision="11" phptype="integer" null="false" default=""/>
<field key="name" dbtype="varchar" precision="255" phptype="string" null="false" default="" />
<field key="price" dbtype="varchar" precision="255" phptype="string" null="false" default="" />
<!-- used by MIGX -->
<field key="deleted" dbtype="tinyint" precision="1" attributes="unsigned" phptype="integer" null="false" default="0" />
<field key="published" dbtype="tinyint" precision="1" attributes="unsigned" phptype="integer" null="false" default="0" />
<!-- used by MIGX -->
<field key="createdon" dbtype="datetime" phptype="datetime" null="true"/>
<field key="createdby" dbtype="int" precision="10" attributes="unsigned" phptype="integer" null="false" default="0" />
<field key="editedon" dbtype="datetime" phptype="datetime" null="true"/>
<field key="editedby" dbtype="int" precision="10" attributes="unsigned" phptype="integer" null="false" default="0" />
<!-- link related tables
- subordinate table (catalog_options) back to base table (catalog_product)
- note 'id' is created automatically
-->
<aggregate alias="Product" class="product" local="rel_product_id" foreign="id" cardinality="one" owner="foreign" />
<aggregate alias="CreatedBy" class="modUser" local="createdby" foreign="id" cardinality="one" owner="foreign"/>
<aggregate alias="EditedBy" class="modUser" local="editedby" foreign="id" cardinality="one" owner="foreign"/>
</object>
</model>
Full MODX Error Log
[2022-05-17 21:20:19] (ERROR @ F:\webs\domain.co.uk\subdomains\stage\httpsdocs\core\xpdo\xpdo.class.php : 592) No class specified for loadClass
[2022-05-17 21:20:19] (ERROR @ F:\webs\domain.co.uk\subdomains\stage\httpsdocs\core\xpdo\xpdo.class.php : 1618) Could not load class
[2022-05-17 21:20:19] (ERROR @ F:\webs\domain.co.uk\subdomains\stage\httpsdocs\core\xpdo\xpdo.class.php : 592) No class specified for loadClass
[2022-05-17 21:20:19] (ERROR @ F:\webs\domain.co.uk\subdomains\stage\httpsdocs\core\xpdo\xpdo.class.php : 592) No class specified for loadClass
[2022-05-17 21:20:19] (ERROR @ F:\webs\domain.co.uk\subdomains\stage\httpsdocs\core\xpdo\xpdo.class.php : 762) ::getSelectColumns() is not a valid static method.



