Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enable writeSchema to work with a specific list of tables #208

Open
SnowCreative opened this issue Jul 29, 2021 · 1 comment
Open

Enable writeSchema to work with a specific list of tables #208

SnowCreative opened this issue Jul 29, 2021 · 1 comment

Comments

@SnowCreative
Copy link

Feature request

Summary

xPDOGenerator.writeSchema currently takes four values: file name, package name, base class, and prefix. Adding two more would extend the capabilities: restrict to prefix (boolean), and table list (comma-separated list of table names).

Why is it needed?

When developing custom tables, it would nice to be able to use a script to auto-generate the schema for just those tables as part of a package. Currently, it's all or nothing; all tables in the specified prefix get included in the schema for the package you specify, which is not what we want for custom tables. Only using a custom prefix instead of the default MODX table prefix enables making the schema for just the custom tables.

Bob Ray's script CreateXpdoClasses is very useful, and already has the ability to specify tables built in, but that won't work until writeSchema is updated. Here's a note he put in that script:

/* boolean writeSchema (
 *   string $schemaFile,  // Full path to the schema file you want to write
 *   [string $package = ''], //  Name of your component
 *   [string $baseClass = ''], // xPDO base class to use;
 *                                 send '' if using args below
 *   [string $tablePrefix = ''], // Table prefix (of tables to process)
 *   [boolean $restrictPrefix = false]), // Process only tables
 *                                          with $tablePrefix
 *   [mixed $tableList = '' // Array of arrays of
 *                             full-table-name=>className or
 *                             a string with a comma-separated
 *                             list of full table names;
 *                             if you send the string the table
 *                             name will be used as the class name.
*/
@JoshuaLuckers
Copy link
Contributor

I'm going to transfer this issue to the xPDO repo.

@JoshuaLuckers JoshuaLuckers transferred this issue from modxcms/revolution Jul 31, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants