{"action":"created","issue":{"url":"https://api.github.com/repos/schmunk42/yii2-giiant/issues/29","labels_url":"https://api.github.com/repos/schmunk42/yii2-giiant/issues/29/labels{/name}","comments_url":"https://api.github.com/repos/schmunk42/yii2-giiant/issues/29/comments","events_url":"https://api.github.com/repos/schmunk42/yii2-giiant/issues/29/events","html_url":"https://github.com/schmunk42/yii2-giiant/issues/29","id":47358914,"number":29,"title":"Model generator doesn't use the Model Class field","user":{"login":"pafnow","id":8747037,"avatar_url":"https://avatars.githubusercontent.com/u/8747037?v=3","gravatar_id":"","url":"https://api.github.com/users/pafnow","html_url":"https://github.com/pafnow","followers_url":"https://api.github.com/users/pafnow/followers","following_url":"https://api.github.com/users/pafnow/following{/other_user}","gists_url":"https://api.github.com/users/pafnow/gists{/gist_id}","starred_url":"https://api.github.com/users/pafnow/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/pafnow/subscriptions","organizations_url":"https://api.github.com/users/pafnow/orgs","repos_url":"https://api.github.com/users/pafnow/repos","events_url":"https://api.github.com/users/pafnow/events{/privacy}","received_events_url":"https://api.github.com/users/pafnow/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/schmunk42/yii2-giiant/labels/in%20discussion","name":"in discussion","color":"ededed"}],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":3,"created_at":"2014-10-31T04:04:00Z","updated_at":"2015-03-26T11:03:22Z","closed_at":null,"body":"Hi again,\r\n\r\nI notice that when I'm using the Giiant Model generator, the Model Class field seems not to be used to define the class name and the file name.\r\nIn my case, I name the table Countries in my database but would like to get the model generated called Country. I fill the generator form with\r\nTable Name = Counties\r\nModel Name = Country\r\nBut the generator keeps creating CountriesBase and Countries files and classes.\r\n\r\nI looked into the code and I fix the issue by addiing:\r\n\tif (isset($this->classNames[$tableName])) {\r\n\t\treturn $this->classNames[$tableName];\r\n\t}\r\nat the beginning of  the function\r\n        protected function generateClassName($tableName)\r\nin the file yii2-giiant/model/Generator.php\r\n\r\nActually I get this piece of code from the yii2-gii generator and I notice that you renamed classNames to classNames2. I didin't dare to touch what you did so I just add my three lines of code.\r\n\r\nAny better solution?"},"comment":{"url":"https://api.github.com/repos/schmunk42/yii2-giiant/issues/comments/86452878","html_url":"https://github.com/schmunk42/yii2-giiant/issues/29#issuecomment-86452878","issue_url":"https://api.github.com/repos/schmunk42/yii2-giiant/issues/29","id":86452878,"user":{"login":"tsvetann","id":2565891,"avatar_url":"https://avatars.githubusercontent.com/u/2565891?v=3","gravatar_id":"","url":"https://api.github.com/users/tsvetann","html_url":"https://github.com/tsvetann","followers_url":"https://api.github.com/users/tsvetann/followers","following_url":"https://api.github.com/users/tsvetann/following{/other_user}","gists_url":"https://api.github.com/users/tsvetann/gists{/gist_id}","starred_url":"https://api.github.com/users/tsvetann/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tsvetann/subscriptions","organizations_url":"https://api.github.com/users/tsvetann/orgs","repos_url":"https://api.github.com/users/tsvetann/repos","events_url":"https://api.github.com/users/tsvetann/events{/privacy}","received_events_url":"https://api.github.com/users/tsvetann/received_events","type":"User","site_admin":false},"created_at":"2015-03-26T11:03:22Z","updated_at":"2015-03-26T11:03:22Z","body":"@schmunk42 I also used $this->classNames directly and had no issues at all! But if you are having conflicts in any edge cases then we can at least assign $this->classNames2 = $this->classNames and continue with $this->classNames2 and would still work. Defining table name mappings is not a nice solution. What do you think?"}}