{"action":"created","comment":{"url":"https://api.github.com/repos/amitaibu/og/pulls/comments/46402122","id":46402122,"diff_hunk":"@@ -0,0 +1,45 @@\n+<?php\n+\n+/**\n+ * @file\n+ * Contains \\Drupal\\og\\OgHelper.\n+ */\n+\n+namespace Drupal\\og;\n+\n+use Drupal\\Core\\Entity\\ContentEntityInterface;\n+use Drupal\\Core\\Field\\FieldException;\n+use Drupal\\Core\\Field\\FieldStorageDefinitionInterface;\n+\n+/**\n+ * OG helper methods.\n+ */\n+class OgHelper {\n+\n+  /**\n+   * Return TRUE if a field can be used and has not reached maximum values.\n+   *\n+   * @param \\Drupal\\Core\\Entity\\ContentEntityInterface $entity\n+   *   The content entity to check the field cardinality for.\n+   * @param string $field_name\n+   *   The field name to check the cardinality of.\n+   *\n+   * @return bool\n+   */\n+  public static function checkFieldCardinality(ContentEntityInterface $entity, $field_name) {\n+    $field_definition = $entity->getFieldDefinition($field_name);\n+\n+    if (!$field_definition) {","path":"src/OgHelper.php","position":32,"original_position":32,"commit_id":"76733d9da77f21e55a442a5edb504096ef3795e3","original_commit_id":"76733d9da77f21e55a442a5edb504096ef3795e3","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":"sure.","created_at":"2015-12-02T11:09:04Z","updated_at":"2015-12-02T11:09:04Z","html_url":"https://github.com/amitaibu/og/pull/56#discussion_r46402122","pull_request_url":"https://api.github.com/repos/amitaibu/og/pulls/56","_links":{"self":{"href":"https://api.github.com/repos/amitaibu/og/pulls/comments/46402122"},"html":{"href":"https://github.com/amitaibu/og/pull/56#discussion_r46402122"},"pull_request":{"href":"https://api.github.com/repos/amitaibu/og/pulls/56"}}},"pull_request":{"url":"https://api.github.com/repos/amitaibu/og/pulls/56","id":52376264,"html_url":"https://github.com/amitaibu/og/pull/56","diff_url":"https://github.com/amitaibu/og/pull/56.diff","patch_url":"https://github.com/amitaibu/og/pull/56.patch","issue_url":"https://api.github.com/repos/amitaibu/og/issues/56","number":56,"state":"open","locked":false,"title":"Og check field cardinality","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":"This just ports the `og_check_field_cardinality` function, so should be pretty self sufficient.\r\n\r\nI created a new `OgHelper` class, as I think we should start using this for things that are more helpers than API. The `Og` class will get way overloaded (more than it is already :)).","created_at":"2015-12-02T10:15:59Z","updated_at":"2015-12-02T11:09:04Z","closed_at":null,"merged_at":null,"merge_commit_sha":"e62b3dcfec6528398d3bd6e9ccf93a46dc09496d","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/amitaibu/og/pulls/56/commits","review_comments_url":"https://api.github.com/repos/amitaibu/og/pulls/56/comments","review_comment_url":"https://api.github.com/repos/amitaibu/og/pulls/comments{/number}","comments_url":"https://api.github.com/repos/amitaibu/og/issues/56/comments","statuses_url":"https://api.github.com/repos/amitaibu/og/statuses/76733d9da77f21e55a442a5edb504096ef3795e3","head":{"label":"damiankloip:og-check-field-cardinality","ref":"og-check-field-cardinality","sha":"76733d9da77f21e55a442a5edb504096ef3795e3","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-02T10:14:33Z","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":5166,"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":"e220a7758ab9a5ed0715d47b90fa5e7e058048ec","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-01T18:00:15Z","pushed_at":"2015-12-02T11:04:42Z","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":5440,"stargazers_count":7,"watchers_count":7,"language":"PHP","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":4,"mirror_url":null,"open_issues_count":15,"forks":4,"open_issues":15,"watchers":7,"default_branch":"8.x-1.x"}},"_links":{"self":{"href":"https://api.github.com/repos/amitaibu/og/pulls/56"},"html":{"href":"https://github.com/amitaibu/og/pull/56"},"issue":{"href":"https://api.github.com/repos/amitaibu/og/issues/56"},"comments":{"href":"https://api.github.com/repos/amitaibu/og/issues/56/comments"},"review_comments":{"href":"https://api.github.com/repos/amitaibu/og/pulls/56/comments"},"review_comment":{"href":"https://api.github.com/repos/amitaibu/og/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/amitaibu/og/pulls/56/commits"},"statuses":{"href":"https://api.github.com/repos/amitaibu/og/statuses/76733d9da77f21e55a442a5edb504096ef3795e3"}}}}