{"action":"created","comment":{"url":"https://api.github.com/repos/amitaibu/og/pulls/comments/46813325","id":46813325,"diff_hunk":"@@ -60,7 +64,14 @@ protected function buildEntityQuery($match = NULL, $match_operator = 'CONTAINS')\n     // the default selection handler of the entity, which the field reference\n     // to, and add another logic to the query object i.e. check if the entities\n     // bundle defined as group.\n-    $query = $this->getSelectionHandler()->buildEntityQuery();\n+    $selection_handler = $this->getSelectionHandler();\n+\n+    if (empty($selection_handler)) {\n+      return $query = parent::buildEntityQuery($match, $match_operator);","path":"src/Plugin/EntityReferenceSelection/OgSelection.php","position":30,"original_position":30,"commit_id":"34edab149ee9c1569a89c0ea6c077b9739eb5c37","original_commit_id":"34edab149ee9c1569a89c0ea6c077b9739eb5c37","user":{"login":"amitaibu","id":125707,"avatar_url":"https://avatars.githubusercontent.com/u/125707?v=3","gravatar_id":"","url":"https://api.github.com/users/amitaibu","html_url":"https://github.com/amitaibu","followers_url":"https://api.github.com/users/amitaibu/followers","following_url":"https://api.github.com/users/amitaibu/following{/other_user}","gists_url":"https://api.github.com/users/amitaibu/gists{/gist_id}","starred_url":"https://api.github.com/users/amitaibu/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/amitaibu/subscriptions","organizations_url":"https://api.github.com/users/amitaibu/orgs","repos_url":"https://api.github.com/users/amitaibu/repos","events_url":"https://api.github.com/users/amitaibu/events{/privacy}","received_events_url":"https://api.github.com/users/amitaibu/received_events","type":"User","site_admin":false},"body":"not sure we want to avoid it - can you explain why?\r\n\r\nThe way I see it - if the `$selection_handler` is missing it means something in the configuration is missing, no?","created_at":"2015-12-07T12:00:04Z","updated_at":"2015-12-07T12:00:04Z","html_url":"https://github.com/amitaibu/og/pull/81#discussion_r46813325","pull_request_url":"https://api.github.com/repos/amitaibu/og/pulls/81","_links":{"self":{"href":"https://api.github.com/repos/amitaibu/og/pulls/comments/46813325"},"html":{"href":"https://github.com/amitaibu/og/pull/81#discussion_r46813325"},"pull_request":{"href":"https://api.github.com/repos/amitaibu/og/pulls/81"}}},"pull_request":{"url":"https://api.github.com/repos/amitaibu/og/pulls/81","id":52828848,"html_url":"https://github.com/amitaibu/og/pull/81","diff_url":"https://github.com/amitaibu/og/pull/81.diff","patch_url":"https://github.com/amitaibu/og/pull/81.patch","issue_url":"https://api.github.com/repos/amitaibu/og/issues/81","number":81,"state":"open","locked":false,"title":"Check for selection handler from field configuration before building …","user":{"login":"damiankloip","id":1053891,"avatar_url":"https://avatars.githubusercontent.com/u/1053891?v=3","gravatar_id":"","url":"https://api.github.com/users/damiankloip","html_url":"https://github.com/damiankloip","followers_url":"https://api.github.com/users/damiankloip/followers","following_url":"https://api.github.com/users/damiankloip/following{/other_user}","gists_url":"https://api.github.com/users/damiankloip/gists{/gist_id}","starred_url":"https://api.github.com/users/damiankloip/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/damiankloip/subscriptions","organizations_url":"https://api.github.com/users/damiankloip/orgs","repos_url":"https://api.github.com/users/damiankloip/repos","events_url":"https://api.github.com/users/damiankloip/events{/privacy}","received_events_url":"https://api.github.com/users/damiankloip/received_events","type":"User","site_admin":false},"body":"…a query in OgSelection\r\n\r\nMe and @pfresson saw this last week. It's pretty blocking, as it happens when creating any new nodes OR users. And that is just what I have tried it on. I think it will affect anything really.\r\n\r\nI think part of the problem is that our selection handler is generic, so it doesn't apply to any particular type and it's in the default group, so maybe it gets chosen because of that, I think we might want to change the group too. This manifests itself when validators run, and selection handlers for the fields try to get referenceable entities to validate the entity before save.\r\n\r\nThis currently checks for a field first, as things break hard when that is not available. So at least we have something more robust.\r\n\r\nI am changing the group too. That is actually the only fix that is needed to stop the fatals. Seems quite fragile though - if we were just to rely on the selection handler selection alone.","created_at":"2015-12-07T10:42:50Z","updated_at":"2015-12-07T12:00:04Z","closed_at":null,"merged_at":null,"merge_commit_sha":"7d30ecb9fe4faa7d3aa4a675173c60d0ca3f6fb0","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/amitaibu/og/pulls/81/commits","review_comments_url":"https://api.github.com/repos/amitaibu/og/pulls/81/comments","review_comment_url":"https://api.github.com/repos/amitaibu/og/pulls/comments{/number}","comments_url":"https://api.github.com/repos/amitaibu/og/issues/81/comments","statuses_url":"https://api.github.com/repos/amitaibu/og/statuses/34edab149ee9c1569a89c0ea6c077b9739eb5c37","head":{"label":"damiankloip:selection-new-entities","ref":"selection-new-entities","sha":"34edab149ee9c1569a89c0ea6c077b9739eb5c37","user":{"login":"damiankloip","id":1053891,"avatar_url":"https://avatars.githubusercontent.com/u/1053891?v=3","gravatar_id":"","url":"https://api.github.com/users/damiankloip","html_url":"https://github.com/damiankloip","followers_url":"https://api.github.com/users/damiankloip/followers","following_url":"https://api.github.com/users/damiankloip/following{/other_user}","gists_url":"https://api.github.com/users/damiankloip/gists{/gist_id}","starred_url":"https://api.github.com/users/damiankloip/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/damiankloip/subscriptions","organizations_url":"https://api.github.com/users/damiankloip/orgs","repos_url":"https://api.github.com/users/damiankloip/repos","events_url":"https://api.github.com/users/damiankloip/events{/privacy}","received_events_url":"https://api.github.com/users/damiankloip/received_events","type":"User","site_admin":false},"repo":{"id":40903339,"name":"og","full_name":"damiankloip/og","owner":{"login":"damiankloip","id":1053891,"avatar_url":"https://avatars.githubusercontent.com/u/1053891?v=3","gravatar_id":"","url":"https://api.github.com/users/damiankloip","html_url":"https://github.com/damiankloip","followers_url":"https://api.github.com/users/damiankloip/followers","following_url":"https://api.github.com/users/damiankloip/following{/other_user}","gists_url":"https://api.github.com/users/damiankloip/gists{/gist_id}","starred_url":"https://api.github.com/users/damiankloip/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/damiankloip/subscriptions","organizations_url":"https://api.github.com/users/damiankloip/orgs","repos_url":"https://api.github.com/users/damiankloip/repos","events_url":"https://api.github.com/users/damiankloip/events{/privacy}","received_events_url":"https://api.github.com/users/damiankloip/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/damiankloip/og","description":"https://www.drupal.org/project/og","fork":true,"url":"https://api.github.com/repos/damiankloip/og","forks_url":"https://api.github.com/repos/damiankloip/og/forks","keys_url":"https://api.github.com/repos/damiankloip/og/keys{/key_id}","collaborators_url":"https://api.github.com/repos/damiankloip/og/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/damiankloip/og/teams","hooks_url":"https://api.github.com/repos/damiankloip/og/hooks","issue_events_url":"https://api.github.com/repos/damiankloip/og/issues/events{/number}","events_url":"https://api.github.com/repos/damiankloip/og/events","assignees_url":"https://api.github.com/repos/damiankloip/og/assignees{/user}","branches_url":"https://api.github.com/repos/damiankloip/og/branches{/branch}","tags_url":"https://api.github.com/repos/damiankloip/og/tags","blobs_url":"https://api.github.com/repos/damiankloip/og/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/damiankloip/og/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/damiankloip/og/git/refs{/sha}","trees_url":"https://api.github.com/repos/damiankloip/og/git/trees{/sha}","statuses_url":"https://api.github.com/repos/damiankloip/og/statuses/{sha}","languages_url":"https://api.github.com/repos/damiankloip/og/languages","stargazers_url":"https://api.github.com/repos/damiankloip/og/stargazers","contributors_url":"https://api.github.com/repos/damiankloip/og/contributors","subscribers_url":"https://api.github.com/repos/damiankloip/og/subscribers","subscription_url":"https://api.github.com/repos/damiankloip/og/subscription","commits_url":"https://api.github.com/repos/damiankloip/og/commits{/sha}","git_commits_url":"https://api.github.com/repos/damiankloip/og/git/commits{/sha}","comments_url":"https://api.github.com/repos/damiankloip/og/comments{/number}","issue_comment_url":"https://api.github.com/repos/damiankloip/og/issues/comments{/number}","contents_url":"https://api.github.com/repos/damiankloip/og/contents/{+path}","compare_url":"https://api.github.com/repos/damiankloip/og/compare/{base}...{head}","merges_url":"https://api.github.com/repos/damiankloip/og/merges","archive_url":"https://api.github.com/repos/damiankloip/og/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/damiankloip/og/downloads","issues_url":"https://api.github.com/repos/damiankloip/og/issues{/number}","pulls_url":"https://api.github.com/repos/damiankloip/og/pulls{/number}","milestones_url":"https://api.github.com/repos/damiankloip/og/milestones{/number}","notifications_url":"https://api.github.com/repos/damiankloip/og/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/damiankloip/og/labels{/name}","releases_url":"https://api.github.com/repos/damiankloip/og/releases{/id}","created_at":"2015-08-17T14:54:27Z","updated_at":"2015-08-17T14:54:28Z","pushed_at":"2015-12-07T11:48:20Z","git_url":"git://github.com/damiankloip/og.git","ssh_url":"git@github.com:damiankloip/og.git","clone_url":"https://github.com/damiankloip/og.git","svn_url":"https://github.com/damiankloip/og","homepage":"","size":5238,"stargazers_count":0,"watchers_count":0,"language":"PHP","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"7.x-2.x"}},"base":{"label":"amitaibu:8.x-1.x","ref":"8.x-1.x","sha":"91ac0e172c5b680c5c4f96fac1eef6a31c0fcbdd","user":{"login":"amitaibu","id":125707,"avatar_url":"https://avatars.githubusercontent.com/u/125707?v=3","gravatar_id":"","url":"https://api.github.com/users/amitaibu","html_url":"https://github.com/amitaibu","followers_url":"https://api.github.com/users/amitaibu/followers","following_url":"https://api.github.com/users/amitaibu/following{/other_user}","gists_url":"https://api.github.com/users/amitaibu/gists{/gist_id}","starred_url":"https://api.github.com/users/amitaibu/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/amitaibu/subscriptions","organizations_url":"https://api.github.com/users/amitaibu/orgs","repos_url":"https://api.github.com/users/amitaibu/repos","events_url":"https://api.github.com/users/amitaibu/events{/privacy}","received_events_url":"https://api.github.com/users/amitaibu/received_events","type":"User","site_admin":false},"repo":{"id":42034806,"name":"og","full_name":"amitaibu/og","owner":{"login":"amitaibu","id":125707,"avatar_url":"https://avatars.githubusercontent.com/u/125707?v=3","gravatar_id":"","url":"https://api.github.com/users/amitaibu","html_url":"https://github.com/amitaibu","followers_url":"https://api.github.com/users/amitaibu/followers","following_url":"https://api.github.com/users/amitaibu/following{/other_user}","gists_url":"https://api.github.com/users/amitaibu/gists{/gist_id}","starred_url":"https://api.github.com/users/amitaibu/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/amitaibu/subscriptions","organizations_url":"https://api.github.com/users/amitaibu/orgs","repos_url":"https://api.github.com/users/amitaibu/repos","events_url":"https://api.github.com/users/amitaibu/events{/privacy}","received_events_url":"https://api.github.com/users/amitaibu/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/amitaibu/og","description":"https://www.drupal.org/project/og","fork":true,"url":"https://api.github.com/repos/amitaibu/og","forks_url":"https://api.github.com/repos/amitaibu/og/forks","keys_url":"https://api.github.com/repos/amitaibu/og/keys{/key_id}","collaborators_url":"https://api.github.com/repos/amitaibu/og/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/amitaibu/og/teams","hooks_url":"https://api.github.com/repos/amitaibu/og/hooks","issue_events_url":"https://api.github.com/repos/amitaibu/og/issues/events{/number}","events_url":"https://api.github.com/repos/amitaibu/og/events","assignees_url":"https://api.github.com/repos/amitaibu/og/assignees{/user}","branches_url":"https://api.github.com/repos/amitaibu/og/branches{/branch}","tags_url":"https://api.github.com/repos/amitaibu/og/tags","blobs_url":"https://api.github.com/repos/amitaibu/og/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/amitaibu/og/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/amitaibu/og/git/refs{/sha}","trees_url":"https://api.github.com/repos/amitaibu/og/git/trees{/sha}","statuses_url":"https://api.github.com/repos/amitaibu/og/statuses/{sha}","languages_url":"https://api.github.com/repos/amitaibu/og/languages","stargazers_url":"https://api.github.com/repos/amitaibu/og/stargazers","contributors_url":"https://api.github.com/repos/amitaibu/og/contributors","subscribers_url":"https://api.github.com/repos/amitaibu/og/subscribers","subscription_url":"https://api.github.com/repos/amitaibu/og/subscription","commits_url":"https://api.github.com/repos/amitaibu/og/commits{/sha}","git_commits_url":"https://api.github.com/repos/amitaibu/og/git/commits{/sha}","comments_url":"https://api.github.com/repos/amitaibu/og/comments{/number}","issue_comment_url":"https://api.github.com/repos/amitaibu/og/issues/comments{/number}","contents_url":"https://api.github.com/repos/amitaibu/og/contents/{+path}","compare_url":"https://api.github.com/repos/amitaibu/og/compare/{base}...{head}","merges_url":"https://api.github.com/repos/amitaibu/og/merges","archive_url":"https://api.github.com/repos/amitaibu/og/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/amitaibu/og/downloads","issues_url":"https://api.github.com/repos/amitaibu/og/issues{/number}","pulls_url":"https://api.github.com/repos/amitaibu/og/pulls{/number}","milestones_url":"https://api.github.com/repos/amitaibu/og/milestones{/number}","notifications_url":"https://api.github.com/repos/amitaibu/og/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/amitaibu/og/labels{/name}","releases_url":"https://api.github.com/repos/amitaibu/og/releases{/id}","created_at":"2015-09-07T06:16:12Z","updated_at":"2015-12-02T14:34:05Z","pushed_at":"2015-12-07T11:48:20Z","git_url":"git://github.com/amitaibu/og.git","ssh_url":"git@github.com:amitaibu/og.git","clone_url":"https://github.com/amitaibu/og.git","svn_url":"https://github.com/amitaibu/og","homepage":"","size":5424,"stargazers_count":8,"watchers_count":8,"language":"PHP","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":6,"mirror_url":null,"open_issues_count":28,"forks":6,"open_issues":28,"watchers":8,"default_branch":"8.x-1.x"}},"_links":{"self":{"href":"https://api.github.com/repos/amitaibu/og/pulls/81"},"html":{"href":"https://github.com/amitaibu/og/pull/81"},"issue":{"href":"https://api.github.com/repos/amitaibu/og/issues/81"},"comments":{"href":"https://api.github.com/repos/amitaibu/og/issues/81/comments"},"review_comments":{"href":"https://api.github.com/repos/amitaibu/og/pulls/81/comments"},"review_comment":{"href":"https://api.github.com/repos/amitaibu/og/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/amitaibu/og/pulls/81/commits"},"statuses":{"href":"https://api.github.com/repos/amitaibu/og/statuses/34edab149ee9c1569a89c0ea6c077b9739eb5c37"}}}}