Solved thread

This post is marked as solved. If you think the information contained on this thread must be part of the official documentation, please contribute submitting a pull request to its repository.

Generate MODELS for all tables at once (without using webtools!)

Hi all,

How can I generate models for all my tables in my db at once WITHOUT using webtools?

It must include:

  • Setters & Getters *
  • Set foreign keys *
  • Define relations *
  • Forced *

Shell example: phalcon model --name ??ALL TABLES in DB?? --get-set --force

Do i need multiple lines in shell for this?

I'm looking forward to your answers :)



10.5k
Accepted
answer

Using DevTools there is the command: phalcon create-all-models

The parameters are:

    protected $_possibleParameters = array(
        'config=s'          => "Configuration file  ",
        'models=s'          => "Models directory ",
        'schema=s'          => "Name of the schema. [optional]",
        'namespace=s'       => "Model's namespace [optional]",
        'extends=s'         => "Models extends [optional]",
        'force'             => "Force script to rewrite all the models.  ",
        'get-set'           => "Attributes will be protected and have setters/getters.  ",
        'doc'               => "Helps to improve code completion on IDEs  ",
        'relations'         => "Possible relations defined according to convention.  ",
        'fk'                => "Define any virtual foreign keys.  ",
        'validations'       => "Define possible domain validation according to conventions.  ",
        'directory=s'       => "Base path on which project will be created",
    );


1.0k

Tnx, that'll do the job!