Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Gii generator error - missing relationship description when table has composite keys #90

Closed
qiangxue opened this issue Feb 15, 2012 · 1 comment

Comments

@qiangxue
Copy link
Member

I have a generic multi-multi relation with a connector table.
This connecting table has 2 generic composite keys to allow mysql use indexes with join in either way.

CREATE TABLE `variations_ingredients` (
    `variation_id` INT(10) UNSIGNED NOT NULL,
    `ingredient_id` INT(10) UNSIGNED NOT NULL,
    PRIMARY KEY (`variation_id`, `ingredient_id`),
    INDEX `FK_variations_ingredients_ingredients` (`ingredient_id`, `variation_id`),
    CONSTRAINT `FK_variations_ingredients_ingredients` FOREIGN KEY (`ingredient_id`) REFERENCES `ingredients` (`id`),
    CONSTRAINT `FK_variations_ingredients_variations` FOREIGN KEY (`variation_id`) REFERENCES `variations` (`id`)
)ENGINE=InnoDB

gii creates an empty relations method for this table.

It works well if I use two single-field indexes and fails if I use composite keys as it is usually done in this case.

Migrated from http://code.google.com/p/yii/issues/detail?id=2529


earlier comments

grigori@grik.net said, at 2011-06-12T21:40:01.000Z:

the other tables used in relations can be create table variations(id int primary key); create table ingredients( id int primary key);

grigori@grik.net said, at 2011-06-12T22:31:15.000Z:

the problem is connected to the composite primary key only if the PK is on a single field, and second key is composite, it works

qiang.xue said, at 2012-01-01T03:36:54.000Z:

set for 1.1.10 milestone

qiang.xue said, at 2012-01-01T03:37:09.000Z:

set for 1.1.10 milestone

qiang.xue said, at 2012-01-01T03:37:35.000Z:

set for 1.1.10 milestone

@grikdotnet
Copy link

:) great to see you are implementing this!

@samdark samdark closed this as completed Nov 17, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants