MODX Community

Connect custom Table with MigXdb

Hello I’m trying to display the content of a custom table created via XPDO into the manager using MigXdb.

I normally create a table using the MigX package manager, then using the MigX Manager I create the tables to display the content inside the manager then display everything creating a new button on the top menu. Easy.

Right now I just need to display the content from a custom table where the files are not into core/components/, the files are in the root.

/home/user/public_html/THE_FOLDER/model/tables/mysql/trxtstore.class.php
/home/user/public_html/THE_FOLDER/model/tables/mysql/trxtstore.map.inc.php
/home/user/public_html/THE_FOLDER/model/tables/metadata.mysql.php
/home/user/public_html/THE_FOLDER/model/tables/trxtstore.class.php
/home/user/public_html/THE_FOLDER/model/tables.mysql.schema.xml

So I already created into MigX a new item for that table:

with a name, uique MIGX ID.
I already create all the colums based on the schema
and in the MIGXdb Settings I include the package and Classname

That is it for now but obviously the MIgX is looking inside core/components for the stuff an I’m getting this error:

[2020-06-18 18:15:59] (ERROR @ /home/user/public_html/core/xpdo/xpdo.class.php : 592) No class specified for loadClass
[2020-06-18 18:15:59] (ERROR @ /home/user/public_html/core/xpdo/xpdo.class.php : 1617) Could not load class 
[2020-06-18 18:15:59] (ERROR @ /home/user/public_html/core/xpdo/xpdo.class.php : 592) No class specified for loadClass
[2020-06-18 18:15:59] (ERROR @ /home/user/public_html/core/xpdo/xpdo.class.php : 592) No class specified for loadClass
[2020-06-18 18:15:59] (ERROR @ /home/user/public_html/core/xpdo/xpdo.class.php : 762) ::getSelectColumns() is not a valid static method.
[2020-06-18 18:15:59] (ERROR @ /home/user/public_html/core/xpdo/xpdo.class.php : 592) No class specified for loadClass
[2020-06-18 18:15:59] (ERROR @ /home/user/public_html/core/xpdo/xpdo.class.php : 592) No class specified for loadClass
[2020-06-18 18:15:59] (ERROR @ /home/user/public_html/core/xpdo/xpdo.class.php : 1617) Could not load class 
[2020-06-18 18:15:59] (ERROR @ /home/user/public_html/core/xpdo/xpdo.class.php : 592) No class specified for loadClass
[2020-06-18 18:15:59] (ERROR @ /home/user/public_html/core/xpdo/xpdo.class.php : 762) ::loadCollection() is not a valid static method.

The question is how can I point MigX in the right direction to look into the root folder for the info that it needs to display the database content?

I think the key is the Processors Path field, but not sure.

Hope is clear enough, Thanks!

Looking at the code, it seems that the path to the package is hard-coded.

$packagepath = $this->modx->getOption('core_path') . 'components/' . $packageName . '/';

That means the files must be inside /components?
should be a way to do it outside, don’t you think?

@bruno17 what do you think? any advice please?

Thanks!

yes, has to be within {where_ever_your_corepath_is}/components/{packagename}
but you could try to add the package on every request with https://docs.modx.com/current/en/building-sites/settings/extension_packages

but I think, MIGXdb Components will not work fully, if not under {where_ever_your_corepath_is}/components/{packagename}

Excellent, thank you.
What I’m trying to do now it’s create another package inside modx that connects to the same database so I can read it from there and display the content inside the manager as normal (don’t need to write anyway), but still displaying the same error, why?
I’m following the steps on gel studio tutorial that normally works fine

https://www.youtube.com/watch?v=jwzx6O7zdaU

I even have another database already connected, don’t understand what is happening.

Solve it with this post: https://forums.modx.com/thread/92644/migxdb---cmp-undefined

J had the same "undefined" problem...

My solution was to use the  **exactly**  same name for

* MIGX -> Settings -> Name
* MIGX -> Settings -> unique MIGX ID
* MIGX -> MIGXdb -> Classname

when the "MIGX -> Settings -> Name" and the "MIGX -> Settings -> unique MIGX ID" is different, the undefined error appears for me ...

Weirs but works, GOOD!