pedro151/orm-generator

orm-generator maps the entire database and then creates the DAO (Data Access Object) and ORM (Object-relational mapping) of the entire database to facilitate the development. uses various types of databases like Postgres and Mysql and various types of ORM framework.

v1.6.2 2017-03-30 19:51 UTC

README

Travis build status Scrutinizer Code Quality Latest Stable Version Total Downloads Latest Unstable Version License

ORM Generator maps the entire database and then creates the DAO (Data Access Object) and ORM (Object-relational mapping) of the entire database to facilitate the development.

uses various types of databases like Postgres and Mysql and various types of ORM framework.

Install

install via composer or download the file phar.

#####Install via composer:

$ composer require pedro151/orm-generator`
$ composer install`

#####Download phar:

Creating config file

use the following command to create the configuration file needed to get started:

$ php orm-generate.phar --init

OR

$ php generator.php --init

Configuration

setting is in configs/config.ini if you do not use frameworks adapter, if you use the adapter configuration comes straight from the framework as Zend framework and others.

PHP Code Generation

Open the prompt in the directory orm-generator and write:

$ php generate.php

Or Open the prompt in the directory bin and write:

$ php orm-generate.phar

Configurations optionals

Command description
--init Creates the necessary configuration file to start using the ORM Generator.
--name-ini reference to another .ini file configuration (relative path).
--config-env ORM Generator configuration environment.
--framework name framework used, which has the contents of the database configurations and framework template.
--driver database driver name (Ex.: pgsql, mysql).
--database database name.
--schema database schema name (one or more than one).
--tables table name (parameter can be used more then once).
--clean-trash delete all files that do not belong to your Database due.
--status show status of implementation carried out after completing the process.
--version shows the version of ORM Generator.
--help help command explaining all the options and manner of use.
--path specify where to create the files (default is current directory).
--update Upgrade to latest version.
--download download the reported version (ex. --download=1.5.0).
example:

in prompt

$ php generate.php --framework=zf1 --database=foo --driver=pgsql --status

Support Database

  • Postgres
  • Mysql
  • Dblib
  • Mssql
  • Sqlserver

Framework Class Generator ORM

- Classes Overwrite: Classes should not be personalized, they will be rewritten every generation of classes.

Frameworks Config Name Version Generate Classes Classes Overwrite
Zend Framework zf1.12 1.12 DbTable, Entity, Model DbTable, Entity
Phalcon phalcon 3.0 Entity, Model, Peer Entity