Copyright (c) 2007 Craig Mason <craig.mason@stasismedia.com>
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
smClayToDoctrineSchemaPlugin
This is a highly experimental release that will convert a clay model into a doctrine schema. I am expanding this plugin as required, and will post updates as they are available.
This plugin is based on the sfDbDesignerPlugin and was inspired by the post by al_n on the forums.
note: I have only been working with INNODB tables in a mysql database. Some of the data-types are probably not implemented yet
Working
- Creation of tables
- Creation of relationships
- Creation of 1:1 relationships
- Addition of 'global options' via 'Begin Script' section of clay
- Using 'foreignAlias' for relations
TODO
- Fix indexes and unique keys
- ?
Creating a 1:1 relationship
I am relatively new to doctrine, so some of these processes may be incorrect.
Create a parent and a slave table. In the slave table, add a foreign key in the normal fashion (It seems Doctrine fails when using straight ID<->ID links).
(Optional) Add the 'foreignAlias' in the 'Logical Name' section of the relationship properties
Adding global options to the schema.yml
Often, you may wish to set the character set and collation for all of your tables. To do this, we can utilise the 'begin script' section of the model.
Right click the canvas area and click 'Edit Database Model'. Choose 'Begin Script'.
Paste the following:
options:
type: INNODB
charset: utf8
collate: utf8_unicode_ci