Would be nice to use phpMyAdmin Designer to create relationships and if Gii could use those in code generation to create relations in code.
Page 1 of 1
phpMyAdmin Designer import to Gii
#2
Posted 13 April 2012 - 05:13 AM
You can add comments in your FK and Gii automatically creates relations in your models, like this
CREATE TABLE `Brand` ( `id` smallint(5) unsigned NOT NULL AUTO_INCREMENT, `name` varchar(50) NOT NULL, PRIMARY KEY (`id`) ); CREATE TABLE `Model` ( `id` smallint(5) unsigned NOT NULL AUTO_INCREMENT, `brandId` smallint(5) unsigned NOT NULL COMMENT 'CONSTRAINT FOREIGN KEY (brandId) REFERENCES Brand(id)', `name` varchar(50) NOT NULL, PRIMARY KEY (`id`) );
#4
Posted 13 April 2012 - 09:18 AM
Here. It was part of my signature for half a day (no offense intended). It's gone.
Now the SQL above is what I use, and Gii makes good use of it. (I learned it from some Yii tutorial, maybe Larry Ullman or the blog tutorial)
Now the SQL above is what I use, and Gii makes good use of it. (I learned it from some Yii tutorial, maybe Larry Ullman or the blog tutorial)
Share this topic:
Page 1 of 1

Help












