Skip to content

a php written mysql workbench file reader to transform the database scheme to useful other schemes like Doctrine

License

Notifications You must be signed in to change notification settings

drowe/mysql-workbench-schema-exporter

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

README

ATTENTION

This software is EXPERIMENTAL and not ready for production. It is just a proof of concept.

What is MySQL Workbench schema exporter?

The application is intended to create:

  • Doctrine1
  • Doctrine2
  • Propel
  • Zend DbTable
  • CakePHP
  • ...

schema files from MySQL Workbench models (*.mwb). It is inspired by https://code.google.com/p/mysql-workbench-doctrine-plugin/.

Doctrine behaviours

Support for behaviours is implemented for Doctrine1. Use the comment fields in tables.

{d:actAs}
  actAs:
    timestampable:
      [..]
{/d:actAs}

Foreign key name

To replace relations name by the name of the foreign key, start the foreign key name with "d:".

Option list for doctrine 1

  • extendTableNameWithSchemaName
  • {d:externalRelations}

Option list for doctrine 2

  • useAnnotationPrefix
  • indentation
  • useAutomaticRepository
  • extendTableNameWithSchemaName
  • bundleNamespace
  • entityNamespace
  • repositoryNamespace

Option list for Zend DbTable

  • tablePrefix
  • parentTable
  • indentation

Requirements

Works with PHP 5.3 and up.

Links

Example

<?php

// enable autoloading of classes
require_once('lib/MwbExporter/Core/SplClassLoader.php');
$classLoader = new SplClassLoader();
$classLoader->setIncludePath('lib');
$classLoader->register();

// define a formatter
$formatter = new \MwbExporter\Formatter\Doctrine2\Annotation\Loader();

// parse the mwb file
$mwb = new \MwbExporter\Core\Workbench\Document('myDatabaseModel.mwb', $formatter);

// show the output
echo $mwb->display();

// save as zip file in current directory and use .php as file endings
echo $mwb->zipExport(__DIR__, 'php');
?>

About

a php written mysql workbench file reader to transform the database scheme to useful other schemes like Doctrine

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • PHP 100.0%