Migxdb and modx3

Hello!

I must share my experience with modx3 and migxdb. It’s first time I use migxdb, and I was a little frustrated with migxdb because I couldn’t get it to work until this morning! :slight_smile:
OK. First thanks a lot @bruno17 for your plugin.
And thanks a lot @halftrainedharry for your help with your video tutorial (without it I wouldn’t have been able to understand how migxdb works)

But as said it was not simple:

In my case the name of the package must be written with a capital NameCollect (without hyphen otherwise the manager does not work anymore…). Without capital letter, the table is not created. With everything works as it should to remove or add a column.
The 2nd thing, in my case, the package name must be NameCollect, but in the schema the package name is NameCollect\Model. Without \Model, no table created…

But then the migx configuration did not work as expected. That is, in MIGXdb-settings, I tried with the package name NameCollect and NameCollect\Model, but no connection with the database was made (check under Column, Select db-fields). My Classname is namelist.

Finally I found help on github: https://github.com/Bruno17/MIGX/pull/401. I made the 2 file corrections as written by @halftrainedharry and tried as package name NameCollect\Model and as classname NameCollect\Model\namelist

And there it worked!

I am on modx 3.0.3pl and with migx 3.0.1-beta1
My final schema is:

<?xml version="1.0" encoding="UTF-8"?>
<model package="NameCollect\Model" baseClass="xPDO\Om\xPDOObject" platform="mysql" defaultEngine="InnoDB" version="3.0">
    <object class="namelist" table="namecollect_namelist" extends="xPDO\Om\xPDOSimpleObject">
        <field key="artist" dbtype="varchar" phptype="string" precision="100" null="false" default=""/>
    </object>
</model>

I always have 2 errors on error_log:

  • /core/components/migx/model/migx/migx.class.php : 884) PHP warning: Undefined variable $configpath
  • core/components/migx/processors/mgr/default/update.php : 321) PHP warning: Undefined array key "pubishedon"

The 2nd is just a little correction to do on update.php file. But the first one, I don’t know. But until now, In only have the error but no problem elsewhere.

Voilà!

1 Like

And because I never saw this link and arrived on it by a happy accident: the migx and migxdb doc

I am still running Modx 2.8 and because I am using MIGXDB I have not upgraded to MODX 3. I read somewhere that it was still not fully compatible.
Does this mean that MIGXDB is now fully compatible and it is safe to upgrade from 2.8 to MODX 3?

I don’t know. I used migxDB after having installed modx3. I decided this year to begin new projects with the last version of modx

You have to differentiate between 2 use cases for MIGXdb in MODX 3:

  • If you want to continue to use class files you created in MODX 2.x (schema version “1.1” <model ... version="1.1">), then this should already be possible with MIGX version 3.0.0-alpha5 (that was published around a year ago).

  • If you want to create new class files in MODX 3 (schema version “3.0” <model ... version="3.0">) using the MIGX Package Manager, then you need the newer version MIGX 3.0.1-beta1.

There are probably still some edge case, where the MIGX code has to be adapted to work correctly in MODX 3. I would test it, before committing to do the upgrade.

1 Like

With my personal projects I’m still on 2.8.x.
So I can’t say, if it is ‘fully’ compatible.

It should mostly work.

Like @halftrainedharry told, schemas and classes created on 2.x should still work without changes, but as soon, as you need to modify the schema, you need to convert everything to the new MODX 3 structure. And you will need at least MIGX 3.0.1-beta, currently only avaliable from the github repo.

The more people are testing and reporting issues, the better the chance it is getting ‘fully’ compatible over time.

@bruno17 do you plan to continue to maintain MIGX and adapt new conditions (e.g. php versions)?
I have to decide now if I will still use MIGX in future MODX3 projects (I’ve been working with it since 2012 in all my projects and I’m very grateful for it).

I have some installatons, where MIGXdb is used a lot with many custom tables, but I still didn’t switch them to 3.x
I’m sure, I will do at some point.
So yes, I think, I will need to continue maintaining MIGX.

2 Likes