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 ?
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.
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
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.
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.
Sorry—I neglected to reply, but in Revo ^3.0.1 (as well as in xPDO ~3.0.4|~3.1.1), you can use the xpdo write-schema command. I believe that the Revo 3.0.1 distribution includes xPDO 3.1.1.
❯ core/vendor/bin/xpdo help write-schema
Description:
Generate an XML schema from existing database tables.
Usage:
write-schema [options] [--] <platform> <schema_file> <package> [<base_class> [<table_prefix>]]
Arguments:
platform The PDO platform being targeted, e.g. mysql, sqlite, etc.
schema_file The path and filename to generate the XML schema to
package The package name (aka PHP namespace) for the schema
base_class An optional base_class to use for the generated schema objects; default is xPDO\Om\xPDOObject [default: ""]
table_prefix An optional table_prefix to override one specified for the xPDO configuration [default: ""]
Options:
-r, --restrict_prefix If set to 1, only tables that match the table_prefix will be included in the schema
-C, --config=CONFIG A path to a config file
-h, --help Display help for the given command. When no command is given display help for the list command
-q, --quiet Do not output any message
-V, --version Display this application version
--ansi|--no-ansi Force (or disable --no-ansi) ANSI output
-n, --no-interaction Do not ask any interactive question
-v|vv|vvv, --verbose Increase the verbosity of messages: 1 for normal output, 2 for more verbose output and 3 for debug