{"action":"created","issue":{"url":"https://api.github.com/repos/sulu/sulu/issues/2696","repository_url":"https://api.github.com/repos/sulu/sulu","labels_url":"https://api.github.com/repos/sulu/sulu/issues/2696/labels{/name}","comments_url":"https://api.github.com/repos/sulu/sulu/issues/2696/comments","events_url":"https://api.github.com/repos/sulu/sulu/issues/2696/events","html_url":"https://github.com/sulu/sulu/issues/2696","id":168089251,"number":2696,"title":"[RFC] Flush database after creating a new Analytics entity?","user":{"login":"patkar","id":993350,"avatar_url":"https://avatars.githubusercontent.com/u/993350?v=3","gravatar_id":"","url":"https://api.github.com/users/patkar","html_url":"https://github.com/patkar","followers_url":"https://api.github.com/users/patkar/followers","following_url":"https://api.github.com/users/patkar/following{/other_user}","gists_url":"https://api.github.com/users/patkar/gists{/gist_id}","starred_url":"https://api.github.com/users/patkar/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/patkar/subscriptions","organizations_url":"https://api.github.com/users/patkar/orgs","repos_url":"https://api.github.com/users/patkar/repos","events_url":"https://api.github.com/users/patkar/events{/privacy}","received_events_url":"https://api.github.com/users/patkar/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/sulu/sulu/labels/Needs%20Information","name":"Needs Information","color":"ededed"}],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":2,"created_at":"2016-07-28T12:58:33Z","updated_at":"2016-08-23T11:28:30Z","closed_at":null,"body":"| Q | A\r\n| --- | ---\r\n| Bug? | yes when creating multiple entities programmatically\r\n| New Feature? | no\r\n| Sulu Version | dev-develop / `5563e5f`\r\n| Browser Version | -\r\n\r\n#### Actual Behavior\r\n\r\nAfter creating a new `Analytics` entity the database is not flushed. If creating two or more entities with the same domain/env combination they will be saved, but further saves/flushes will fail with a `NonUniqueResultException` at the `AnalyticsManager::findOrCreateNewDomain()`.\r\n\r\nEncountered while adding the tests for #2643 \r\n\r\n#### Expected Behavior\r\n\r\nThe `AnalyticsManager` should not fail if you create a series of `Analytic` entities programmatically.. \r\n\r\n#### Steps to Reproduce\r\n\r\n1. See the `Functional\\Controller\\AnalyticsControllerTest::initEntities()`\r\n2. Change the domain of the `test-4` back to `www.sulu.io/{localization}`\r\n3. `testPost` will now fail\r\n\r\n#### Possible Solutions\r\n\r\nCall `entityManager->flush()` in `AnalyticsManager::create()`"},"comment":{"url":"https://api.github.com/repos/sulu/sulu/issues/comments/241702585","html_url":"https://github.com/sulu/sulu/issues/2696#issuecomment-241702585","issue_url":"https://api.github.com/repos/sulu/sulu/issues/2696","id":241702585,"user":{"login":"danrot","id":405874,"avatar_url":"https://avatars.githubusercontent.com/u/405874?v=3","gravatar_id":"","url":"https://api.github.com/users/danrot","html_url":"https://github.com/danrot","followers_url":"https://api.github.com/users/danrot/followers","following_url":"https://api.github.com/users/danrot/following{/other_user}","gists_url":"https://api.github.com/users/danrot/gists{/gist_id}","starred_url":"https://api.github.com/users/danrot/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/danrot/subscriptions","organizations_url":"https://api.github.com/users/danrot/orgs","repos_url":"https://api.github.com/users/danrot/repos","events_url":"https://api.github.com/users/danrot/events{/privacy}","received_events_url":"https://api.github.com/users/danrot/received_events","type":"User","site_admin":false},"created_at":"2016-08-23T11:28:30Z","updated_at":"2016-08-23T11:28:30Z","body":"Hm, maybe it is possible to ask the entity manager for non flushed entities first, and see if it is in there?"}}
{"actor":{"display_login":"danrot"}}