{"action":"created","issue":{"url":"https://api.github.com/repos/yiisoft/yii2-gii/issues/32","labels_url":"https://api.github.com/repos/yiisoft/yii2-gii/issues/32/labels{/name}","comments_url":"https://api.github.com/repos/yiisoft/yii2-gii/issues/32/comments","events_url":"https://api.github.com/repos/yiisoft/yii2-gii/issues/32/events","html_url":"https://github.com/yiisoft/yii2-gii/issues/32","id":72200043,"number":32,"title":"Generate a base file for models","user":{"login":"thiagotalma","id":612578,"avatar_url":"https://avatars.githubusercontent.com/u/612578?v=3","gravatar_id":"","url":"https://api.github.com/users/thiagotalma","html_url":"https://github.com/thiagotalma","followers_url":"https://api.github.com/users/thiagotalma/followers","following_url":"https://api.github.com/users/thiagotalma/following{/other_user}","gists_url":"https://api.github.com/users/thiagotalma/gists{/gist_id}","starred_url":"https://api.github.com/users/thiagotalma/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/thiagotalma/subscriptions","organizations_url":"https://api.github.com/users/thiagotalma/orgs","repos_url":"https://api.github.com/users/thiagotalma/repos","events_url":"https://api.github.com/users/thiagotalma/events{/privacy}","received_events_url":"https://api.github.com/users/thiagotalma/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":1,"created_at":"2015-04-30T15:47:00Z","updated_at":"2015-04-30T16:33:34Z","closed_at":"2015-04-30T16:33:34Z","body":"Hello everybody,\r\n\r\nNow that the Gii has its own home, I would like to take a subject that has been discussed [here](https://github.com/yiisoft/yii2/issues/102) but the topic died.\r\n\r\nThe idea of having an ever synchronized file with the database is very interesting. Some mods of gii (the old [Giix](http://www.yiiframework.com/extension/giix/) from @rcoelho and [Giiant](https://github.com/schmunk42/yii2-giiant), from @schmunk42, for example) implement this idea. Ever since I started working in Yii have my gii modified to generate this base file.\r\n\r\nIt makes it much easier to keep the model always synchronized with the database. In the data model file override only those methods that are needed, usually adding rules or correcting labels.\r\n\r\nThe only \"problem\" I see this to be officially implemented is the question of performance, as it will add an inheritance.\r\n\r\nI ask the experts: the loss of performance is really relevant?\r\n\r\nHaving this functionality as an option in Gii would be helpful?\r\n\r\nHugs!"},"comment":{"url":"https://api.github.com/repos/yiisoft/yii2-gii/issues/comments/97870931","html_url":"https://github.com/yiisoft/yii2-gii/issues/32#issuecomment-97870931","issue_url":"https://api.github.com/repos/yiisoft/yii2-gii/issues/32","id":97870931,"user":{"login":"cebe","id":189796,"avatar_url":"https://avatars.githubusercontent.com/u/189796?v=3","gravatar_id":"","url":"https://api.github.com/users/cebe","html_url":"https://github.com/cebe","followers_url":"https://api.github.com/users/cebe/followers","following_url":"https://api.github.com/users/cebe/following{/other_user}","gists_url":"https://api.github.com/users/cebe/gists{/gist_id}","starred_url":"https://api.github.com/users/cebe/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/cebe/subscriptions","organizations_url":"https://api.github.com/users/cebe/orgs","repos_url":"https://api.github.com/users/cebe/repos","events_url":"https://api.github.com/users/cebe/events{/privacy}","received_events_url":"https://api.github.com/users/cebe/received_events","type":"User","site_admin":false},"created_at":"2015-04-30T16:33:34Z","updated_at":"2015-04-30T16:33:34Z","body":"> I ask the experts: the loss of performance is really relevant?\r\n\r\nI do not think it is relevant, if you want to use this feature, you can do it, if not just skipt it.\r\n\r\n> Having this functionality as an option in Gii would be helpful?\r\n\r\nIMO gii generated code is and can only be a template which needs adjustments, and not only by extending the generated class. There are auto generated relation names which may not match your needs, the rules are just a basic set guessed from which in no case ever match the real rules needed in the app if you take it seriously.\r\n\r\nIf you adjust a table in the DB you can use the gii preview to display the model code and copy the parts that are relevant over to your editor. You may even use \"Compare with Clipboard\" in PHPstorm to merge the details. I do not think autogenerated, unadjusted code has a valid use case.\r\n"}}