yii2-enhanced-gii icon indicating copy to clipboard operation
yii2-enhanced-gii copied to clipboard

No relations on Model Generation has no effect

Open possebon opened this issue 7 years ago • 5 comments

Hi, I'm having an issue that I don't know exactly how to overcome... I have a table with some relations, for example: Bank, BankAccount. I'm generating the Model and CRUD using IO, but the CRUD of Bank table is showing BankAccount too, and I don't wanna that.

I need to be only the Bank table on the CRUD forms I already set to ignore relations I already set skipped relations, without success

I’m not sure, but I probably found a bug on enhanced-gii regarding the relations... To give some information, I created a video and changed to gif, to show whant is happening here.

http://imgur.com/CUbNhBM

I think that this would explain what I was asking before regarding don’t want have all tables related on the same form on CRUD.

possebon avatar Jul 12 '17 12:07 possebon

Could you generate anything on official gii? Could you send any schema? And don't forget to check your db engine too.. to be perfect,it should be built upon innodb engine

Sent from my ZUK Z2131 using FastHub

mootensai avatar Jul 12 '17 12:07 mootensai

Is there any hasOne relation between Bank and BankAccount table? I just add that on last commit.

Sent from my ZUK Z2131 using FastHub

mootensai avatar Jul 12 '17 12:07 mootensai

I already generated with official gii and I have the expected result: on CRUD for a table with relations, there are only the form for that table, even having the relations on database.

I'm sending the schema attached.

labor_union_ms.sql.zip

And the database is InnoDB.

image

possebon avatar Jul 12 '17 12:07 possebon

Hmm...not happening to me.. have you tried to use * on table name? image

Which mysql version u're using?

mootensai avatar Jul 13 '17 03:07 mootensai

Also experiencing the same issue. Fixed by changing line 191 in /vendor/mootensai/yii2-enhanced-gii/BaseGenerator.php and removing the preceding not. From: if (!$this->generateRelations === self::RELATIONS_NONE) { return []; } To: if ($this->generateRelations === self::RELATIONS_NONE) { return []; }

MamlukiSn avatar Nov 08 '17 08:11 MamlukiSn