Yii Framework Forum: phpMyAdmin Designer import to Gii - Yii Framework Forum

Jump to content

Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

phpMyAdmin Designer import to Gii Rate Topic: -----

#1 User is offline   S1Pb 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 5
  • Joined: 29-July 09

Posted 13 April 2012 - 02:03 AM

Would be nice to use phpMyAdmin Designer to create relationships and if Gii could use those in code generation to create relations in code.
0

#2 User is offline   bennouna 

  • Master Member
  • PipPipPipPip
  • Yii
  • Group: Members
  • Posts: 1,166
  • Joined: 05-January 12
  • Location:Morocco

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`)
);

0

#3 User is offline   S1Pb 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 5
  • Joined: 29-July 09

Posted 13 April 2012 - 07:45 AM

The second quote doesn't look like it belong here...
0

#4 User is offline   bennouna 

  • Master Member
  • PipPipPipPip
  • Yii
  • Group: Members
  • Posts: 1,166
  • Joined: 05-January 12
  • Location:Morocco

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)
0

Share this topic:


Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

1 User(s) are reading this topic
0 members, 1 guests, 0 anonymous users