{"action":"created","issue":{"url":"https://api.github.com/repos/javiereguiluz/EasyAdminBundle/issues/1139","repository_url":"https://api.github.com/repos/javiereguiluz/EasyAdminBundle","labels_url":"https://api.github.com/repos/javiereguiluz/EasyAdminBundle/issues/1139/labels{/name}","comments_url":"https://api.github.com/repos/javiereguiluz/EasyAdminBundle/issues/1139/comments","events_url":"https://api.github.com/repos/javiereguiluz/EasyAdminBundle/issues/1139/events","html_url":"https://github.com/javiereguiluz/EasyAdminBundle/issues/1139","id":153093540,"number":1139,"title":"Change entity configurations at runtime","user":{"login":"joazvsoares","id":5097842,"avatar_url":"https://avatars.githubusercontent.com/u/5097842?v=3","gravatar_id":"","url":"https://api.github.com/users/joazvsoares","html_url":"https://github.com/joazvsoares","followers_url":"https://api.github.com/users/joazvsoares/followers","following_url":"https://api.github.com/users/joazvsoares/following{/other_user}","gists_url":"https://api.github.com/users/joazvsoares/gists{/gist_id}","starred_url":"https://api.github.com/users/joazvsoares/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/joazvsoares/subscriptions","organizations_url":"https://api.github.com/users/joazvsoares/orgs","repos_url":"https://api.github.com/users/joazvsoares/repos","events_url":"https://api.github.com/users/joazvsoares/events{/privacy}","received_events_url":"https://api.github.com/users/joazvsoares/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":2,"created_at":"2016-05-04T19:20:49Z","updated_at":"2016-05-07T18:17:30Z","closed_at":null,"body":"I would like to suggest a setter method on Configurator/ConfigManager classes.\r\n\r\nFor example, depending on some condition I would like to disable an action, I had to create a setter method direct on configurator class.\r\n\r\n```php\r\n    protected function listDispatchAction()\r\n    {\r\n\t\t...\r\n\t\tif (!$shouldAdd){\r\n\t\t\t$config = array('disabled_actions' => array('new'));\r\n\t\t\t$configurator = $this->get('easyadmin.configurator');\r\n\t\t\t$configurator->setEntityConfig('Dispatch', $config);\r\n\t\t}\r\n\t}\r\n```\r\n\r\n```php\r\n    public function setEntityConfig($entityName, $config)\r\n    {\r\n        if (!isset($this->backendConfig['entities'][$entityName])) {\r\n            throw new \\InvalidArgumentException(sprintf('Entity \"%s\" is not managed by EasyAdmin.', $entityName));\r\n        }\r\n\r\n        $this->backendConfig['entities'][$entityName] = array_merge($this->backendConfig['entities'][$entityName], $config);\r\n    }\r\n```\r\n\r\nPlease, feel free to check and tell me if there is a better approach."},"comment":{"url":"https://api.github.com/repos/javiereguiluz/EasyAdminBundle/issues/comments/217657945","html_url":"https://github.com/javiereguiluz/EasyAdminBundle/issues/1139#issuecomment-217657945","issue_url":"https://api.github.com/repos/javiereguiluz/EasyAdminBundle/issues/1139","id":217657945,"user":{"login":"javiereguiluz","id":73419,"avatar_url":"https://avatars.githubusercontent.com/u/73419?v=3","gravatar_id":"","url":"https://api.github.com/users/javiereguiluz","html_url":"https://github.com/javiereguiluz","followers_url":"https://api.github.com/users/javiereguiluz/followers","following_url":"https://api.github.com/users/javiereguiluz/following{/other_user}","gists_url":"https://api.github.com/users/javiereguiluz/gists{/gist_id}","starred_url":"https://api.github.com/users/javiereguiluz/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/javiereguiluz/subscriptions","organizations_url":"https://api.github.com/users/javiereguiluz/orgs","repos_url":"https://api.github.com/users/javiereguiluz/repos","events_url":"https://api.github.com/users/javiereguiluz/events{/privacy}","received_events_url":"https://api.github.com/users/javiereguiluz/received_events","type":"User","site_admin":false},"created_at":"2016-05-07T18:17:30Z","updated_at":"2016-05-07T18:17:30Z","body":"I haven't had time to think about this yet. However, I'd like to tell you that the next version of the bundle will change config management completely. Instead of a compiler pass, we'll use a cache warmer, a Doctrine Cache store and simpler methods to get the configuration.\r\n\r\nOnce we release the new version, we can talk again about this and see how can we help you. For now it's better to not create a pull request and keep discussing in this issue. Thanks!"}}