{"action":"created","issue":{"url":"https://api.github.com/repos/yiisoft/yii2-gii/issues/206","repository_url":"https://api.github.com/repos/yiisoft/yii2-gii","labels_url":"https://api.github.com/repos/yiisoft/yii2-gii/issues/206/labels{/name}","comments_url":"https://api.github.com/repos/yiisoft/yii2-gii/issues/206/comments","events_url":"https://api.github.com/repos/yiisoft/yii2-gii/issues/206/events","html_url":"https://github.com/yiisoft/yii2-gii/issues/206","id":182985608,"number":206,"title":"Model Generator does NOT generate relations","user":{"login":"yii-bot","id":13490354,"avatar_url":"https://avatars.githubusercontent.com/u/13490354?v=3","gravatar_id":"","url":"https://api.github.com/users/yii-bot","html_url":"https://github.com/yii-bot","followers_url":"https://api.github.com/users/yii-bot/followers","following_url":"https://api.github.com/users/yii-bot/following{/other_user}","gists_url":"https://api.github.com/users/yii-bot/gists{/gist_id}","starred_url":"https://api.github.com/users/yii-bot/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/yii-bot/subscriptions","organizations_url":"https://api.github.com/users/yii-bot/orgs","repos_url":"https://api.github.com/users/yii-bot/repos","events_url":"https://api.github.com/users/yii-bot/events{/privacy}","received_events_url":"https://api.github.com/users/yii-bot/received_events","type":"User","site_admin":false},"labels":[{"id":63946699,"url":"https://api.github.com/repos/yiisoft/yii2-gii/labels/bug","name":"bug","color":"e102d8","default":true},{"id":440602168,"url":"https://api.github.com/repos/yiisoft/yii2-gii/labels/ext:gii","name":"ext:gii","color":"ededed","default":false}],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":1,"created_at":"2016-10-14T07:53:40Z","updated_at":"2016-11-02T14:01:20Z","closed_at":null,"body":"This issue has originally been reported by @tsanchev at https://github.com/yiisoft/yii2/issues/12741.\nMoved here by @cebe.\n---\n### What steps will reproduce the problem?\n\nI have used this migration to generate the table\n\n```\npublic function up()\n{\n    if ($this->db->schema->getTableSchema('products', true) !== null) {\n        $this->dropTable('products');\n    }\n\n    $this->createTable('products', [\n        'product_id' => $this->bigPrimaryKey()->unsigned(),\n\n        'category_id' => $this->bigInteger()->unsigned()->notNull(),\n        'brand_id' => $this->bigInteger()->unsigned()->notNull(),\n\n        'position' => $this->bigInteger()->unsigned(),\n\n        'product_en' => $this->string()->notNull(),\n        'product_bg' => $this->string()->notNull(),\n        'product_de' => $this->string()->notNull(),\n        'product_ru' => $this->string()->notNull(),\n\n        'description_en' => $this->text(),\n        'description_bg' => $this->text(),\n        'description_de' => $this->text(),\n        'description_ru' => $this->text(),\n\n        'image' => 'LONGBLOB',\n        'thumbnail' => 'MEDIUMBLOB',\n\n\n    ]);\n\n    $this->createIndex('idx-products-category_id', 'products', 'category_id');\n    $this->createIndex('idx-products-brand_id', 'products', 'brand_id');\n\n    $this->addForeignKey('fk-products-category_id', 'products', 'category_id', 'categories', 'category_id', 'CASCADE');\n    $this->addForeignKey('fk-products-brand_id', 'products', 'brand_id', 'brands', 'brand_id', 'CASCADE');\n\n}\n```\n\nand when I use Model Generator and check \"[v] Generate Relations from Current Schema\" there is no \nActiveQuery methods generated\n\nIn the relational tables the primary key is generated using `$this->bigInteger()->unsigned()`\n### What is the expected result?\n\nIn the model class I expect to have this methods generated\n\n```\n /**\n * @return \\yii\\db\\ActiveQuery\n */\npublic function getCategory()\n{\n    return $this->hasOne(Categories::className(), ['category_id' => 'category_id']);\n}\n\n/**\n * @return \\yii\\db\\ActiveQuery\n */\npublic function getBrand()\n{\n    return $this->hasOne(Brands::className(), ['brand_id' => 'brand_id']);\n}\n```\n### What do you get instead?\n\nnothing (except rules and attribute labels)\n### Additional info\n\n| Q | A |\n| --- | --- |\n| Yii version | 2.0.10-dev |\n| PHP version | 5.6.9 |\n"},"comment":{"url":"https://api.github.com/repos/yiisoft/yii2-gii/issues/comments/257872660","html_url":"https://github.com/yiisoft/yii2-gii/issues/206#issuecomment-257872660","issue_url":"https://api.github.com/repos/yiisoft/yii2-gii/issues/206","id":257872660,"user":{"login":"samdark","id":47294,"avatar_url":"https://avatars.githubusercontent.com/u/47294?v=3","gravatar_id":"","url":"https://api.github.com/users/samdark","html_url":"https://github.com/samdark","followers_url":"https://api.github.com/users/samdark/followers","following_url":"https://api.github.com/users/samdark/following{/other_user}","gists_url":"https://api.github.com/users/samdark/gists{/gist_id}","starred_url":"https://api.github.com/users/samdark/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/samdark/subscriptions","organizations_url":"https://api.github.com/users/samdark/orgs","repos_url":"https://api.github.com/users/samdark/repos","events_url":"https://api.github.com/users/samdark/events{/privacy}","received_events_url":"https://api.github.com/users/samdark/received_events","type":"User","site_admin":false},"created_at":"2016-11-02T14:01:20Z","updated_at":"2016-11-02T14:01:20Z","body":"@vov4ik08 do you have a way to reproduce that? Schema probably?"}}
{"actor":{"display_login":"samdark"}}