{"action":"created","issue":{"url":"https://api.github.com/repos/javiereguiluz/EasyAdminBundle/issues/729","labels_url":"https://api.github.com/repos/javiereguiluz/EasyAdminBundle/issues/729/labels{/name}","comments_url":"https://api.github.com/repos/javiereguiluz/EasyAdminBundle/issues/729/comments","events_url":"https://api.github.com/repos/javiereguiluz/EasyAdminBundle/issues/729/events","html_url":"https://github.com/javiereguiluz/EasyAdminBundle/issues/729","id":124538204,"number":729,"title":"[RFC] Configure the entire backend when dumping the container","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},"labels":[{"url":"https://api.github.com/repos/javiereguiluz/EasyAdminBundle/labels/needs%20comments","name":"needs comments","color":"fef2c0"}],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":13,"created_at":"2016-01-01T09:19:48Z","updated_at":"2016-01-01T21:55:43Z","closed_at":null,"body":"### Problem\r\n\r\nRight now, we parse some backend configuration before executing the application (when dumping the dependency injection container) and the other config while running the application.\r\n\r\nMy guess is that we could parse the entire backend configuration before executing the application. This would improve performance a bit.\r\n\r\n### Why?\r\n\r\nThe config parsed during runtime is the one related to getting the entity metadata via Doctrine. [This code line](https://github.com/javiereguiluz/EasyAdminBundle/blob/master/Configuration/Configurator.php#L119) and [this method](https://github.com/javiereguiluz/EasyAdminBundle/blob/master/Reflection/EntityMetadataInspector.php#L39-L44) are the ones to blame.\r\n\r\n### Solution\r\n\r\nCurrently we use [ClassMetadataFactory](http://www.doctrine-project.org/api/orm/2.3/source-class-Doctrine.ORM.Mapping.ClassMetadataFactory.html) to get all metadata. But in the first versions of this bundle we used [DisconnectedClassMetadataFactory](http://www.doctrine-project.org/api/orm/2.3/class-Doctrine.ORM.Tools.DisconnectedClassMetadataFactory.html). In [this pull request](https://github.com/javiereguiluz/EasyAdminBundle/issues/23) we did the change (which by the way was originated because of some comments made by @stof).\r\n\r\n### My question\r\n\r\n**This is the problem I want to solve:** I want to get all the Doctrine metadata of the application entities before running the application (i.e. before the container is dumped). My question: is `DisconnectedClassMetadataFactory` the best solution for this problem? Any other suggestions? Thanks!\r\n\r\n\r\n\r\n"},"comment":{"url":"https://api.github.com/repos/javiereguiluz/EasyAdminBundle/issues/comments/168340427","html_url":"https://github.com/javiereguiluz/EasyAdminBundle/issues/729#issuecomment-168340427","issue_url":"https://api.github.com/repos/javiereguiluz/EasyAdminBundle/issues/729","id":168340427,"user":{"login":"ogizanagi","id":2211145,"avatar_url":"https://avatars.githubusercontent.com/u/2211145?v=3","gravatar_id":"","url":"https://api.github.com/users/ogizanagi","html_url":"https://github.com/ogizanagi","followers_url":"https://api.github.com/users/ogizanagi/followers","following_url":"https://api.github.com/users/ogizanagi/following{/other_user}","gists_url":"https://api.github.com/users/ogizanagi/gists{/gist_id}","starred_url":"https://api.github.com/users/ogizanagi/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ogizanagi/subscriptions","organizations_url":"https://api.github.com/users/ogizanagi/orgs","repos_url":"https://api.github.com/users/ogizanagi/repos","events_url":"https://api.github.com/users/ogizanagi/events{/privacy}","received_events_url":"https://api.github.com/users/ogizanagi/received_events","type":"User","site_admin":false},"created_at":"2016-01-01T21:55:43Z","updated_at":"2016-01-01T21:55:43Z","body":"@javiereguiluz : But you don't want to get the definition, but the instantiated service. Use `get`:\r\n\r\n```php\r\nnew MetadataConfigPass($container->get('doctrine')),\r\n```"}}