{"action":"created","comment":{"url":"https://api.github.com/repos/pods-framework/pods/pulls/comments/48639802","id":48639802,"diff_hunk":"@@ -59,58 +59,64 @@ public static function get_handler( $object, $field_name, $request ) {\n \t\t$id       = pods_v( 'id', $object );\n \t\t$pod      = self::get_pod( $pod_name, $id );\n \t\tif ( $pod && PodsRESTFields::field_allowed_to_extend( $field_name, $pod, 'read' ) ) {\n+\n \t\t\t$params     = null;\n \t\t\t$field_data = $pod->fields( $field_name );\n \t\t\tif ( 'pick' == pods_v( 'type', $field_data ) ) {\n+\n \t\t\t\t$output_type = pods_v( 'rest_pick_response', $field_data['options'], 'array' );\n \t\t\t\tif ( 'array' == $output_type ) {\n \n \t\t\t\t\t$related_pod = $pod->field( $field_name, array( 'output' => 'pod' ) );\n-\t\t\t\t\t$fields      = $related_pod->fields();\n-\t\t\t\t\t$fields      = array_keys( $fields );\n-\t\t\t\t\tif ( isset( $related_pod->pod_data['object_fields'] ) && ! empty( $related_pod->pod_data['object_fields'] ) ) {\n-\t\t\t\t\t\t$fields = array_merge( $fields, array_keys( $related_pod->pod_data['object_fields'] ) );\n-\t\t\t\t\t}\n+\t\t\t\t\tif ( is_a( $related_pod, 'Pods' ) ) {","path":"classes/PodsRESTHandlers.php","position":18,"original_position":18,"commit_id":"ae858cd588563a51ec0efe4f5f20fa7ea3fdfbb5","original_commit_id":"ae858cd588563a51ec0efe4f5f20fa7ea3fdfbb5","user":{"login":"Shelob9","id":1994311,"avatar_url":"https://avatars.githubusercontent.com/u/1994311?v=3","gravatar_id":"","url":"https://api.github.com/users/Shelob9","html_url":"https://github.com/Shelob9","followers_url":"https://api.github.com/users/Shelob9/followers","following_url":"https://api.github.com/users/Shelob9/following{/other_user}","gists_url":"https://api.github.com/users/Shelob9/gists{/gist_id}","starred_url":"https://api.github.com/users/Shelob9/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Shelob9/subscriptions","organizations_url":"https://api.github.com/users/Shelob9/orgs","repos_url":"https://api.github.com/users/Shelob9/repos","events_url":"https://api.github.com/users/Shelob9/events{/privacy}","received_events_url":"https://api.github.com/users/Shelob9/received_events","type":"User","site_admin":false},"body":" @sc0ttkclark To clarify $related_pod is 1 Pods object `$related_pod = $pod->field( $field_name, array( 'output' => 'pod' ) );` I don't see anyway Pods could return an array there.\r\n\r\n@pglewis - I don't understand the need for `checking if the related object is actually exposed to the REST API.` IF user didn't want to query form this Pod to related Pod user would not have enabled it in UI.\r\n\r\nI think best solution is after `$fields      = $related_pod->fields();` if $fields is false, make it into an  empty array, that way fields can be added to it using or it will return empty `pods_rest_api_fields_for_relationship_response` fitler.","created_at":"2015-12-30T23:42:18Z","updated_at":"2015-12-30T23:42:18Z","html_url":"https://github.com/pods-framework/pods/pull/3317#discussion_r48639802","pull_request_url":"https://api.github.com/repos/pods-framework/pods/pulls/3317","_links":{"self":{"href":"https://api.github.com/repos/pods-framework/pods/pulls/comments/48639802"},"html":{"href":"https://github.com/pods-framework/pods/pull/3317#discussion_r48639802"},"pull_request":{"href":"https://api.github.com/repos/pods-framework/pods/pulls/3317"}}},"pull_request":{"url":"https://api.github.com/repos/pods-framework/pods/pulls/3317","id":54633113,"html_url":"https://github.com/pods-framework/pods/pull/3317","diff_url":"https://github.com/pods-framework/pods/pull/3317.diff","patch_url":"https://github.com/pods-framework/pods/pull/3317.patch","issue_url":"https://api.github.com/repos/pods-framework/pods/issues/3317","number":3317,"state":"open","locked":false,"title":"`field()` will return `false` for relationship fields with no relationships set.  Could resolve #3280","user":{"login":"pglewis","id":1973916,"avatar_url":"https://avatars.githubusercontent.com/u/1973916?v=3","gravatar_id":"","url":"https://api.github.com/users/pglewis","html_url":"https://github.com/pglewis","followers_url":"https://api.github.com/users/pglewis/followers","following_url":"https://api.github.com/users/pglewis/following{/other_user}","gists_url":"https://api.github.com/users/pglewis/gists{/gist_id}","starred_url":"https://api.github.com/users/pglewis/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/pglewis/subscriptions","organizations_url":"https://api.github.com/users/pglewis/orgs","repos_url":"https://api.github.com/users/pglewis/repos","events_url":"https://api.github.com/users/pglewis/events{/privacy}","received_events_url":"https://api.github.com/users/pglewis/received_events","type":"User","site_admin":false},"body":"#3280","created_at":"2015-12-28T05:36:29Z","updated_at":"2015-12-30T23:42:18Z","closed_at":null,"merged_at":null,"merge_commit_sha":"646c4db204954cca58fabfdff061b3f0c9c1b6a5","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/pods-framework/pods/pulls/3317/commits","review_comments_url":"https://api.github.com/repos/pods-framework/pods/pulls/3317/comments","review_comment_url":"https://api.github.com/repos/pods-framework/pods/pulls/comments{/number}","comments_url":"https://api.github.com/repos/pods-framework/pods/issues/3317/comments","statuses_url":"https://api.github.com/repos/pods-framework/pods/statuses/ae858cd588563a51ec0efe4f5f20fa7ea3fdfbb5","head":{"label":"pods-framework:feature/3280-restapi-error-on-relationships","ref":"feature/3280-restapi-error-on-relationships","sha":"ae858cd588563a51ec0efe4f5f20fa7ea3fdfbb5","user":{"login":"pods-framework","id":1049430,"avatar_url":"https://avatars.githubusercontent.com/u/1049430?v=3","gravatar_id":"","url":"https://api.github.com/users/pods-framework","html_url":"https://github.com/pods-framework","followers_url":"https://api.github.com/users/pods-framework/followers","following_url":"https://api.github.com/users/pods-framework/following{/other_user}","gists_url":"https://api.github.com/users/pods-framework/gists{/gist_id}","starred_url":"https://api.github.com/users/pods-framework/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/pods-framework/subscriptions","organizations_url":"https://api.github.com/users/pods-framework/orgs","repos_url":"https://api.github.com/users/pods-framework/repos","events_url":"https://api.github.com/users/pods-framework/events{/privacy}","received_events_url":"https://api.github.com/users/pods-framework/received_events","type":"Organization","site_admin":false},"repo":{"id":1570020,"name":"pods","full_name":"pods-framework/pods","owner":{"login":"pods-framework","id":1049430,"avatar_url":"https://avatars.githubusercontent.com/u/1049430?v=3","gravatar_id":"","url":"https://api.github.com/users/pods-framework","html_url":"https://github.com/pods-framework","followers_url":"https://api.github.com/users/pods-framework/followers","following_url":"https://api.github.com/users/pods-framework/following{/other_user}","gists_url":"https://api.github.com/users/pods-framework/gists{/gist_id}","starred_url":"https://api.github.com/users/pods-framework/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/pods-framework/subscriptions","organizations_url":"https://api.github.com/users/pods-framework/orgs","repos_url":"https://api.github.com/users/pods-framework/repos","events_url":"https://api.github.com/users/pods-framework/events{/privacy}","received_events_url":"https://api.github.com/users/pods-framework/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/pods-framework/pods","description":"The Pods Framework is a Content Development Framework for WordPress - It lets you create and extend content types that can be used for any project. Add fields of various types we've built in, or add your own with custom inputs, you have total control.","fork":false,"url":"https://api.github.com/repos/pods-framework/pods","forks_url":"https://api.github.com/repos/pods-framework/pods/forks","keys_url":"https://api.github.com/repos/pods-framework/pods/keys{/key_id}","collaborators_url":"https://api.github.com/repos/pods-framework/pods/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/pods-framework/pods/teams","hooks_url":"https://api.github.com/repos/pods-framework/pods/hooks","issue_events_url":"https://api.github.com/repos/pods-framework/pods/issues/events{/number}","events_url":"https://api.github.com/repos/pods-framework/pods/events","assignees_url":"https://api.github.com/repos/pods-framework/pods/assignees{/user}","branches_url":"https://api.github.com/repos/pods-framework/pods/branches{/branch}","tags_url":"https://api.github.com/repos/pods-framework/pods/tags","blobs_url":"https://api.github.com/repos/pods-framework/pods/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/pods-framework/pods/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/pods-framework/pods/git/refs{/sha}","trees_url":"https://api.github.com/repos/pods-framework/pods/git/trees{/sha}","statuses_url":"https://api.github.com/repos/pods-framework/pods/statuses/{sha}","languages_url":"https://api.github.com/repos/pods-framework/pods/languages","stargazers_url":"https://api.github.com/repos/pods-framework/pods/stargazers","contributors_url":"https://api.github.com/repos/pods-framework/pods/contributors","subscribers_url":"https://api.github.com/repos/pods-framework/pods/subscribers","subscription_url":"https://api.github.com/repos/pods-framework/pods/subscription","commits_url":"https://api.github.com/repos/pods-framework/pods/commits{/sha}","git_commits_url":"https://api.github.com/repos/pods-framework/pods/git/commits{/sha}","comments_url":"https://api.github.com/repos/pods-framework/pods/comments{/number}","issue_comment_url":"https://api.github.com/repos/pods-framework/pods/issues/comments{/number}","contents_url":"https://api.github.com/repos/pods-framework/pods/contents/{+path}","compare_url":"https://api.github.com/repos/pods-framework/pods/compare/{base}...{head}","merges_url":"https://api.github.com/repos/pods-framework/pods/merges","archive_url":"https://api.github.com/repos/pods-framework/pods/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/pods-framework/pods/downloads","issues_url":"https://api.github.com/repos/pods-framework/pods/issues{/number}","pulls_url":"https://api.github.com/repos/pods-framework/pods/pulls{/number}","milestones_url":"https://api.github.com/repos/pods-framework/pods/milestones{/number}","notifications_url":"https://api.github.com/repos/pods-framework/pods/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/pods-framework/pods/labels{/name}","releases_url":"https://api.github.com/repos/pods-framework/pods/releases{/id}","created_at":"2011-04-05T00:45:14Z","updated_at":"2015-12-24T15:55:51Z","pushed_at":"2015-12-30T14:18:33Z","git_url":"git://github.com/pods-framework/pods.git","ssh_url":"git@github.com:pods-framework/pods.git","clone_url":"https://github.com/pods-framework/pods.git","svn_url":"https://github.com/pods-framework/pods","homepage":"http://pods.io/","size":24442,"stargazers_count":495,"watchers_count":495,"language":"PHP","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":164,"mirror_url":null,"open_issues_count":793,"forks":164,"open_issues":793,"watchers":495,"default_branch":"master"}},"base":{"label":"pods-framework:2.x","ref":"2.x","sha":"48023c69a37242ae1509607d779e882aa44e477b","user":{"login":"pods-framework","id":1049430,"avatar_url":"https://avatars.githubusercontent.com/u/1049430?v=3","gravatar_id":"","url":"https://api.github.com/users/pods-framework","html_url":"https://github.com/pods-framework","followers_url":"https://api.github.com/users/pods-framework/followers","following_url":"https://api.github.com/users/pods-framework/following{/other_user}","gists_url":"https://api.github.com/users/pods-framework/gists{/gist_id}","starred_url":"https://api.github.com/users/pods-framework/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/pods-framework/subscriptions","organizations_url":"https://api.github.com/users/pods-framework/orgs","repos_url":"https://api.github.com/users/pods-framework/repos","events_url":"https://api.github.com/users/pods-framework/events{/privacy}","received_events_url":"https://api.github.com/users/pods-framework/received_events","type":"Organization","site_admin":false},"repo":{"id":1570020,"name":"pods","full_name":"pods-framework/pods","owner":{"login":"pods-framework","id":1049430,"avatar_url":"https://avatars.githubusercontent.com/u/1049430?v=3","gravatar_id":"","url":"https://api.github.com/users/pods-framework","html_url":"https://github.com/pods-framework","followers_url":"https://api.github.com/users/pods-framework/followers","following_url":"https://api.github.com/users/pods-framework/following{/other_user}","gists_url":"https://api.github.com/users/pods-framework/gists{/gist_id}","starred_url":"https://api.github.com/users/pods-framework/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/pods-framework/subscriptions","organizations_url":"https://api.github.com/users/pods-framework/orgs","repos_url":"https://api.github.com/users/pods-framework/repos","events_url":"https://api.github.com/users/pods-framework/events{/privacy}","received_events_url":"https://api.github.com/users/pods-framework/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/pods-framework/pods","description":"The Pods Framework is a Content Development Framework for WordPress - It lets you create and extend content types that can be used for any project. Add fields of various types we've built in, or add your own with custom inputs, you have total control.","fork":false,"url":"https://api.github.com/repos/pods-framework/pods","forks_url":"https://api.github.com/repos/pods-framework/pods/forks","keys_url":"https://api.github.com/repos/pods-framework/pods/keys{/key_id}","collaborators_url":"https://api.github.com/repos/pods-framework/pods/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/pods-framework/pods/teams","hooks_url":"https://api.github.com/repos/pods-framework/pods/hooks","issue_events_url":"https://api.github.com/repos/pods-framework/pods/issues/events{/number}","events_url":"https://api.github.com/repos/pods-framework/pods/events","assignees_url":"https://api.github.com/repos/pods-framework/pods/assignees{/user}","branches_url":"https://api.github.com/repos/pods-framework/pods/branches{/branch}","tags_url":"https://api.github.com/repos/pods-framework/pods/tags","blobs_url":"https://api.github.com/repos/pods-framework/pods/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/pods-framework/pods/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/pods-framework/pods/git/refs{/sha}","trees_url":"https://api.github.com/repos/pods-framework/pods/git/trees{/sha}","statuses_url":"https://api.github.com/repos/pods-framework/pods/statuses/{sha}","languages_url":"https://api.github.com/repos/pods-framework/pods/languages","stargazers_url":"https://api.github.com/repos/pods-framework/pods/stargazers","contributors_url":"https://api.github.com/repos/pods-framework/pods/contributors","subscribers_url":"https://api.github.com/repos/pods-framework/pods/subscribers","subscription_url":"https://api.github.com/repos/pods-framework/pods/subscription","commits_url":"https://api.github.com/repos/pods-framework/pods/commits{/sha}","git_commits_url":"https://api.github.com/repos/pods-framework/pods/git/commits{/sha}","comments_url":"https://api.github.com/repos/pods-framework/pods/comments{/number}","issue_comment_url":"https://api.github.com/repos/pods-framework/pods/issues/comments{/number}","contents_url":"https://api.github.com/repos/pods-framework/pods/contents/{+path}","compare_url":"https://api.github.com/repos/pods-framework/pods/compare/{base}...{head}","merges_url":"https://api.github.com/repos/pods-framework/pods/merges","archive_url":"https://api.github.com/repos/pods-framework/pods/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/pods-framework/pods/downloads","issues_url":"https://api.github.com/repos/pods-framework/pods/issues{/number}","pulls_url":"https://api.github.com/repos/pods-framework/pods/pulls{/number}","milestones_url":"https://api.github.com/repos/pods-framework/pods/milestones{/number}","notifications_url":"https://api.github.com/repos/pods-framework/pods/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/pods-framework/pods/labels{/name}","releases_url":"https://api.github.com/repos/pods-framework/pods/releases{/id}","created_at":"2011-04-05T00:45:14Z","updated_at":"2015-12-24T15:55:51Z","pushed_at":"2015-12-30T14:18:33Z","git_url":"git://github.com/pods-framework/pods.git","ssh_url":"git@github.com:pods-framework/pods.git","clone_url":"https://github.com/pods-framework/pods.git","svn_url":"https://github.com/pods-framework/pods","homepage":"http://pods.io/","size":24442,"stargazers_count":495,"watchers_count":495,"language":"PHP","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":164,"mirror_url":null,"open_issues_count":793,"forks":164,"open_issues":793,"watchers":495,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/pods-framework/pods/pulls/3317"},"html":{"href":"https://github.com/pods-framework/pods/pull/3317"},"issue":{"href":"https://api.github.com/repos/pods-framework/pods/issues/3317"},"comments":{"href":"https://api.github.com/repos/pods-framework/pods/issues/3317/comments"},"review_comments":{"href":"https://api.github.com/repos/pods-framework/pods/pulls/3317/comments"},"review_comment":{"href":"https://api.github.com/repos/pods-framework/pods/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/pods-framework/pods/pulls/3317/commits"},"statuses":{"href":"https://api.github.com/repos/pods-framework/pods/statuses/ae858cd588563a51ec0efe4f5f20fa7ea3fdfbb5"}}}}