yii2-enhanced-gii
yii2-enhanced-gii copied to clipboard
Model generator generate only the first relation on inverse
Hi mootensai and thank for your extension ! I got this issue: TABLE_ORGANIZATION id name
TABLE_SERVICE id name organization_customer_id organization_supplier_id
When I generate the model for Organization your extension generate only the first relation:
- @property \app\models\Service[] $services
while original generator generate:
- @property \app\models\Service[] $services
- @property \app\models\Service[] $services0
Thanks in advance for your feedback
Francesco
Hmm.. I think that's new feature of original gii.. could you send me your schema/database dump? From: Francesco MocciaSent: Jumat, 14 April 2017 15.43To: mootensai/yii2-enhanced-giiReply To: mootensai/yii2-enhanced-giiCc: SubscribedSubject: [mootensai/yii2-enhanced-gii] Model generator generate only the first relation on inverse (#103)Hi mootensai and thank for your extension !
I got this issue: TABLE_ORGANIZATION id name TABLE_SERVICE id name organization_customer_id organization_supplier_id When I generate the model for Organization your extension generate only the first relation:
@property \app\models\Service[] $services
while original generator generate:
@property \app\models\Service[] $services @property \app\models\Service[] $services0
Thanks in advance for your feedback Francesco
—You are receiving this because you are subscribed to this thread.Reply to this email directly, view it on GitHub, or mute the thread.
{"api_version":"1.0","publisher":{"api_key":"05dde50f1d1a384dd78767c55493e4bb","name":"GitHub"},"entity":{"external_key":"github/mootensai/yii2-enhanced-gii","title":"mootensai/yii2-enhanced-gii","subtitle":"GitHub repository","main_image_url":"https://cloud.githubusercontent.com/assets/143418/17495839/a5054eac-5d88-11e6-95fc-7290892c7bb5.png","avatar_image_url":"https://cloud.githubusercontent.com/assets/143418/15842166/7c72db34-2c0b-11e6-9aed-b52498112777.png","action":{"name":"Open in GitHub","url":"https://github.com/mootensai/yii2-enhanced-gii"}},"updates":{"snippets":[{"icon":"DESCRIPTION","message":"Model generator generate only the first relation on inverse (#103)"}],"action":{"name":"View Issue","url":"https://github.com/mootensai/yii2-enhanced-gii/issues/103"}}}
Here is an extract from my schema:
`SET FOREIGN_KEY_CHECKS=0;
CREATE DATABASE stesierp_yii
CHARACTER SET 'utf8'
COLLATE 'utf8_unicode_ci';
USE stesierp_yii
;
Structure for the organization
table :
CREATE TABLE organization
(
id
INTEGER(11) NOT NULL AUTO_INCREMENT,
code
VARCHAR(20) COLLATE latin1_swedish_ci DEFAULT NULL,
name
VARCHAR(50) COLLATE latin1_swedish_ci NOT NULL,
active
TINYINT(1) DEFAULT 1,
vat_id
CHAR(13) COLLATE latin1_swedish_ci DEFAULT NULL,
supplier
TINYINT(1) DEFAULT 0,
customer
TINYINT(1) DEFAULT 0,
location_id_default
INTEGER(11) DEFAULT NULL,
PRIMARY KEY USING BTREE (id
) COMMENT '',
UNIQUE INDEX UK_organizations
USING BTREE (code
) COMMENT '',
)ENGINE=InnoDB
AUTO_INCREMENT=1 AVG_ROW_LENGTH=546 CHARACTER SET 'utf8' COLLATE 'utf8_general_ci'
COMMENT=''
;
Structure for the bu
table :
CREATE TABLE bu
(
id
INTEGER(11) UNSIGNED NOT NULL AUTO_INCREMENT,
code
VARCHAR(20) COLLATE latin1_swedish_ci NOT NULL,
buyer_organization_id
INTEGER(11) DEFAULT NULL,
customer_organization_id
INTEGER(11) DEFAULT NULL COMMENT
supplier_organization_id
INTEGER(11) DEFAULT NULL COMMENT
PRIMARY KEY USING BTREE (id
) COMMENT '',
UNIQUE INDEX buyer_id
USING BTREE (code
, buyer_organization_id
) COMMENT '',
INDEX supplier_id
USING BTREE (supplier_organization_id
) COMMENT '',
INDEX customer_id
USING BTREE (customer_organization_id
) COMMENT '',
INDEX id
USING BTREE (id
, bu_type_id
) COMMENT '',
INDEX bu_idx2
USING BTREE (is_transport
) COMMENT '',
INDEX bu_idx3
USING BTREE (is_trip
) COMMENT '',
CONSTRAINT bus_buyer_organization
FOREIGN KEY (buyer_organization_id
) REFERENCES organization
(id
),
CONSTRAINT bus_customer_organization
FOREIGN KEY (customer_organization_id
) REFERENCES organization
(id
),
CONSTRAINT bus_supplier_organization
FOREIGN KEY (supplier_organization_id
) REFERENCES organization
(id
),
)ENGINE=InnoDB AUTO_INCREMENT=1 AVG_ROW_LENGTH=372 CHARACTER SET 'latin1' COLLATE 'latin1_swedish_ci' COMMENT='' ;`
For what I notice you are using a really old version of gii generator.... actually we are merging your code with the new one.
Hmm... please try again now..