File: app_create_beans.php

Recommend this page to a friend!
  Classes of Saro Carvello  >  MySQL Class Generator  >  app_create_beans.php  >  Download  
File: app_create_beans.php
Role: Example script
Content type: text/plain
Description: Example script
Class: MySQL Class Generator
Generate classes to access MySQL as objects
Author: By
Last change: Update app_create_beans.php
Refactoring of GUI

Now you can auto generate PHP classes by using a GUI
Date: 3 years ago
Size: 4,391 bytes


Class file image Download

<!DOCTYPE html>
<html xmlns="">
    <title>MySQL Database Bean Builder</title>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">

    <!-- Bootstrap core CSS -->
    <link href="" rel="stylesheet" media="screen">

    <!-- HTML5 shim and Respond.js IE8 support of HTML5 elements and media queries -->
    <!--[if lt IE 9]>
    <script src=""></script>
    <script src=""></script>
    <script type="text/javascript" src="" charset="UTF-8"></script></head>
        .progress {
                background: rgba(204, 237, 220, 1);
                border: 5px solid rgba(56, 46, 166, 0.27);
                border-radius: 10px; height: 36px;
    var globalCount =0 ;
    var globalPercent = 0;
<div class="container">
    <h1>MySQL Database Beans generator</h1>
    <h3>This utility performs automatically a source code generation of PHP
        Classes from MySQL tables </h3>
    <h4>Current database :<?= DBNAME ?> (to change it edit mysqlreflection.config.php)</h4>
    <a class="btn btn-success" onclick="document.getElementById('results').value = ''" href="?build=1"><span class="glyphicon glyphicon-wrench"></span> Generate classes</a>

    <br /> <br />
    <div class="progress progress-striped">
        <div class="progress-bar" role="progressbar" aria-valuenow="0"
             aria-valuemin="0" aria-valuemax="100" style="width:0%">

    <div class="text-center">
        <textarea cols="140" rows="20" id="results" name "results"></textarea>
<!-- jQuery (necessary for Bootstrap's JavaScript plugins) -->
<script src=""></script>

<!-- Include all compiled plugins (below), or include individual files as needed -->
<script src=""></script>

    function aggiornaProgressBar(done=false) {
        var step = 2;
        var progress = $('.progress-bar');
        var currentValue = parseInt(progress.attr("aria-valuenow"));
        globalCount = globalCount +1;
        globalPercent = globalPercent +1;
        if (currentValue==100) {
            currentValue = 50;
        currentValue += 1;
        var percValue = currentValue + '%';

        var textarea = document.getElementById('results');
        textarea.scrollTop = textarea.scrollHeight;

        if (done) {
            percValue = "Done. " + globalCount + " classes were generated";

    function aggiornaTextArea(msg){
        var m = msg + '&#xA;';

    function setNumberOfTables(ntables){
        if (numberOfTables === 'undefined' || !numberOfTables)
            var numberOfTables=ntables;


if (isset($_GET["build"])) {
     * Demo application: generate classes from a mysql db schema

$msg = "Building classes for mysql schema:[" . DBNAME . "]";
"<script>$('#results').append('" . $msg . "&#xA;" . "');</script>";

// Destination path for the generated classes
$destinationPath = dirname(__FILE__) . "/beans/";
// $destinationPath = "source/";

    // Create reflection object and invoke classes generation from the specified schema into
$reflection = new MVCMySqlSchemaReflection();

// Generates the classes into the given path. During the generation it outputs the results.

"<script>$('#results').append('" . "Done." . "&#xA;" . "');</script>";

For more information send a message to info at phpclasses dot org.