{"action":"closed","issue":{"url":"https://api.github.com/repos/yiisoft/yii2/issues/8879","repository_url":"https://api.github.com/repos/yiisoft/yii2","labels_url":"https://api.github.com/repos/yiisoft/yii2/issues/8879/labels{/name}","comments_url":"https://api.github.com/repos/yiisoft/yii2/issues/8879/comments","events_url":"https://api.github.com/repos/yiisoft/yii2/issues/8879/events","html_url":"https://github.com/yiisoft/yii2/issues/8879","id":90561292,"number":8879,"title":"一系列问题","user":{"login":"JackZForDream","id":8466194,"avatar_url":"https://avatars.githubusercontent.com/u/8466194?v=3","gravatar_id":"","url":"https://api.github.com/users/JackZForDream","html_url":"https://github.com/JackZForDream","followers_url":"https://api.github.com/users/JackZForDream/followers","following_url":"https://api.github.com/users/JackZForDream/following{/other_user}","gists_url":"https://api.github.com/users/JackZForDream/gists{/gist_id}","starred_url":"https://api.github.com/users/JackZForDream/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/JackZForDream/subscriptions","organizations_url":"https://api.github.com/users/JackZForDream/orgs","repos_url":"https://api.github.com/users/JackZForDream/repos","events_url":"https://api.github.com/users/JackZForDream/events{/privacy}","received_events_url":"https://api.github.com/users/JackZForDream/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":{"login":"qiangxue","id":993322,"avatar_url":"https://avatars.githubusercontent.com/u/993322?v=3","gravatar_id":"","url":"https://api.github.com/users/qiangxue","html_url":"https://github.com/qiangxue","followers_url":"https://api.github.com/users/qiangxue/followers","following_url":"https://api.github.com/users/qiangxue/following{/other_user}","gists_url":"https://api.github.com/users/qiangxue/gists{/gist_id}","starred_url":"https://api.github.com/users/qiangxue/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/qiangxue/subscriptions","organizations_url":"https://api.github.com/users/qiangxue/orgs","repos_url":"https://api.github.com/users/qiangxue/repos","events_url":"https://api.github.com/users/qiangxue/events{/privacy}","received_events_url":"https://api.github.com/users/qiangxue/received_events","type":"User","site_admin":false},"milestone":null,"comments":4,"created_at":"2015-06-24T04:26:37Z","updated_at":"2016-05-24T08:16:53Z","closed_at":"2016-05-24T08:16:53Z","body":"## 隐藏hint自动\r\n```php\r\npublic function attributeHints(){\r\n//这里我定义了一些字段必要说明\r\n}\r\n```\r\n但是非常不幸的是，如果，表单一旦验证错误，天啊，那个error错误和hint提示都是会一起显示的\r\n，很明显我要去除那个hint，填正确又恢复嘛?看了 fieldConfig我发觉解决有点麻烦，\r\n其实就是要解决\r\n```\r\n'template' => \"{label}\\n{beginWrapper}\\n{input}\\n{hint}\\n{error}\\n{endWrapper}\",\r\n```\r\n动态增加删除的问题？（难道强哥认为这样子很漂亮）\r\n<hr/>\r\n## 大家是如何对每次成功做某个action之后要做的事情的?比如更新后提示操作成功，删除提示修改成功。\r\n以下是我的解决方案\r\n- 像tp一样搞个跳转页面，（用户体验不好，直接踢）\r\n- 使用yii\\bootstrap\\Alert + Yii::$app->session->setFlash('alert',$msg);\r\n  (这种问题就是Alert分散在各个需要的页面，dirty code啊)\r\n- 还有一种就是绑定事件了（但是我想不出具体怎么做，觉得这才是王道，难道是init中on，然后具体操作中trigger，这和第二步好       像没什么差别），\r\n<hr/>\r\n\r\n## 大家是如何解决url上错误的参数的？\r\n- 我的做法是在控制器中抛出 HttpNotFoundException;\r\n大家有没有更好的方法，另外我感觉我老是需要判断url的参数是否存在，这种代码分散在我的各个模型层中，有什么\r\n好的解决方法吗？\r\n<hr/>\r\n\r\n## Yii::$app->user->identity->name这种代码分散在视图中 有什么更好的实践吗？\r\n<hr/>\r\n\r\n## query object的一个问题\r\n```\r\n$customers = Customer::find()\r\n    ->indexBy('id')\r\n    ->all();\r\n```\r\n不懂啊；debug了一下，数据好像没差别，大家能说说差别吗？"}}
{"actor":{"display_login":"cebe"}}