This is a Yii shell command to help generate model classes with relations descriptions.
If you use MySQL workbench for your database design, and have all the relationships defined on the diagram, this will help you to translated them into Yii model classes. So you can always maintain your database schema and relationships in the visual way, and not worry about create or update relations in model class files.
And it's a batch process, which read all the tables from the database connection, and parse the mwb file for corresponding relationships and create the model class file instantly.
It doesn't require innodb, so long as you've got relation on the ERD, it should work for you, and it can tell 1:1,1:M and M:M relationships.
Resources
Copyright © 2009 by Orite Group
All rights reserved.
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
- Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
- Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
- Neither the name of Orite Group nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
February 17, 2009
R2404 Minor Bug Fix Release
Fixed file path with backslash problem on windows platform
February 6, 2009
R2402 Bug fix release, tested with 1.0.2
Works better with composite keys (PK with more than one field)
February 5, 2009
R2393 Initial beta release.
Requirements
- Yii 1.0 or above
- MySQL Workbench 5.0 or above
- PHP 5 with zip and simplexml enabled
Installation
- Extract the release file under 'framewok/cli'
- It should not overwrite any original Yii Framework file
We have developed it under the framework purely because it's not project specific and should be available to any newly created projects.
Usage
At Yii shell,
> mwbmodel [mwb-file]
This command generates model classes with relationships parsed from MySQL workbench mwb file. * mwb-file: required, mwb file.