Simple command line interface for generating php classes from mysql table
Install via composer.json, do not forget to add composer handle to project's composer.json
"scripts":
{
"post-install-cmd": [
"ModulIS\\Generator\\ComposerHandler::copy"
],
"post-update-cmd": [
"ModulIS\\Generator\\ComposerHandler::copy"
]
}
Nothing else to setup, except local.neon
- used as source for database
Once you install extension, open vendor\bin
directory in cmd(powershell requires .\
before command -> .\generate
)
There is no need to register factories or repository, all is done automatically
generate <mysql_table> [--module=<module_name>] [--type=<type>] [--db=<database>]
generate
=> command to start generating
mysql_table
=> table name which will be used for php classes generating
- if table has prefix, classes will also have prefix e.g. ins_insurance will generate InsInsuranceEntity etc
module_name
=> name under which module new classes will be generated to, default is AdminModule
- module_name has to be in
PascalCaseLikeThis
- module_name doest not have to contain
Module
- automatically added if missing
type
=> decides which files will be generated, default is all
- options
- all (the whole module)
- entity
- repository
- form
- grid
- presenter
- template
database
=> decides which database from local.neon
will be used
- if your project only uses one database or uses multiple but you want to use
default
, it will be selected automatically and this parameter is not needed
Namespace, class, properties, functions to return new datetime object instead of string for date and datetime columns
Namespace, class, table and entity property, overridden getBy and getByID
Namespace, class, repository, properties, attached(with checks), form, formSuccess
Namespace, class, grid, handles, editForm
Factory inject, createComponent function, actionFormEdit
Latte template with control component
Namespace, class, constants, functions - constants and translation needs to be changed
- Only generated from enum and char columns