Giter Site home page Giter Site logo

maxbyz / mysqlreflection Goto Github PK

View Code? Open in Web Editor NEW

This project forked from rcarvello/mysqlreflection

0.0 0.0 0.0 395 KB

A useful utility for the Object Relational Mapping of MySQL databases

License: BSD 3-Clause "New" or "Revised" License

PHP 92.63% Smarty 4.75% TSQL 2.63%

mysqlreflection's Introduction

MySQLReflection

A useful utility for the Object Relation Mapping of MySQL databases

The utility generates automatically PHP classes for any tables of a given database schema.

Package is extracted from my personal PHP Web MVC Framework.

To generate PHP classes with the purpose of mapping database tables you need to:

  1. IMPORTANT! Use lowercase with the underscore, which is the widely used MySQL naming notation, on your database tables and fields names.

  2. Configure your database schema by modifying util\mysqlreflection\mysqlreflection.config.php file and, assigning appropriate values to DBHOST, DBNAME, DBUSER, DBPASSWORD, and DBPORT PHP constants, according to your MySQL settings.

  3. Then, launch the tool by typing:
    http/localhost/util/app_create_beans.php Note that, the GUI of the utility uses Bootstrap and jQuery from CDN. So you also need an internet connection alive before running it.

  4. Once the utility is started, click "Generate classes" button.

After running the utility you will find all generated classes into "beans" folder.

Note:

  • Auto generated classes are prefixed with "Bean".
  • Each auto generated class uses bean\bean.config.php for configuration info.
  • Each auto generated class uses Model.php and MySqlRecord.php

An auto generated MySQL class provides the following services:

  • A constructor for managing a fetched table’s row or for a adding a new one
  • Management for both single or composite Primary Keys
  • Automatic mapping of the different date formats may occurs between application and database
  • Destructor to automatically close database connection
  • Defines a set of attributes corresponding to the table fields
  • Setter and Getter methods for each attribute
  • OO methods for simplify DML select, insert, update and delete operations
  • A facility for quickly updating a previously fetched row
  • Useful methods to obtain table DDL and the last executed SQL statement
  • Error handling of SQL statements
  • Camel/Pascal case naming convention for Attributes/Class used for mapping Fields/Table
  • Useful PHPDOC information about table, fields and the usage of class, attributes and methods.

Developers can quickly use these classes on their application.

Into the beans directory are located some auto generated classes of a MySQL schema.

DDL for MySQL schema is into a script file located into "sql" directory.

There is also a simple tester script "app_run_bean.php" for showing usage of a generated class.

Utility GUI

alt tag

Overview

alt tag

UML Class Model

alt tag

Convert MySQL into PHP Classes automatically - Video Tutorial (old user interface)

IMAGE ALT TEXT HERE

Thanks

Many and many thanks to
https://www.jetbrains.com
for granting me an open source license of magic

https://www.jetbrains.com/phpstorm/ PHPStorm

that I used in the development of MySQLReflection.

mysqlreflection's People

Contributors

rcarvello avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.