Modx 3 : Reverse Engeneering scripts do not work anymore

Hi Everyone,

I have worked with 2.X for years with customs db tables. For that, I use the script from Bob :

With Modx 3, the script is no longer generating .map files. I have been testing the script :
https://docs.modx.com/3.x/en/extending-modx/xpdo/custom-models/generating-the-model/reverse-engineer

Which does not work as well.

I looked at the tuncion parseSchema in the new modx 3, this function has changed and it does no longer generate the .map files : but it does so in its 2.x version.

Does anyone face the same issue ? Is there a new script to use for reverse engeneering current db tables ?

Thanks in advance for your help

Maybe take a look at the extra ExtraBuilder.

I believe it supports the creation of the schema from an existing database table and I think it has been updated to run on MODX 3.

1 Like

Are you sure about this? During my last chat with Jason he told me that xPDO did not build the XML schema right for MODX3. I was working on FormIt2db with the autopackage option.

With my script, are you seeing anything relevant in the MODX error log?

With the other script, do you have Doctrine installed?

Thanks for your replies…

I am testing ExtraBuilder to see what can be done from it / if it works.

Bob, regarding your script, everything runs as usual and nothing appears in the error log. All files but .map.inc are generated.

For the second script, no, I did not install Doctrine.

I think you are right.

There was an option to “Import/Reverse Engineer from Tables” in version 1.
But in version 2 this functionality was removed (as far as I can tell).

I have tested ExtraBuilder… I have imported an existing Schema to start with my current tables.

It has loaded all things correctly… I have adjusted the key name to “XXX\Model” and I have then generated all files (schema, classes and map files) in various folders.

But then, my classes cannot be loaded in my snippets.

Just to mention it : when I take my 2.x generated .map.inc files and I place them to complete the files generated by your script running on modX 3, everything works as usual / all classes are well loaded.

It seems that it is just a matter of missing .map.inc files

Thanks for that info. I’ve added a note (with credit to you) on the page you linked to.

In 3.x models, there should not be separate map files. I will get the reverse engineering script worked out, but the model generation with the parse-schema command does work once you have a properly defined schema.

So, the .map.inc are no longer used in modx 3.0.

Please let me know about new version of the scripts… and thanks for helping out here :slight_smile:

They are used if the model is an xPDO 2.x model. But models built with 3.x include the map data as part of the platform class. No separate map file is generated by 3.x.