{"action":"opened","issue":{"url":"https://api.github.com/repos/omeka/omeka-s/issues/619","repository_url":"https://api.github.com/repos/omeka/omeka-s","labels_url":"https://api.github.com/repos/omeka/omeka-s/issues/619/labels{/name}","comments_url":"https://api.github.com/repos/omeka/omeka-s/issues/619/comments","events_url":"https://api.github.com/repos/omeka/omeka-s/issues/619/events","html_url":"https://github.com/omeka/omeka-s/issues/619","id":151798701,"number":619,"title":"Doctrine proxies are not generated for entities in Omeka S modules","user":{"login":"jajm","id":306836,"avatar_url":"https://avatars.githubusercontent.com/u/306836?v=3","gravatar_id":"","url":"https://api.github.com/users/jajm","html_url":"https://github.com/jajm","followers_url":"https://api.github.com/users/jajm/followers","following_url":"https://api.github.com/users/jajm/following{/other_user}","gists_url":"https://api.github.com/users/jajm/gists{/gist_id}","starred_url":"https://api.github.com/users/jajm/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jajm/subscriptions","organizations_url":"https://api.github.com/users/jajm/orgs","repos_url":"https://api.github.com/users/jajm/repos","events_url":"https://api.github.com/users/jajm/events{/privacy}","received_events_url":"https://api.github.com/users/jajm/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":0,"created_at":"2016-04-29T06:03:46Z","updated_at":"2016-04-29T06:03:46Z","closed_at":null,"body":"The `data/doctrine-proxies` directory contains Doctrine proxies for all Omeka S entities, but it is not updated when modules are installed/enabled.\r\nIt means that when a module declare two entities with a relation between them, and we try to load one entity, Doctrine will fail to open the proxy file for the other entity.\r\nThis can be fixed by running `vendor/bin/doctrine orm:generate-proxies` but I think this should be automated.\r\nI tried adding this code to Module::install\r\n\r\n```php\r\n$em = $serviceLocator->get('Omeka\\EntityManager');\r\n$metadatas = $em->getMetadataFactory()->getAllMetadata();\r\n$destPath = $em->getConfiguration()->getProxyDir();\r\n$destPath = realpath($destPath);\r\n$em->getProxyFactory()->generateProxyClasses($metadatas, $destPath);\r\n```\r\n\r\nbut it generates proxies for all modules except this one."}}